Using ssh: Difference between revisions

From LPTMS Wiki
Jump to navigation Jump to search
m (Created page with "* you work on a computer and you want to easily connect another distant computer without entering you password at each time. To do so, you must generate a private and a public ke...")
(No difference)

Revision as of 14:27, 19 November 2011

  • you work on a computer and you want to easily connect another distant computer without entering you password at each time. To do so, you must generate a private and a public key on your computer to be put on the .ssh directory on your home, using, for instance, the dsa protocol:
ssh-keygen -t dsa

Then, you have the two new files in the ssh directory

id_dsa
id_dsa.pub

Add the public key id_dsa.pub to the list of keys in the .ssh/authorized_keys file of the distant computer (create the file if it does not exist). Now it should work for you!

In addition, you can simplify the connection by configuring your ssh. Edit the .ssh/config file on your computer and enter

StrictHostKeyChecking no

Host RemoteComputer
       Hostname computer.domain.com
       User username
       Protocol 2
       ForwardX11 yes

Protocol 2 is for ssh2 and ForwardX11 enables you to open a remote Xwindow. Typing

ssh RemoteComputer

or

scp RemoteComputer:File .

is now sufficient to connect the distant computer without entering your password. You can add several Host in this file.

  • you want to execute a single command on a distant computer without connecting to the computer.
  • ssh tunnels... (to be done)