A while ago, I found that my Tencent Cloud server root login was always unable to connect. Even changing the password in the background many times did not work. I could only log in with Ubuntu every time, which was very inconvenient.
Just modify the configuration file on the server.
First log in with a normal account
sudo vi /etc/ssh/sshd_config
#取消这两行代码的注释
Port 22
#改成yes
PermitRootLogin yes
After modification, press esc
, enter :wq
, save and exit.
#重启一下ssh服务
sudo systemctl restart sshd
At this time, you can log in to the server with the root account!