1 つのコマンドですべての SSH 接続を終了し、PuTTY を閉じます。

1 つのコマンドですべての SSH 接続を終了し、PuTTY を閉じます。

すべてのSSH接続を終了して閉じる方法はありますか?パテ「ワンショット」ですか?私はWindows 7で作業しており、PuTTYを使用してSSHを介してさまざまなLinuxホストに接続しています。

私が働く方法の例:

SSH to host1 with PuTTY...
banjer@host1:~> #...doin some work...ooh! need to go check something on host8...
banjer@host1:~> ssh host8
banjer@host8:~> #...doin some work...OK time for lunch. lets close putty...
banjer@host8:~> exit
banjer@host1:~> exit
Putty closes.

上記に基づいて、Host8でPuTTYを一度に終了する方法はありますか?時にはホストの数が5〜10人に達することがあります。 XをクリックしてPuTTYウィンドウを閉じることができることを知っていますが、SSH接続が正しく閉じられていることを確認するために終了コマンドを使用したいと思います。私も怠惰を増やす方法についてのアドバイスを探していることに気づきました。私は「どうすれば生産性を高めることができますか?」と書きたいと思います。

ベストアンサー1

ssh接続終了エスケープシーケンスを試してください。

sshセッションで~.(波形点)を入力します。入力した文字は表示されませんが、セッションはすぐに終了します。

$ ~.
$ Connection to me.myhost.com closed.  

~からman 1 ssh

The supported escapes (assuming the default ‘~’) are:
 ~.      Disconnect.
 ~^Z     Background ssh.
 ~#      List forwarded connections.
 ~&      Background ssh at logout when waiting for forwarded 
         connection / X11 sessions to terminate.
 ~?      Display a list of escape characters.
 ~B      Send a BREAK to the remote system (only useful for SSH protocol
         version 2 and if the peer supports it).
 ~C      Open command line.  Currently this allows the addition of port 
         forwardings using the -L, -R and -D options (see above). It also
         allows the cancellation of existing remote port-forwardings using 
         -KR[bind_address:]port.  !command allows the user to execute a 
         local command if the PermitLocalCommand option is enabled in
         ssh_config(5).  Basic help is available, using the -h option.
 ~R      Request rekeying of the connection (only useful for SSH protocol 
         version 2 and if the peer supports it).

おすすめ記事