连接到CentOS 7.9时SSH错误权限被拒绝
我尝试使用以下命令在端口22上使用Root用户连接到Linux centOS服务器:连接到CentOS 7.9时SSH错误权限被拒绝,ssh,centos,centos7,Ssh,Centos,Centos7,我尝试使用以下命令在端口22上使用Root用户连接到Linux centOS服务器: ssh -p 22 root@ip chmod 700 /root/.ssh chmod 600 /root/.ssh/authorized_keys 但连接返回此错误: root@ip: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). 我该怎么办?首先,您必须使用以下命令更改服务器计算机上的权限: ssh -p 22 root@ip
ssh -p 22 root@ip
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
但连接返回此错误:
root@ip: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
我该怎么办?首先,您必须使用以下命令更改服务器计算机上的权限:
ssh -p 22 root@ip
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
然后在/etc/ssh/sshd_配置中编辑以下内容:
sudo sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
运行:
并运行:
systemctl enable sshd.service
然后运行:
systemctl start sshd.service
之后:
systemctl status sshd.service
并检查输出。如果一切顺利,从现在开始每次启动时都应该有ssh服务。首先,您必须使用以下命令更改服务器计算机上的权限:
ssh -p 22 root@ip
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
然后在/etc/ssh/sshd_配置中编辑以下内容:
sudo sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
运行:
并运行:
systemctl enable sshd.service
然后运行:
systemctl start sshd.service
之后:
systemctl status sshd.service
并检查输出。如果一切顺利,从现在开始,每次启动时都应该有ssh服务