Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

sshpassをつかうとsshのパスワードを入力せんでもよくなる

$ sshpass 
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
   -f filename   Take password to use from file
   -d number     Use number as file descriptor for getting password
   -p password   Provide password as argument (security unwise)
   -e            Password is passed as env-var "SSHPASS"
   With no parameters - password will be taken from stdin

   -P prompt     Which string should sshpass search for to detect a password prompt
   -v            Be verbose about what you're doing
   -h            Show help (this screen)
   -V            Print version information
At most one of -f, -d, -p or -e should be used

あとは……なんか妙なコマンドになりますが、こんな

$ sshpass -p YOURPASS ssh yourname@hostname.local

あるいは変数の設定と"-e"オプションをつかって

$ export SSHPASS=YOURPASS
$ sshpass -e ssh yourname@hostname.local

macOS with brewのとき

デフォだとパス

$ brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb