copy files remotely over internt
SSH stands for “secure shell” and its a program and protocol also. Through SSH you can use the applications that are available in a remote computer on internet even if you don't have it in local machine. Only requirement is a working internet connection and an account in the remote machine. The OpenSSH program suite, developed by the OpenBSD project, offers a free SSH facility with everything necessary to use encrypted connections on different operating systems:
:: commandline tools for working on remote machines
:: to execute programs remotely
:: to tunnel Internet services via SSH
:: tools for secure file copying
OpenSSH is a must-have application in any recent Linux distribution. Most systems offer separate packages for the client and the server. Server program is necessary if you want to access your Linux computer via SSH from another machine.
Applications . . .
- You can login to your office computer remotely from
home and do all the office work @ home
- Using ssh tunnelling you can communicate over the
restrictions imposed by proxies and firewalls
Functions of SSH
ssh :The command-line client establishes
encrypted connections to remote machines
and will run commands on these machines if
needed.
scp :To copy files (non-interactively) locally to or
from remote computers, you can use scp
(“secure copy”).
sftp :The ftp client (“secure ftp”) supports
interactive copying. Like other command line
ftp clients, the tool offers many other options
such as copying, changing and listing
directories, modifying permissions, deleting
directories and files, and more...
sshd :The SSH server is implemented as a daemon
and listens on port 22 by default. SSH clients
establish connections to the sshd.
Installation & Configuration
Take the terminal and type in following commands to install SSH
$ sudo apt-get install openssh-server openssh-client
Inorder to test ssh please type in the following command...
$ ssh localhost
To stop ssh server, type in
$ sudo /etc/init.d/ssh stop
To start sshs server, type in
$ sudo /etc/init.d/ssh start
To restart ssh server, type in
# sudo /etc/init.d/ssh restart
Remote login using SSH
You can remotely login to another machine on the internet by using the following command,
$ ssh -X username@100.100.100.3
Replace the username and ip (100.100.100.3) with the one corresponding to you. X option enables the Xserver.
On executing the above command, the terminal prompt changes to user@remotemachine:~$ you can execute any command as if you are logged in at the remotemachine. Any application from that remote machines can be run by executing the command
examples :
user@remotemachine:~$ firefox
for starting firefox on a remote machine
user@remotemachine:~$ nautilus
for starting the file manager on remote
machine
user@remotemachine:~$gnome-session
to start the gnome session so that you get the
desktop with all the features, then you can
perform everything in graphical user
environment
Copying files from remote system
The ssh command alone allows remote login only, but you can copy a file in a remote system to your local machine using the 'scp' command.
1. You are already logged in at user@local$
2. Login to the remote machine using the ssh
command. Then the terminal prompt will change to
user@remote$
3. Type in the scp command as follows
$
scp filename user@ip_local:destination
filename :: the file to be copied which is
in remote machine
ip_local :: ip adress of your machine
destination :: destination folder where the
copied files are to be saved
Then the terminal will prompt for your accounts password...
Thats all for now with ssh and scp. You can refer the man page of ssh and scp to see more details in case of using them under a proxy server and also for advanced features...