Quantcast
Channel: User Kamil Maciorowski - Super User
Viewing all articles
Browse latest Browse all 837

Answer by Kamil Maciorowski for How to specify password in ssh command

$
0
0

Use sshpass, one of two forms:

sshpass -ffilename ssh user@ip   # prefer thissshpass -pPa5sw0rd ssh user@ip   #  avoid this

where your password is in the first line of the file filename or it is literally Pa5sw0rd. Notes:

  • In the manual there is no space after -p or -f, but at least sshpass 1.06 in my Debian 10 allows it; your sshpass may or may not.
  • If your password contains characters your shell will interpret (like $, ' or ;) then you should quote it properly in the command line (but not in the file).
  • Avoid -p, prefer -f. Use chmod 600 filename to make the file private (root will still be able to access it though). Read about security considerations in the manual.

Viewing all articles
Browse latest Browse all 837

Trending Articles