ssh key†
ssh-keygen -t rsa -b 4096
cd .ssh
mv -f id_rsa.pub authorized_keys
chmod 600 authorized_keys
id_rsa は private key なので local に保存した後に消す
ssh key ecdsa†
ssh-keygen -t ecdsa -b 521
ただしこれで作った鍵は古いssh や mac では使えないかも
portforward†
teraterm†
setup -> SSH Forwarding -> add
Forward local port | 8080 | |
to remote machine | localhost | 8080 |
save config
あるいは、TERATERM-INI に
DefaultForwarding=L8080:localhost:8080
コマンドライン†
ssh -N -L 1999:127.0.0.1:8080 【user】@【リモートホスト】 -i .ssh/id_rsa
sshd 設定†
キーなしのログインを禁止する
# emacs /etc/ssh/sshd_config
PasswordAuthentication no
Port 【設定したいport】
Protocol 2
PermitRootLogin no