Ubuntu24.04开启ssh服务及允许root登录
安装ssh服务器端
Ubuntu默认没有安装ssh的server,需要安装
apt-get install openssh-server
ssh客户端是默认安装的,连接其它ssh服务器用的,使用以下命令安装
apt install openssh-client
修改配置文件
允许远程使用root账号ssh连接本机 修改/etc/ssh/sshd_config文件
vim /etc/ssh/sshd_config
修改如下:允许root账户登录
#PermitRootLogin prohibit-password
PermitRootLogin yes
重启系统或者sshd服务
sudo /etc/init.d/ssh stop
sudo /etc/init.d/ssh start
sudo service ssh restart
安装ssh服务后,系统默认开启系统sshd,查看sshd状态如果不是默认启动,修改服务为enable
sudo systemctl enable ssh