Questions about ssh, ftp, sftp, scp
Hey everyone,
At my University we have a Linux Cluster that I can access from home using ssh. My question is, how can I transfer files from the Cluster to my pc and vice-versa. The instructions on their site point to using scp, but someone else mentioned ftp or sftp. How do I use any of those? Cheers |
You can either use scp and sftp, not ftp. The scp command is similar to cp, but you have to provide the username and the hostname of the remote machine in the source or destination path. Suppose you want to copy a file from the remote server to your local machine at home:
Code:
scp user@hostname:/path/to/remote/file . Some useful options of the scp command are -r to recursively copy entire directories and -p to preserve the original timestamp and permission of the remote file. Please, see man scp for details. The sftp command is similar to ftp. You open a sftp session, then you use the sftp commands (put, get and so on). quit to close the session. Again, please see man sftp for details. Feel free to ask if you some specific problem. |
All of the above information assumes that I'm logged in my current machine and not in the remote machine, right? Is there a way to transfer if I'm logged into the remote machine? I'm going to read up on sftp, it may solve my doubts.
|
You can connect to a machine if it has a running ssh server. Most likely your machine at home has the port 22 (ssh port) closed and hasn't got a running sshd. If you trust the network you can try to open port 22, but I'd suggest to adopt some security measure to prevent undesired intrusions (disable password login, enable public-private key authentication, restrict the access to known IP addresses and so on). The question is: is it worth the risk and the additional work? Can't you simply transfer files when you are physically at home and not vice-versa?
|
Ok, thank you for the tips ;)
Just another thing, is there any way to mount a directory that is on a remote host locally? |
Yes, take a look at sshfs. I tried it and it worked flawlessly.
|
Quote:
scp is usually used for machines to transfer stuff automatedly (especially when using ssh-keys) sftp also runs over ssh but prompts the user for username, password, local-file, remote-file, ... consider installing sshfs. |
Ok, thank you very much, sshfs solved my problem easily ;)
|
All times are GMT -5. The time now is 10:33 AM. |