I ssh -ed into my webhost's directory, and tar -ed the webapp to download. When I try to mv to ~/mydirectory/backups or /home/mydirectory/backups , it defines the "home" as my root on the webhost that I'm ssh'ed into.

Is there any way to install mmv from an ssh machine to a local drive without being installed at the web host's system?

Best Answer


Ssh is a way to remotely login to another computer The shell command line you get when you ssh is pretty much the same as if you opened xterm in the remote machine If there is no such way to transfer files

The fact that the remote computer accepts ssh connections gives you some options to exchange files

Use scp To copy from your local computer to the remote, type, in the local computer:

scp /tmp/file user@example.com:/home/name/dir

(where /tmp/file can be replaced with any local file and /home/name/dir with any remote directory)

To copy from the remote computer to the local one, type, in the local computer.

scp user@example.com:/home/name/dir/file /tmp

Use sshfs This is a little more advanced but much, much nicer (when the internet connection of both computers is good. If not, stick to scp)

You can link a directory from the remote computer to the empty directory on the local computer Say you "link" the /some/remote/dir from the remote computer to /home/youruser/remotecomp in your computer. If there is a file /some/remote/dir/file in the remote computer, you can see it on /home/youruser/remotecomp/file. You can copy and mv as usual, and you can even alter remote files and dirs.

Note however, that when the connection ends, /home/youruser/remotecomp becomes an empty dir again, and you only keep in the local computer the files you copied to other directories

You have to achieve this

1) install sshfs.

sudo apt-get install sshfs

2) create a empty dir

mkdir /home/youruser/remotecomp

3) "link" the two directories (the right term is mount)

sshfs user@server.com:/some/remote/dir /home/youruser/remotecomp

4) Enjoy

5) "unlink" the dirs

fusermount -u /home/youruser/remotecomp

If the local computer runs windows You can find versions of scp for windows. See, e.g, winscp