OpenSSH is a well known program which allows you to login to a host remotely, and run commands etc. It also comes with a simple file transfer system which can be used to transfer files securely. scp is the command to use. You can either transfer files to the remote machine from your local one, or vice versa.
Usage is as simple as:
If you wish to transfer a lot of files you can copy a directory recurisvely, with the -r flag.
When it comes to sending files to and from you Unix machine from a Windows desktop you can use the excellent open source program WinSCP which presents a drag and drop interface to remote file systems - allowing you to drag and drop files with ease.
With OpenSSh installed you have no reason to be running insecure systems such as FTP to copy files to and from your Unix servers.
================
The scp command copies files to or from a remote Linux system. You will be prompted for your TCC password for authentication.
You can this way copy files from or to a remote server, you can even copy files from one remote server to another remote server, without passing through your PC.
Usage
Description of options
scp *.txt user@remote.server.com:/home/user/
This will copy all files with .txt extension to the directory /home/user in the remote.server.com host
Note
To use this command you need to have open-ssh installed in the hosts.
===========
Warning: Be careful when copying between hosts files that have the same names; you may accidently overwrite them.
The syntax for the
scp [options] [[user@]host1:]filename1 ... [[user@]host2:]filename2 For example, if user
scp file1.txt dvader@deathstar.com:somedir Likewise, if he wanted to copy the entire contents of the
scp -r dvader@deathstar.com:somedir somedir Similarly, if he is working on another computer, but wanted to copy a file called
scp dvader@empire.gov:file1.txt dvader@deathstar.com:somedir When using wildcards (e.g.,
For more information about
man scp
===========
Thanks to:
http://www.kb.iu.edu/data/agye.html
http://www.go2linux.org/scp-linux-command-line-copy-files-over-ssh
http://www.debian-administration.org/articles/27
http://infohost.nmt.edu/tcc/help/xfer/scp.html
Usage is as simple as:
scp file-to-send user@host:/path/to/place/fileFor example to copy the password file from your local machine (bennevis to a remote server called 'earth' you could use:
steve@bennevis:~$ scp /etc/passwd steve@earth: steve@earth's password:
passwd 100% |*****************************| 918 00:00As no destination directory was specified the file will be transferred to your home directory upon the remote machine.
If you wish to transfer a lot of files you can copy a directory recurisvely, with the -r flag.
When it comes to sending files to and from you Unix machine from a Windows desktop you can use the excellent open source program WinSCP which presents a drag and drop interface to remote file systems - allowing you to drag and drop files with ease.
With OpenSSh installed you have no reason to be running insecure systems such as FTP to copy files to and from your Unix servers.
================
Using scp to transfer files in Linux |
- To copy files from the local system to a remote system:
scp file... user@host.domain:path
where:
- file
- File to be copied.
- user
- Your username on the remote system.
- host.domain
- The Internet address of the remote system, such as linux.nmt.edu.
- path
- The absolute path name to the destination on the remote system.
- To copy files from a remote system to your local system:
scp user@host.domain:path ... dest
where dest is the path name on your local system where you want the files copied.
scp ann beth clyde forsythe@linux.nmt.edu:/u/forsythe/tmp scp 'forsythe@linux.nmt.edu:/u/forsythe/images/*.jpg' pictures/LaborDay
=================
scp - Linux command line tool to copy files over ssh
scp stands for secure cp (copy), which means that you can copy files across an ssh connection that will be encrypted, and therefore secured.You can this way copy files from or to a remote server, you can even copy files from one remote server to another remote server, without passing through your PC.
Usage
scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]
Description of options
- from-host
- Is the name or IP of the host where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command
- user
- Is the user which have the right to access the file and directory that is supposed to be copied in the cas of the from-host and the user who has the rights to write in the to-host
- source-file
- Is the file or files that are going to be copied to the destination host, it can be a directory but in that case you need to specify the -r option to copy the contents of the directory
- destination-file
- Is the name that the copied file is going to take in the to-host, if none is given all copied files are going to maintain its names
- -p
- Preserves the modification and access times, as well as the permissions of the source-file in the destination-file
- -q
- Do not display the progress bar
- -r
- Recursive, so it copies the contents of the source-file (directory in this case) recursively
- -v
- Displays debugging messages
scp *.txt user@remote.server.com:/home/user/
This will copy all files with .txt extension to the directory /home/user in the remote.server.com host
scp -r miguel@10.1.2.2:/home/miguel/ miguel@10.1.2.3:/home/miguel/
This is going to recursively copy all files from miguel's Home directory on 10.1.2.2 host to his Home directory in 10.1.2.3 host.Note
To use this command you need to have open-ssh installed in the hosts.
===========
In Unix, how do I use the scp command to securely transfer files between two computers?
In Unix, you can use thescp
command to copy files and directories securely between remote hosts without starting an FTP session or logging into the remote systems explicitly. The scp
command uses SSH to transfer data, so it requires a password or passphrase for authentication. Unlike rcp
or FTP, scp
encrypts both the file and any passwords exchanged so that anyone snooping on the network can't view them.Warning: Be careful when copying between hosts files that have the same names; you may accidently overwrite them.
The syntax for the
scp
command is:scp [options] [[user@]host1:]filename1 ... [[user@]host2:]filename2 For example, if user
dvader
is on a computer called empire.gov
, and wants to copy a file called file1.txt
to a directory called somedir
in his account on a computer called deathstar.com
, he would enter:scp file1.txt dvader@deathstar.com:somedir Likewise, if he wanted to copy the entire contents of the
somedir
directory on deathstar.com
back to his empire.gov
account, he would enter:scp -r dvader@deathstar.com:somedir somedir Similarly, if he is working on another computer, but wanted to copy a file called
file1.txt
from his home directory on empire.gov
to a directory called somedir
in his account on deathstar.com
, he would enter:scp dvader@empire.gov:file1.txt dvader@deathstar.com:somedir When using wildcards (e.g.,
*
and ?
) to copy multiple files from a remote system, be sure to enclose the filenames in quotes. This is because the Unix shell, not the scp
command, expands unquoted wildcards.For more information about
scp
, consult its man page. At the Unix prompt, enter:man scp
===========
Thanks to:
http://www.kb.iu.edu/data/agye.html
http://www.go2linux.org/scp-linux-command-line-copy-files-over-ssh
http://www.debian-administration.org/articles/27
http://infohost.nmt.edu/tcc/help/xfer/scp.html