Quantcast
Image

Search Results for: copy-file

How to copy file remotely via SSH

By  •  May 28, 2023

SSH comes with 2 applications for remote file transfer, namely scp and sftp. You can also use SSH to secure your rsync session.

The easiest of these are scp. The command is quite similar to cp in copying local files except that you’ll have to specify the remote user and host in your command. For example,

scp myfile.txt [email protected]:/remote/folder/

will copy myfile.txt from your local folder to /remote/folder in 192.168.1.10. remoteuser need to exist and have write permission to /remote/folder/ in the remote system.

sftp in the other hand works almost exactly like ftp but with secure connection. Most of the commands are similar and can be used interchangeably. The following sftp example will work exactly as ftp would.

$ sftp [email protected]
Connected to 192.168.1.10.
sftp> dir
file1      file2  file3   
sftp> pwd
Remote working directory: /home/user
sftp> get file2
Fetching /home/user/file2 to file2
/home/user/file2                                                   100% 3740KB 747.9KB/s   00:05    
sftp> bye
$ 

You can also use ssh to secure your rsync session. To do this, use –rsh=ssh or -e “ssh” with your normal rsync commands. The following 2 commands will work exactly the same;

rsync -av --delete --rsh=ssh /path/to/source [email protected]:/remote/folder/
rsync -av --delete -e "ssh" /path/to/source [email protected]:/remote/folder/

How to SSH without password

By  •  December 2, 2021

We usually login to a remote SSH server using password authentication method. Username and password combination is the most common authentication method for SSH and is a suitable method …
Read More

How to mount remote filesystem using SSH

By  •  December 2, 2021

You can access remote filesystem as a local filesystem by mounting the remote filesystem using sshfs. This is similar to other remote filesystem implementations such as SAMBA/CIFS or NFS. …
Read More

Top