Tencent Cloud Ubuntu Host Set Root User Login

The user assigned to the Ubuntu host obtained on Tencent Cloud is the ubuntu user, not the root user, while the user assigned to the Ubuntu host obtained on Alibaba Cloud is the root user. If you don’t have the root user permission to do things, it will become troublesome. Every time you do something, you need to sudo. Here’s how to set up the root user’s ssh login :

1. Set the root password, which can be changed to be the same as that of the ubuntu user, which is easy to remember. First use the ubuntu user ssh to log in to Tencent Cloud, and then execute the command

sudo passwd root

Then enter the root password, the screen will not appear asterisks like Windows, just press the Enter key after entering the password, you need to enter the password twice


Set the root password
2. Modify the configuration of ssh login, that is, the /etc/ssh/sshd_config file, modify it to allow root login, and execute the command

sudo vim /etc/ssh/sshd_config

Modify the configuration of ssh login

Press the insert key to enter the insert mode, change the prohibit-password behind PermitRootLogin to yes, then press the Esc key, then press the : key (English colon key), w key and q key in sequence, and finally press the Enter key, The modification was saved successfully.

3. Restart the ssh service to make the modification of the ssh configuration just take effect, execute the command

sudo service ssh restart

Last test change account

Replacement command:

ssh root@localhost

When encountering yes/no after typing, type yes

Guess you like

Origin blog.csdn.net/GL666/article/details/129540320