-1

To transmit a file, sftp syntax is:

get /A/B/abc.txt /C/D/ 

In contrast, scp syntax for the same task is:

/A/B/abc.txt  username@servername:/C/D/E/ 

Why don't we need username@servername in case of sftp?

5
  • How did you start the sftp shell in the first place?
    – muru
    Nov 15, 2017 at 3:54
  • sftp username@servername, to connect to the server
    – Anony
    Nov 15, 2017 at 3:58
  • So you have already mentioned it, haven't you?
    – muru
    Nov 15, 2017 at 4:04
  • In scp too, I use ssh user@server to connect initially. So how it differ?
    – Anony
    Nov 15, 2017 at 4:07
  • 1
    I don't know why you do that. I just do scp user@server ... without having to run ssh.
    – muru
    Nov 15, 2017 at 4:07

1 Answer 1

2

Because when that sftp get command is used, you are already connected to the server. It would not be necessarily to tell it its own name again.

2
  • Agree.But in scp too, I connected using ssh username@servername. So what makes the difference?
    – Anony
    Nov 15, 2017 at 4:01
  • 1
    It sounds like you logged into a shell on the other server using ssh and initiated the scp from there. You do not need to first ssh into a server in order to run scp. You can run scp from the local host and just ensure the local and remote arguments are the correct way around. Nov 15, 2017 at 4:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .