Copy file over SSH
How to copy files through the secure shell (SSH).
Using scp
command¶
scp
works similar to the regular copy (cp
) command.1
scp [options] username1@source_host:directory1/filename1 username2@destination_host:directory2/filename2
Using tar, pipe, and ssh commands¶
tar cvf - $localdir | ssh someone@somemachine '(cd destdir && tar xBf -)'
Using rsync
command¶
rsync -avh /source/folder/ username@nasip:dest/folder/
Secure FTP (SFTP)¶
Filezilla and WinSCP can access remote servers via the Secure FTP (SFTP) protocol.
Mount remote directory as a disk via sshfs¶
libfuse/sshfs mounts a remote machine's directory as a local disk.
sshfs [user@]hostname:[directory] mount-point
To unmount the directory after file operations are done:
fusermount -u mount-point