Managing remote files through ssh

Other topics

Mounting remote directory through ssh

You can mount remote directory through ssh by using sshfs. Sshfs does not come as a default on Ubuntu, so you need to install it first by using sudo apt-get install sshfs. You can then mount the remote directory to your local machine like this

sshfs [email protected]:/remotedir /localdir

Note that the localdir needs to be present before trying to mount the remotedir. In case that the localdir is not empty, sshfs will complain and abort. You can force it to mount in the non empty dir by using nonempty option like this

sshfs -o nonempty [email protected]:/remotedir /localdir

Once you umount the localdir, local files will become visible again.

Moving files between servers through ssh

One way to move files between servers is by using the scp command. Secure copy command utilizes ssh to transfer data. The simples example for copying a file from local to remote server is

scp /localdir/localfile [email protected]:/remotedir/remotefile

Similarily, to copy file from a remote to local server would be

scp [email protected]:/remotedir/remotefile /localdir/localfile 

Contributors

Topic Id: 9693

Example Ids: 29906,29907

This site is not affiliated with any of the contributors.