$ sudo ufw allow ssh
$ sudo apt install ssh
$ ssh username_node11@192.168.0.11
$ exit
とします。
$ ssh username_head@xxx.xxx.xxx.xxx
これで外部のパソコンから管理ノードを操作できるようになったので、以後は手元のパソコンを使用して設定を行います
外部から管理ノードに接続する際にSSH鍵認証を使用します。手元のパソコンで作業します。
$ ssh-keygen
$ chmod 600 ~/.ssh/id_ed25519 $ chmod 700 ~/.ssh/
$ scp ~/.ssh/id_ed25519.pub username_head@xxx.xxx.xxx.xxx:/home/username_head/.ssh/authorized_keys
$ ssh username_head@xxx.xxx.xxx.xxx $ chmod 600 ~/.ssh/authorized_keys $ chmod 700 ~/.ssh/
セキュリティ上、管理ノードへのログインはSSH鍵認証のみが安全です。
$ sudo nano /etc/ssh/sshd_config
(略) # To disable tunneled clear text passwords, change to no here! PasswordAuthentication no PermitEmptyPasswords no (略)
$ sudo /etc/init.d/ssh restart
$ exit
手元のパソコンからヘッドノードにログインするには、次のようにします。 オプション-iで秘密鍵のパスを指定します。
$ ssh -i ~/.ssh/id_ed25519 username_head@xxx.xxx.xxx.xxx
#ヘッドノード Host head HostName xxx.xxx.xxx.xxx User username_head IdentityFile ~/.ssh/id_ed25519 #計算ノード Host node11 HostName 192.168.0.11 User username_node11 ProxyCommand ssh -W %h:%p head Host node12 HostName 192.168.0.12 User username_node12 ProxyCommand ssh -W %h:%p head #以下略
次のようにHostを指定するだけでサーバーにログインできます
$ ssh head # 管理ノードにつなぐ場合 $ ssh node11 # 計算ノード(node11)につなぐ場合
パソコンから管理ノードにログインできるようになったら、あとは遠隔で作業ができます。サーバー室から自分の部屋に戻りましょう。