Follow us on facebook

Monday 22 April 2013

SSH (Secure Shell)

Ubuntu Linux: Start / Stop / Restart OpenSSH ( SSH ) Server
sh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to replace rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over an insecure network. X11 connections and arbitrary TCP/IP ports can also be forwarded over the secure channel.

ssh supports RSA based authentication. The scheme is based on public-key cryptography: there are cryptosystems where encryption and decryption are done using separate keys, and it is not possible to derive the decryption key from the encryption key. RSA is one such system. The idea is that each user creates a public/private key pair for authentication purposes. The server knows the public key, and only the user knows the private key. The file $HOME/.ssh/authorized_keys lists the public keys that are permitted for logging in. When the user logs in, the ssh program tells the server which key pair it would like to use for authentication. The server checks if this key is permitted, and if so, sends the user (actually the ssh program running on behalf of the user) a challenge, a random number, encrypted by the user's public key. The challenge can only be decrypted using the proper private key. The user's client then decrypts the challenge using the private key, proving that he/she knows the private key but without disclosing it to the server.

ssh implements the RSA authentication protocol automatically. The user creates his/her RSA key pair by running ssh-keygen1. This stores the private key in $HOME/.ssh/identity and the public key in $HOME/.ssh/identity.pub in the user's home directory. The user should then copy the identity.pub to $HOME/.ssh/authorized_keys in his/her home directory on the remote machine (the authorized_keys file corresponds to the conventional $HOME/.rhosts file, and has one key per line, though the lines can be very long). After this, the user can log in without giving the password. RSA authentication is much more secure than rhosts authentication.
I need to provide a remote access to my Ubuntu Linux server. How do I start / stop OR restart the ssh server under Ubuntu Linux operating system?

You need to run a script called /etc/init.d/ssh to stop / start / restart OpenSSH server. You can also use the service command to control a System V init script.
Install
To install the SSH server use this command:
Code:
# sudo apt-get install openssh-server
OR
# sudo apt-get install openssh-server openssh-client
Ubuntu Linux: Start OpenSSH Server
Type the following command:
$ sudo /etc/init.d/ssh start
OR
$ sudo service ssh start
Ubuntu Linux: Stop OpenSSH server
Type the following command:
$ sudo /etc/init.d/ssh stop
OR
$ sudo service ssh stop
Ubuntu Linux: Restart OpenSSH server
Type the following command:
$ sudo /etc/init.d/ssh restart
OR
$ sudo service ssh restart

0 comments:

Post a Comment