Use scp
-command, it runs on top of SSH. Example:
scp username@remote.host:/path/to/file localfile
It also works another way round
scp localfile username@host:/path/remotefile
Username, path, and filename can be omitted (but not the :
!).
As Iain said, SFTP works also, but I tend to favor scp
for its cp
-like usage.
You can use a FUSE application to mount remote files to the local filesystem. Then you can work on the files directly. When you change them, they will be changed on the remote end automatically.
First make sure you have the fuse
kernel module loaded or built-in.
Then you can use either sshfs, which is a standalone application:
sshfs user@hostname: mountpoint # to mount to mountpoint
fusermount -u mountpoint # to unmount
Alternatively, you can use GVFS. If your're in a desktop, just type this into the file manager (or use gvfs-mount
in command line):
sftp://user@hostname/
And the filesystem will be mounted to
$HOME/.gvfs/sftp for user on hostname
If however you're not in a desktop, you'll have to start a D-Bus session before you can use gvfs-mount
:
$ dbus-launch
No protocol specified
DBUS_SESSION_BUS_ADDRESS=XXXXXX
DBUS_SESSION_BUS_PID=YYYY
$ export DBUS_SESSION_BUS_ADDRESS=XXXXXX # copy value from above
You can automate the above by a shell script which you source (!).
Best Answer
Check this tutorial, it's very well explained
scp command line to securely copy files over ssh, between Linux, Mac or Windows
Examples: