下面按最常见场景说明:在 Debian 服务器端如何配置,以便用 SecureCRT 远程连接(SSH)。
SecureCRT 本身是 Windows / macOS 上的客户端,Debian 是服务端。
sudo apt update
sudo apt install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh
sudo ss -tlnp | grep :22
或
sudo systemctl status ssh
不要直接用 root 登录:
sudo adduser yourname
sudo usermod -aG sudo yourname
ip a
通常是 192.168.x.x 或 10.x.x.x
连接后即可输入密码登录。
Tools → Create Public Key
mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
粘贴公钥内容,然后:
chmod 600 ~/.ssh/authorized_keys
Session → Properties → SSH2 → Authentication → 选 PublicKey
编辑配置文件:
sudo nano /etc/ssh/sshd_config
建议修改:
PermitRootLogin no
PasswordAuthentication no # 仅密钥登录
Port 2222 # 可改端口
修改后:
sudo systemctl restart ssh
⚠️ 改端口或禁密码前,确保密钥已可用
sudo apt install ufw
sudo ufw allow 22
sudo ufw enable
如果你说的是:
可以告诉我具体场景,我可以给你更针对性的配置。