A Linux / Unix question for you...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Other forums
- :
- Tech Help - Software/Hardware etc
- :
- Re: A Linux / Unix question for you...
A Linux / Unix question for you...
07-01-2008 12:08 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
In Dundee, there are a number of core machines which function as routers within the network, and they have graphing capabilities on them. Access to the graphs is UN/PW protected, but you can access the files by SSH into the box.
What I would like to do is periodically ( 5 mins or so ) grab the files, and transfer them (possibly by FTP?) to a central machine for processing..
I know I would use cron jobs to schedule the transfers.. but as to how to do the actually push of the files Im not so sure!
Hopefully there is a linux guru out there who can help
Re: A Linux / Unix question for you...
07-01-2008 12:16 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: A Linux / Unix question for you...
07-01-2008 12:24 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: A Linux / Unix question for you...
07-01-2008 12:45 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
ftp < ftpcommandfile
[quote=ftpcommandfile]
USER
username
PASS
passwordinplaintext
ls
etc
Re: A Linux / Unix question for you...
07-01-2008 1:09 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
It need not be only FTP, im open to any file transfer options.
Pretty much, the setup is like this...
Gardner-St.Core - 192.168.0.1 (servs GS)
Dock-St-East.core - 192.168.10.1 (servs DSE)
Dock-St-West.Core - 192.168.20.1 (servs DSW)
There are more, but that should suffice for now
There is a monitoring box which sits in the managed lan, 192.168.254.27 I belive it is.
All of the core nodes, generate graphs. One such example is the data file "/var/dscn/logging/stat-wan-qos-queues.rrd" or "/var/dscn/logging/stat-global-traffic-load.rrd". What im am after, is to push these files out to 192.168.254.27 at, say 5 min intervals or such so they can be processed and displayed centrally.
Hope that clears up what Im trying to do
Re: A Linux / Unix question for you...
07-01-2008 1:48 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
scp allows you to copy files from remote servers using an ssh tunnel
The most basic usage is something like:
scp root@radagast:/var/log/messages ./messages
Where root is the remote user, and radagast is the name of the server (or IP address)
This uses an interactive prompt for the password. For security, you cannot pass the password on the command line.
There is a way to prevent the remote server requesting a password, which you can do by doing the following:
- Decide which user on the local machine will be using scp later on. Of course, root gives you the most power, and that's how I personally have done it. I'm not going to give you a lecture here on the dangers of root, so if you don't understand them, choose a different user. Whatever you choose, log in as that user now and stay there for the rest of the procedure. Log in as this same user when you use scp later on.
- Generate a public/private key pair on the local machine. Say what? If you're not familiar with public key cryptography, here's the 15-second explanation. In public key cryptography, you generate a pair of mathematically related keys, one public and one private. You then give your public key to anyone and everyone in the world, but you never ever give out your private key. The magic is in the mathematical makeup of the keys; anyone with your public key can use it to encrypt a message, but only you can decrypt it with your private key. Anyway, the syntax to create the key pair is:
ssh-keygen -t rsa
In response, you should see:
Generating public/private rsa key pair
Enter file in which to save the key ...
Press Enter to accept this.
In response, you should see:
Enter passphrase (empty for no passphrase):
You don't need a passphrase, so press Enter twice.
In response, you should see:
Your identification has been saved in ...
Your public key has been saved in ...
Note the name and location of the public key just generated. It always ends in .pub.- Copy the public key just generated to all of your remote Linux boxes. You can use scp or FTP or whatever to make the copy. Assuming you're using root--again, see my warning in step 1--the key must be contained in the file /root/.ssh/authorized_keys. Or, if you are logging in as a user, for example, clyde, it would be in /home/clyde/authorized_keys. Notice that the authorized_keys file can contain keys from other PCs. So, if the file already exists and contains text, you need to append the contents of your public key file to what already is there.
That should allow you to issue the scp command (and in fact ssh directly) to automatically copy files using a cron job or similar.
A word about security. This local PC just became pretty powerful, as it now has access to all the remote PCs with only the one local password. So that one password better be strong and well guarded.
B.
Re: A Linux / Unix question for you...
07-01-2008 1:48 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
scp -r /var/dscn/logging/* user@192.168.254.27:/var/dscn/logging/`hostname`/
Would SCP them to a folder named after the hostname of the server on the monitoring server...
Something tells me that RRD files are architecture-dependant though so you may find they don't work...
Re: A Linux / Unix question for you...
07-01-2008 1:52 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Im also looking at rsync, although the ssh method by barry seems to be pretty straight forward.
I suppose its very much 'suck-it-and-see' as far as wether the graphing works or not!
Re: A Linux / Unix question for you...
07-01-2008 4:21 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
A couple of questions for Barry:
Does scp automatically detect the presence of the key-pairs and therefore not require further intervention? (so authentication when using scp becomes transparent to the user "as if" it were a cp on the same box)?
Could I use puTTY on an XP box and connect transparently using rsa key-pairs generated with puTTYgen to a Linux box? Or would I have to have a Linux pscp ? (I realise that this may have to be asked of Simon Tatham, but you may know)
EDIT: Should have tried it before I posted, which I have now done, and the answers are Yes, Yes, Yes and No
paul
Re: A Linux / Unix question for you...
07-01-2008 4:56 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote from: paulh Does scp automatically detect the presence of the key-pairs and therefore not require further intervention? (so authentication when using scp becomes transparent to the user "as if" it were a cp on the same box)?
Yes is the short answer.
SSH supports Public Key authentication, and scp is effectively opening an ssh connection on your behalf. It is actually SSH that is establishing the secure connection in the background. SCP merely tunnels over it.
Quote from: paulh Could I use puTTY on an XP box and connect transparently using rsa key-pairs generated with puTTYgen to a Linux box? Or would I have to have a Linux pscp ? (I realise that this may have to be asked of Simon Tatham, but you may know)
I use putty extensively, but have never managed to get it to work nicely with OpenSSH on the server. I'll play a bit more with it to see if I can figure it out.
B.
Re: A Linux / Unix question for you...
07-01-2008 5:12 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
On Linux (in my case Puppy 3.01) run ssh-keygen -t rsa
On XP run puTTYgen, generate a SSH-1 rsa keypair, save the private key as a .ppk file.
Create an authorized_keys file on the Linux machine (in ./.ssh/) with the public key from puttygen pasted into it.
On XP run
putty -i whatever.ppk user@hostand robert's yer father's brother
pscp works equally tidily:
pscp -i whatever.ppk user@host:file file
very nice -- glad I spotted this thread. I've learned something useful.
paul
Re: A Linux / Unix question for you...
07-01-2008 7:28 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: A Linux / Unix question for you...
11-01-2008 11:00 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
# scp test.rrd usr@80.229.xxx.yyy:/var/rrd/gdst/
Now the problem I have, is that ssh runs on the remote server, for about 5 seconds, before it stops and kicks all clients offline, and only a physical reboot of the server will bring it back again!
Anybody any ideas about this, its a complete new built server!
--Confused as heck--
Re: A Linux / Unix question for you...
12-01-2008 8:09 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
also post the sshd startup line from rc.d or whatever
have a sniff round the forum for your distro as well, as there's usually someone who's had a similar problem or is willing to help
always good to have a look at the kernel logs and messages file too.
Re: A Linux / Unix question for you...
12-01-2008 12:54 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
according to the service manager, the service is stil running, it hasnt stopped, and has generated not output errors at all!
The dristo im running is Fedora Core 8 running on 2 x 2.66Ghz Dual Core Xeon, 6Gb ram, 5 x 146Gb hdd so the platform should be ok for it.
I will pull that starter lines for it out of the kernel file later on today.
Scott
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Other forums
- :
- Tech Help - Software/Hardware etc
- :
- Re: A Linux / Unix question for you...