SSH接続を記憶して便利
By Patineboot
- 1 minutes read
- 283 words
SSHで簡単にログイン
LANにたくさんデバイスを接続したい。サーバーでファイルサービスを提供している。ラズパイとサーバーをコマンド実行しているときにふと、ユーザー名を入力するのが、ちと手間かな。
~/.ssh/config
を使ってみる。
2回目以降のパスワード入力を省略して便利に
controlmaster auto
controlpersist 30
controlpath ~/.ssh/ControlMaster-%r-%h.%p
ファイルサーバとラズパイの設定
Host <FileServer>
HostName <FileServer>.local
User <UserId>
Port 22
TCPKeepAlive yes
IdentitiesOnly no
Host raspberrypi
HostName raspberrypi.local
User pi
Port 22
TCPKeepAlive yes
IdentitiesOnly no
これで、ssh <FileServer>
とか、ssh raspberrypi
でユーザ名の入力なしにログインできる。うーん便利。
ふたつターミナル起動して、ふたつめはパスワード入力は省略されるよ。