I'm wondering if I can make the assumption that I can get a file using scp on any server that I could get the file using sftp.
4 Answers
Mostly, yes. Both sftp and scp are file transfer protocols over ssh, and sftp is a more recent feature than scp, so while there are a few older setups with scp but no sftp, the converse would take some deliberate configuration.
However, it is possible for a server to allow sftp but not scp. One reason I can think of to configure a server this way is if you want to allow a single service over ssh, for simplicity's sake: sftp and scp provide the same level of access security-wise, but sftp is more convenient, so sftp is the preferable choice.
In other words, if the server can sftp, it can scp; but it might allow sftp and forbid scp.
Servers that have OpenSSH (which includes most *nix servers) run SFTP as a separate subsystem under it. It is feasible to disable just the SFTP subsystem, leaving only SSH and SCP available. See the sshd_config(5)
man page for details.
No, you can't assume that.
scp
depends on SSH
being available, which is not linked to SFTP
being available.
~~edit: more details~~
ssh
lets you do more than just copy files. It will allow you to run commands. So it is very easy to imagine a server that would allow you to sftp, but would not allow you to ssh.
-
-
1more or less, yes, SFTP is just a more recent implementation of SCP, but SFTP is not run over SSH, it is a completely different protocol.– MaQleodDec 3, 2010 at 22:57
-
1
-
@Gilles just because SFTP (as a technology) is based on ssh, doesn't I can ssh onto any server I can SFTP to. Plenty of our clients use SFTP to transfer files to us, but none of them could ssh to the same server. Dec 4, 2010 at 0:58