2019年5月7日火曜日

ssh 中継

【AWS EC2中継】
$ vi  ~/.ssh/config    << __EOF__
host aws.step
  HostName xx.xx.xx.xx
  Port 22
  User ec2-user
  IdentityFile ~/.ssh/step.pem

Host aws.utlsv
  HostName xx.xx.xx.xx
  Port 22
  User ec2-user
  ProxyCommand ssh aws.step -W %h:%p
  IdentityFile ~/.ssh/utlsv.pem
__EOF__

接続したいホストと中継サーバ間にトンネル生成
$ ssh www.gateway.com -R 10022:192.168.1.100:22
※autosshコマンドでを使えば、切断時も自動再接続してくれる。

遠隔から
$ ssh www.gateway.com
$ ssh localhost -p 10022

tmux仮想端末でマルチ画面

cntl+b c   ウィンドウ作成
cntl+b 1-n ウィンドウ指定
cntl+b p   ウィンドウ切り替え



0 件のコメント:

コメントを投稿

シャットダウン時の後処理 (shutdown)

# vi /etc/systemd/system/drop.service [Unit] Description= stop httpgwd DefaultDependencies=no Before=shutdown.target RefuseManualStart=true ...