SCP allows you to transfer files over ssh between computers
Copying to remote machines
To copy a file to a remote machine run the following
scp ~/file/to/be/transfered username@hostname:~/destinationfolder
If you want to copy a directory you would use -r which would look like this
scp -r /folder/to/be/transfered username@hostname:/path/to/destination
and if you want to specify a SSH port use -P which would look like this
scp -P port-here /file/to/be/transfered username@hostname:/path/to/destination
Grabbing from remote machines
To grab a file from a remote machine you would run the following
scp username@hostname:~/path/to/file/you/want /path/where/you/want/to/save/the/file
If you wanted a folder you would use -r which would look like this
scp -r username@hostname:~/path/to/folder/you/want /path/where/you/want/to/save/the/folder
and if you wanted to specify a SSH port use -P which would look like this
scp -P port-here username@hostname:~/path/to/file/you/want /path/to/destination
Mounting folders over SSH
Using SSHFS we can mount folders over ssh. To get started you'll need to installl sshfs
apt-get install sshfs
Create a dir to mount the files too and give your user ownership over it
mkdir /media/sshmount chown username /media/sshmount
Then add your user to fuse group
adduser username fuse
You should be then able to mount using the following command
sshfs username@hostname:/path/to/folder/you/want/to/mount /media/sshmount
For Windows Users
If your on windows and you want to send or grab files over ssh you can using pscp
To send a file you would run the following
pscp C:\file\to\be\transfered username@hostname:/path/to/destination
To grab a file you would run the following
pscp username@hostname:~/path/to/file/you/want C:\path\where\you\want\the\file\saved
When using pscp the -r switch will work for folders and -P will also work for port


Sat, Aug 15, 2009
Linux, Windows