0

I am trying to to login into a server and download files via SFTP non-interactively: where to place the password in the command line? Help please! my command is:

sftp -4rv -b - -o IPQoS=cs1 -o User=user_id -o ChallengeResponseAuthentication=yes -o BatchMode=yes -o KbdInteractiveAuthentication=no -o PasswordAuthentication=yes -o PreferredAuthentications=password -o NumberOfPasswordPrompts=3 @server.com:/ .

  • What have you tried? – music2myear Nov 23 '20 at 04:39
  • 1
    Does this answer your question? [How do I set up SSH so I don't have to type my password?](https://superuser.com/questions/8077/how-do-i-set-up-ssh-so-i-dont-have-to-type-my-password) – Martin Prikryl Nov 23 '20 at 07:37
  • I am trying to make this command work; According to the Man. Page it should:ftp [-C] [-N name] [-o output] [-s sourceaddr] ftp://[user:password@]host[:port]/file[/] ...Thank you – Marco Di Taormina Nov 25 '20 at 07:27
  • FTP and SFTP are two completely different protocols. If you use `ftp` like this, your connection won't be encrypted (if the server support FTP at all). – Martin Prikryl Nov 25 '20 at 07:34
  • Thank you Martin, That's why I was trying to use SFTP on the command line : – Marco Di Taormina Nov 25 '20 at 20:13
  • not working for me the command line; As I have multiple computers: I am trying : 1-:sftp [-C] [-N name] [-o output] [-s sourceaddr] ftp://[user:password@]host[:port]/file[/. and 2-sftp -4rv -b - -o IPQoS=cs1 -o User=user_id -o ChallengeResponseAuthentication=yes -o BatchMode=yes -o KbdInteractiveAuthentication=no -o PasswordAuthentication=yes -o PreferredAuthentications=password -o NumberOfPasswordPrompts=3 @server.com:/ . – Marco Di Taormina Nov 25 '20 at 20:15
  • OK, I didn't post the best link above. See this one: [Automatically enter SSH password with script](https://stackoverflow.com/q/12202587/850848). – Martin Prikryl Nov 25 '20 at 20:27

1 Answers1

-1

Use sshpass:

$ sshpass -p [pass] sftp user@host:
Greenonline
  • 2,235
  • 11
  • 24
  • 30