This is a small guide just for beginners to get started with SSH.SSH has a LOT of applications as it is a protocol by itself. The main highlight of SSH is that its very secure , you could use SSH without any worries even using an insecure connection . Suppose your using a public network like a network at a cafe or a hotel and you are not comfortable accessing your company's VPN or email or bank account or even transfer files to and from your company's server , in such cases you could create an SSH tunnel to your machine and safely browse through or transfer data without any worry as everything that is transmitted through the SSH tunnel is encrypted . So here's more on this :
SSH can completely replace telnet , ftp and a lot of other insecure protocols . SSH works on a few commands which are not at all complicated and very easy to learn . You can transfer files to and from a computer using SCP which works through SSH. Even access to the terminal of a remote computer . SSH can also be used for backups using rsync , Remote access of a remote machine , vpn etc . There are a LOT applications and you can get started with all of this by first setting up SSH. So here's how you do that :
INSTALLING SSH SERVER
Go to the Terminal(Application->Accessories->Terminal) and type sudo apt-get install openssh . This would install the openssh server , the client is by default installed on ubuntu linux machines , if not type sudo apt-get install openssh-client in the terminal
TO CONNECT TO SSH SERVER
To connect to the SSH Server from a remote machine , go to the Terminal(Application->Accessories->Terminal) and type ssh prash@prash-desktop .. here prash is the username and prash-desktop is the machine on which the SSH server was installed . You could also use the ip address instead of hostname , say prash-desktop has an ip 192.168.1.10 , then you would have to type ssh prash@192.168.1.10 . If you want to access this over the internet , then you could type ssh prash@x.x.x.x where x.x.x.x is the external ip ( the one you get by going to www.ip-adress.com ) , remember you need port 22 open for this as ssh uses this port ( Discussed Later ) .
So as you can see from the screenshot above , i am now logged in to the prash-desktop terminal . Now i can type any command as if i was sitting right in front of the machine , Now there a lot of applications for this , you could remote launch an app , you could use the standard commands check cron tasks , uptime etc.. So all of this cannot be discussed here , i will be mentioning only a few in brief..
APPLICATIONS OF SSH
1)REMOTE DESKTOP
for this you need to enable remote desktop on the server machine , just go to System->Preferences->Remote Desktop and enable it ( A Detailed Guide is available HERE ) . now in the Terminal of the client type ssh -X prash@prash-desktop , this would first connect you , remember the -X is important . Then type vncviewer localhost and you should be connected . If vncviewer is not installed just open another terminal and type sudo apt-get install vncviewer
The screenshot above shows a remote desktop session of prash-desktop from another machine using SSH
2)FILE TRANSFER
As an example lets say i want to copy a folder called test from my home folder to the Desktop folder of prash-desktop , then the command to type would be scp -r /home/prash/test prash@prash-desktop:/home/prash/Desktop . This would copy the file successfully . Below is the screenshot of this
Now if you want to copy a folder say test2 placed in the home folder from prash-desktop to your client machine on the desktop then you need to type scp -r prash@prash-desktop:/home/prash/test2 /home/prash/Desktop . The basic syntax is scp -r sourcefolder destinationfolder
3)REMOTELY TYPE COMMANDS
This is mentioned earlier for this all you need to do is type ssh prash@prash-desktop and type whatever command you wish . For example the uptime command
4)REMOTELY LAUNCH APPLICATIONS
This is actually an extension of Remote desktop i mentioned earlier , for this in the terminal of the client type ssh -X prash@prash-desktop . (obviously replace prash and prash-desktop accordingly) . Then type the command associated with the application you wish to launch . For example say i want to launch pidgin . So i type pidgin in the terminal . Then pidgin would launch on the client machine as if it was launched on prash-desktop , therefore the user accounts like yahoo,gtalk etc would be the same which was used on prash-desktop . Same way you could run firefox etc..
These are just the basic applications , there are a lot more applications which i will try covering later.
ACCESS SSH OVER THE INTERNET
You can access this SSH server over the internet just like you how you can access it over LAN , only thing is you need to open port 22 on your router . If you run any software firewall on your machine like firestarter,ufw etc , you would need to open port 22 there as well . To oepn port 22 on your router , you could visit www.portforward.com and look for a guide on your router . BUt here are 2 general guides which should work for most routers
1)ROUTERS which have VIRTUAL SERVER option
2)ROUTER which have NAT-DMZ option
FINAL WORDS
I am a big fan of ssh and i use it quite often , though yes the speed is a bit less because everything is encrypted , it should not matter if you have a high speed broadband internet connection . SSH has a lot of applications and is definetly a MUST for those who frequently access SENSITIVE data using a public insecure internet connection
|
3
comments
]
3 comments
Can use this for windows xp?
Well yes , but the procedure is not the same.. Will try writing a tutorial on how to do it in windows soon.. the ssh client for windows is PUTTY
Excellent guide.
Post a Comment