LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-22-2011, 05:07 AM   #1
Blackened Justice
Member
 
Registered: Jun 2011
Posts: 82

Rep: Reputation: Disabled
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
 
Old 09-22-2011, 06:50 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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 .
this one copies /path/to/remote/file from the server hostname to the current working directory on your machine. Most likely you have to put the IP address of the remote server in place of the hostname, unless you associate the IP with the hostname in the file /etc/hosts on your local machine.

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.
 
Old 09-22-2011, 12:22 PM   #3
Blackened Justice
Member
 
Registered: Jun 2011
Posts: 82

Original Poster
Rep: Reputation: Disabled
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.
 
Old 09-22-2011, 12:31 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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?
 
Old 09-23-2011, 03:56 AM   #5
Blackened Justice
Member
 
Registered: Jun 2011
Posts: 82

Original Poster
Rep: Reputation: Disabled
Ok, thank you for the tips

Just another thing, is there any way to mount a directory that is on a remote host locally?

Last edited by Blackened Justice; 09-23-2011 at 03:58 AM.
 
Old 09-23-2011, 04:14 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Yes, take a look at sshfs. I tried it and it worked flawlessly.
 
1 members found this post helpful.
Old 09-23-2011, 01:32 PM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by Blackened Justice View Post
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
dont use ftp because it is old, deprecated and insecure.

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.
 
Old 09-23-2011, 02:33 PM   #8
Blackened Justice
Member
 
Registered: Jun 2011
Posts: 82

Original Poster
Rep: Reputation: Disabled
Ok, thank you very much, sshfs solved my problem easily
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chroot SSH problem: ssh working, not SFTP & SCP. NaCo Linux - Security 3 02-01-2009 02:23 AM
allow ssh, scp and sftp? javier_ccs Linux - Newbie 6 09-12-2006 08:11 AM
SFTP with Chrooting and without SSH and SCP toraghun Linux - Security 1 07-10-2006 05:11 AM
SSH - where are scp and sftp satimis Linux - Networking 2 11-15-2003 10:27 AM
ssh working, but not sftp scp hardigunawan Linux - Networking 2 05-02-2003 02:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration