SSH

sshd 设置

macOS 或 Linux: /etc/ssh/sshd_config, Windows: C:\ProgramData\ssh\sshd_config

关键参数:PubkeyAuthentication, AuthorizedKeysFile, PasswordAuthentication.

Windows 配置提醒:无法用秘钥连接 Windows 的 SSH,你大概少了这步操作

秘钥

秘钥位置:~/.ssh
将本机 id_rsa.pub 公钥添加到服务器 known_hosts:

ssh-copy-id username@server_ip

参数

端口转发: -L remote_port:localhost:local_port

  • 仅端口转发不进入命令行: -N