[phasnip@mijpnb1 ~]$ ssh -X pjh503@erik.york.ac.uk pjh503@erik.york.ac.uk's password: Last login: Tue Oct 24 2006 12:23:11 +0100 from mijpnb1.york.ac.uk [pjh503@erik ~]$The -X tells ssh to forward X data, which basically lets programs you run on the remote machine open windows on the machine in front of you. Next you put your user ID followed by `@' and the machine name. When the command runs you will be prompted for your password, and to prevent someone spying over your shoulder the characters you type will not appear on the screen.
Occasionally you may find a remote machine that does not listen to ssh requests. In this case you may have to resort to the insecure `remote shell' command, rsh. This command does not have a -X switch and it is a little harder to let programs open windows on your machine. It is also very easy to detect the password you send so if you can only use rsh to get to a machine set that machine up with a different password to your other ones.
If you still cannot connect to a machine then you need to know whether your requests are actually making it to the remote machine. To test this use the ping command, which sends a series of small packets of data over the network and asks the remote machine to send them back.
[phasnip@mijpnb1 Linux]$ ping erik.york.ac.uk PING erik.york.ac.uk (144.32.34.191) 56(84) bytes of data. 64 bytes from erik.york.ac.uk (144.32.34.191): icmp_seq=0 ttl=64 time=0.172 64 bytes from erik.york.ac.uk (144.32.34.191): icmp_seq=1 ttl=64 time=0.178 64 bytes from erik.york.ac.uk (144.32.34.191): icmp_seq=2 ttl=64 time=0.162 --- erik.york.ac.uk ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2000ms rtt min/avg/max/mdev = 0.162/0.170/0.178/0.016 ms, pipe 2 [phasnip@mijpnb1 Linux]$
The time the whole trip takes is called the round-trip time (RTT), and ping gives a lot of data about that. The most important statistic though is the packet loss, i.e. what percentage of packets were not returned. If both machines and the network are functioning properly there will be 0% packet loss; anything else indicates a possible error, and in particular if the packet loss is 100% then something fundamental is broken and there's no point trying to connect until it is resolved.
You may also need to be able to copy files to and from machines, and to do this you use the `secure copy' command, scp
[phasnip@mijpnb1 Linux]$ scp linux.tex pjh503@erik.york.ac.uk: pjh503@erik.york.ac.uk's password:
Notice that after the machine name there is a colon - you can add a path after this to determine exactly where the file goes, otherwise it will be put in your home directory on the remote machine. If you miss the colon off then scp will copy the file to another file on the local machine called `pjh503@erik.york.ac.uk'!
You can also use scp to transfer files from a remote machine to a local machine.
[phasnip@mijpnb1 Linux]$ scp pjh503@erik.york.ac.uk:linux.tex . pjh503@erik.york.ac.uk's password:
Most modern Linux installations also support the secure file-transfer protocol, or sftp. This is easier to use than scp for transferring lots of files because it allows you to list the remote machine's files, change directory on the remote machine and so on.
[phasnip@mijpnb1 Linux]$ sftp pjh503@erik.york.ac.uk pjh503@erik.york.ac.uk's password: sftp>
Once you get to the sftp prompt, you can use ls, pwd and cd as usual, though without most of the Linux options, and transfer single files using get and put. Multiple files can be tranferred using mget and mput and these will accept wildcards. To exit use quit or bye.