原因:虚拟机安装Debian 11后,与原桌面切换使用时的键鼠很烦。
目标:Debian安装openssh-server,原系统安装Xshell,并配置实现root远程登录。
记录下并供大家参考!
#检查
apt search openssh-server
如果安装会显示
openssh-server/now 1:8.4p1-5+deb11u1 amd64 [installed,local]
secure shell (SSH) server, for secure access from remote machine
如果显示一堆的关联库包,表示没有安装
#安装
apt install openssh-server
个人习惯不加“-y”,看一下都装了什么
#配置
cd /etc/ssh
cp sshd_config sshd_config.bak
vi sshd_config
改配置文件前给原装的做个备份
重点参数
Port 22
PermitRootLogin yes
PasswordAuthentication yes
其它保持默认就好,如果对安全性有要求,可以参考一下配置参数详解,或者配置一下密钥,这里够用就不多详述。
#开启服务,远程连接
#开启
systemctl start sshd.service
#查看
systemctl status sshd.service
然后客户端连就行了
注:
我第一次连不上,看了一下配置参数,啥都没改,重启一下服务就行了,我去!
systemctl restart sshd.service