Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ssh 経由でシェル スクリプトを使用してリモート コンピューターにログインしたい、テキスト ファイルからユーザー名とパスワードを渡したい。どうやってするか?
これが私が試したコードです。
#!/bin/sh # username=user ip=192.168.2.21 ssh $username@$ip < user.txt
参照しているメソッドで SSH を使用することはできません。あなたがやっていることを助けるために作成された SSH キーを使用したいと思うでしょう。
また、パスワードをテキスト ファイルに保存しないでください。