Make sure you have relevant packages installed
ssh
allows you to log in to a remote machine and execute commands there. It is a secure replacement for the rlogin
, rsh
, and telnet
programs.
telnet
, to log in to a remote machine named penguin.example.com
, type the following command at a shell prompt:
~]$ ssh penguin.example.com
ssh username@hostname
form. For example, to log in as john
, type:
~]$ ssh john@penguin.example.com
The authenticity of host 'penguin.example.com' can't be established. RSA key fingerprint is 94:68:3a:3a:bc:f3:9a:9b:01:5d:b3:07:38:e2:11:0c. Are you sure you want to continue connecting (yes/no)?
yes
to confirm. You will see a notice that the server has been added to the list of known hosts, and a prompt asking for your password:
Warning: Permanently added 'penguin.example.com' (RSA) to the list of known hosts. john@penguin.example.com's password:
Updating the host key of an SSH server
~/.ssh/known_hosts
file. To do so, open the file in a text editor, and remove a line containing the remote machine name at the beginning. Before doing this, however, contact the system administrator of the SSH server to verify the server is not compromised.
ssh
program can be used to execute a command on the remote machine without logging in to a shell prompt. The syntax for that is ssh [username@]hostname command
. For example, if you want to execute the whoami
command on penguin.example.com
, type:
~]$ ssh john@penguin.example.com whoami
john@penguin.example.com's password:
john