在Debian系统中,可通过以下方式实现远程控制,需根据需求选择合适方法并注意安全配置:
适用场景:命令行操作、服务器管理
sudo apt update && sudo apt install openssh-server
sudo systemctl start ssh && sudo systemctl enable ssh
/etc/ssh/sshd_config
,设置Port 2222
(避免默认端口)。PermitRootLogin no
,启用公钥认证PubkeyAuthentication yes
。ssh-keygen -t rsa -b 4096 # 本地生成密钥
ssh-copy-id user@远程IP # 复制公钥到远程服务器
ssh user@远程IP -p 端口(默认22)
适用场景:图形界面操作
sudo apt install tightvncserver
vncserver # 首次启动需设置密码
~/.vnc/xstartup
,设置分辨率和桌面环境(如exec startxfce4
)。/etc/systemd/system/vncserver@:1.service
并启用。远程IP:1
(端口5901对应显示号1)及密码。适用场景:Windows用户远程访问Linux图形界面
sudo apt install xrdp
sudo systemctl start xrdp && sudo systemctl enable xrdp
sudo ufw allow 3389/tcp
远程IP:3389
,使用系统用户名密码登录。根据需求选择对应方法,命令行操作推荐SSH,图形界面可选择VNC或xrdp。