Cygwin で sshpass を使用すると、ssh はまだパスワードの入力を求められます。

Cygwin で sshpass を使用すると、ssh はまだパスワードの入力を求められます。

これによるとRedHat SSHパスワード自動化ガイド私はフォローしています例4:GPGまず、そのガイドの手順に従って、pass_file私のパスワードを使用してパスワードを作成しました。それからこれを得ました。

gpg -d -q myappserver23.sshpasswd.gpg > pass_file && sshpass -fpass_file ssh [email protected]

-fpass_fileオプションとベースの間にスペースはありません。sshpass マニュアルページ 上記のコマンドを実行すると、パスワードの入力を求められ、正しく入力してから、まったく使用されていないかのsshpassようにサーバーのパスワードを入力するように求められます。簡単に言えば、これはうまくいきますしかし、まだパスワードプロンプトが表示されます...

私は確かにオプションを知っており、これら2つを-q追加しました。-vvvSSHパスそしてSSHこれと関連があるようです。シェンそしていいえSSHパス私は信じています。 SSHバナーメッセージの後に受信したデバッグメッセージをここで共有します。

(...)
debug3: input_userauth_banner
----------------------------------------------------------------------------------------
Here goes ssh banner message
----------------------------------------------------------------------------------------

debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\myuser/.ssh/id_rsa RSA SHA256:7PAz6lsENYkfYGwFZWNf0OJ88Z9mFDMSBc+P9t+4H1k
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: C:\\Users\\myuser/.ssh/id_dsa
debug3: no such identity: C:\\Users\\myuser/.ssh/id_dsa: No such file or directory
debug1: Trying private key: C:\\Users\\myuser/.ssh/id_ecdsa
debug3: no such identity: C:\\Users\\myuser/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: C:\\Users\\myuser/.ssh/id_ed25519
debug3: no such identity: C:\\Users\\myuser/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: C:\\Users\\myuser/.ssh/id_xmss
debug3: no such identity: C:\\Users\\myuser/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
[email protected]'s password:

この出力の最後の行はパスワードプロンプトです。明らかにここにパスワードを入力するとリモートサーバーにログインできますが、それを使用するのはなぜですかsshpass?パスワードを入力せずにログインできるようにしたいです。

秘密鍵の使用を提案しないでください。トピックを理解しますが、実際のシナリオには適用されません。どんな助けでも大変感謝します。

ベストアンサー1

@KamilMaciorowskiのコメントは私に正しい方向を示しました。ServerFaultへの有用な答えによるとWindows自分のものを取るSSHを開く実装する。この問題を解決するには、以下opensshをインストールする必要があります。シビン代わりにこれを使用するには。

これでエラーが解決され、次のようになります。

$ gpg -d -q myappserver23.sshpasswd.gpg > pass_file && sshpass -fpass_file ssh [email protected] > test.txt

$ cat test.txt
/home/myuser
uid=1001(myuser) gid=1001(mygroup) groups=1001(mygroup)

PD。ここで使用するのと同じくらい安全ではありませんgpg。しかし、疑わしい場合は、この試み

おすすめ記事