Connecting to a remote computer in a secure way

[id : 271] [28/08/2007] [hits : 50877]

Secure shell (ssh) is a protocol that allows you to connect between two computers in a secure way, that is without anyone being able to intercept the communication between your computer and the remove computer. Secure copy (scp) allows you to transfer files between two computers in a secure way.

Secure shell

On UNIX, Linux and Mac OS X computers, you can execute the command

ssh username@host

to logon onto the server host as user username in a secure way.


ssh myuser@hydra.vub.ac.be
On Windows computers, you need to install a dedicated program to be able to connect to servers in a secure way. PuTTY is a free Telnet/SSH program for Windows.

Secure copy

On UNIX, Linux and Mac OS X computers, you can execute the command

scp file username@host:file
scp username@host:file file

to transfer files from one system to another.

Logging on with ssh and scp without requiring a password
Note: not having to enter a password is a safety risk!
First execute the following command on the system you want to logon from.

ssh-keygen -t rsa

You can leave the passphrase empty (just press the Enter key to continue).

The above command has created a file .ssh/id_rsa.pub that you have to copy to the server you wish to connect to. You can transfer the file by FTP or with the following command

scp .ssh/id_rsa.pub username@host:.ssh/authorized_keys
Beware! If the file authorized_keys already exists on the server, you will overwrite it this way. If you wish to add keys to this file, you will have to logon onto the server and manually edit and add the keys to this file.
Once the files are in place, you can logon and transfer files to/from the server without having to enter a password.
If the directory .ssh does not exist on the remote server, you will have to create it first, either by FTP or by ssh:

ssh username@host mkdir .ssh
Note for NESTOR users
As you cannot execute commands with ssh on NESTOR, you will have to create the directory .ssh by logging on with FTP onto NESTOR and issuing the FTP command:

mkdir .ssh

Peter Van Rossem - helpdesk@vub.ac.be

You can omit user@ in the ssh and scp instructions if your username on the system you connect from is the same as the one on the system you connect to.


: :: ::: ::::