This site has been moved to “requesttutorial.com“
I will be working on Ubuntu 12.04 to setup ssh server but you can apply the same principle to all of Linux versions. so lets get going…
sudo apt-get install ssh
To start the service type
sudo service start ssh
sudo /etc/inid.d/sshd start
Login to client
Once you are done, Now you want to connect to client or remote system type
e.g. as in the image below
Now you can are logged in and you can type all sort of commands like ls and nano to edit files.
Access Graphical Interface/Utilities:
Another handy feature of ssh you would love is that you can access the graphical utility e.g if you want to use gedit of the remote computer instead of nano or you want to browse the file system. To do this you will have to login with the -X parameter. To do this
ssh -X username@<client’s IP> and hit enter and now you can use the graphical utilities as well e.g.
To browse the filesystem…
This will open gedit on remote system and present it to you as shown in image below
Setting up Keys to login in to remote system:
To login without password, you need to setup public private keys and then copy the public key to the server and keep the private key with your self. The holder of the private key can login in to the system without password.
To generate the keys, type
ssh-keygen -t rsa
If the keys already exists, you will be asked to replace them, choose whether you want to replace them or not.
You will be prompt to enter a pass-phrase, This isn’t the system password but its the password to unlock the key (you will be prompt everything you use the key, This is for protection against key-theft), Just press Enter if you dont want to Enter any Key.
Your generated Keys will be saved in /home/<user>/.ssh directory
Now there will be two files in .ssh folder (the folder will be created automatically)
id_rsa (private Key)
id_rsa.pud (public key)
To copy key to the server type the command
scp .ssh/id_rsa.pud username@server-ip:/home/<user>/.ssh
mkdir .ssh cat id_rsa.pub > authorized_keys
now to connect to the server, type
If you get an error like “Agent admitted failure to sign using the Key”
To Fix this problem, issue the following command to fix this problem
Another solution is by issuing the following command to login
ssh -i .ssh/id_rsa username@server-ip
For Windows users:
One solution to connect to a Linux server is to use putty but I prefer MobaXterm that is far better then putty and handles all the detail I mentioned above seamlessly, Click here to Download MobaXterm. If has a pretty neat and easy to use GUI and Its not just a ssh client but do alot of other interesting stuff. Its a one window service to all your server. Go ahead and explore it your self.