Differences between revisions 3 and 4
Revision 3 as of 2007-10-06 12:49:44
Size: 2517
Editor: ?LaurenzWiskott
Comment:
Revision 4 as of 2007-10-06 12:54:02
Size: 2697
Editor: ?LaurenzWiskott
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:

Throughout this document it will be assumed that the following two variables are defined
{{{
RemoteHost=<the remote computer>
RemoteUser=<your user name on $RemoteHost>
}}}

Introduction

ssh stands for secure shell and is a program for remote logins into other computers and for running single commands on other computers in a save way, see [http://en.wikipedia.org/wiki/Secure_Shell Wikipedia - Secure Shell] for more general information and [http://www.openssh.org/ OpenSSH] for the ssh homepage.

Throughout this document it will be assumed that the following two variables are defined

RemoteHost=<the remote computer>
RemoteUser=<your user name on $RemoteHost>

Remote login

If you as user 'meHere' work on one a computer named 'compHere' and you want to login to another computer with name 'compThere' as user 'meThere' you simply type

ssh meThere@compThere

Please replace 'meThere' and 'compThere' with the true remote usernames and computer names. A computer name could also be an IP-number. If the usernames on the local and the remote computer are identical, you can drop the meThere@-part and simply write

ssh compThere

If this is the first time you login to compThere, ssh will ask you whether you are sure you want to connect to the remote computer. Answer 'yes' and then type in your password, and ssh will do a remote login to compThere for you.

Remote commands

If you just want to run one command on the remote computer, you don't need to login. You can tell ssh to run the command, e.g.

ssh compThere ls *.txt

lists all files with extension .txt on the remote computer. ssh will not log you in on the remote computer.

ssh without password

If you work on a remote computer often, typing in the password each time you use ssh becomes annoying. You can configure ssh such that it does not ask you for a password anymore for that particular connection. You have to generate a private and public encryption key on your local machine and provide the public key to the remote machine. To generate the keys run

ssh-keygen -t dsa

and reply to all questions just with return.

To provide the public key to the remote machine first create there an .ssh directory (if not present already) and then append the public key of your local machine to the authorized_keys file on the remote machine.

ssh meThere@compThere mkdir -p .ssh
cat .ssh/id_dsa.pub | ssh meThere@compThere 'cat >> .ssh/authorized_keys'

From now on, you should be able to login with ssh without password.

  • TROUBLESHOOTING (ssh still asks for a password): Login without password does not work if group or world has write permissions for the home directory on the remote machine. To fix that, run

    ssh meThere@compThere chmod g-w,a-w /home/meThere