Debian Stream 8远程管理方法
SSH是Debian Stream 8默认支持的加密远程管理协议,提供安全的命令行访问,是最常用的远程管理方式。
openssh-server,命令如下:sudo apt update && sudo apt install openssh-serversudo systemctl start ssh(启动服务)sudo systemctl enable ssh(设置开机自启)ufw防火墙,允许SSH连接(默认端口22):sudo ufw allow ssh 或指定端口(如2222):sudo ufw allow 2222/tcp/etc/ssh/sshd_config文件(备份原文件:sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak),优化安全性:
Port 2222PermitRootLogin noAllowUsers your_usernamesudo systemctl restart sshssh localhost;远程连接(从另一台设备):ssh -p 2222 your_username@server_ip(替换为实际端口和用户名)。若需要图形界面操作,可选择以下工具(需安装桌面环境,如GNOME、XFCE):
sudo apt install tightvncservervncserver :1(:1表示显示端口5901,可通过5901+显示号访问)192.168.1.100:1)。sudo apt install xrdpsudo systemctl enable xrdp && sudo systemctl start xrdpmstsc)输入服务器IP即可。ssh-keygen -t ed25519),将公钥上传至服务器(ssh-copy-id -p 2222 your_username@server_ip),禁用密码登录(PasswordAuthentication no),防止密码泄露。/etc/ssh/sshd_config中的PermitRootLogin no,避免root账户被暴力破解。/etc/ssh/sshd_config中添加AllowUsers your_username,仅允许指定用户远程登录。