Tencent Cloud Ubuntu 18.04 open root login

The default user of Tencent Cloud Ubuntu 18.04 is ubuntu, while other default users such as CentOS Debian are root.

The following is how to enable root login on Ubuntu 18.04:

//Login as user ubuntu

sudo -i
vim /etc/ssh/sshd_config

//Move the cursor to the PermitRootLogin line, click the i key to switch to editable,//If you do not need to use a password to log in to root (recommended), only use the key to log in, then remove#Can//After modification, click the esc key to exit the editable state, enter:wq Enter, save and exit//Many online tutorials are the above steps, but after the modification, you will find that you cannot log in with the key. The key is the following step

cat /home/ubuntu/.ssh/authorized_keys >>/root/.ssh/authorized_keys

//will/home/Copy the ubuntu user's credentials to the ubuntu directory/root/.ssh/authorized_keys, everything is normal at this time//Finished, just these three commands
  1. PermitRootLogin default value prohibit-password is to prohibit password login (but you can log in with a key). If you need a password to log in, change to yes

  2. I first checked vim ~/.ssh/authorized_keys and saw that there was content. I thought there was content in /root/.ssh/authorized_keys. In fact, the ~ symbol represents the /home/ubuntu directory, which is the user of the current user ubuntu. table of Contents

  3. I got the correct answer after reading this: https://github.com/lmk123/blog/issues/64

After logging in to the host again, you can delete the ubuntu user:

deluser ubuntu --remove-home

Recommended Posts

Tencent Cloud Ubuntu 18.04 open root login
Tencent Cloud ubuntu system changed to root login
Tencent Cloud Ubuntu mounts new cloud disk
Tencent Cloud ubuntu 16.04 ZenTao integrated environment construction
How to open root account in Ubuntu20.04
ubuntu cycle login
Note record | Ubuntu16.04 set default root user login
Aliyun Ubuntu online migration to Tencent cloud cvm
Configure Wolfram Engine on Tencent Cloud ubuntu server
Ubuntu ssh-keygen remote login
Experience Ubuntu system CVM with free Tencent Cloud server
About Tencent Cloud ubuntu server Tomcat access slow problem
ubuntu open designated port
Ubuntu configure SecureCRT login
Open SSH service under Ubuntu
ubuntu7.10 installed to 3D open
Tencent Cloud Centos install jdk8
Tencent Cloud Centos install nginx
Open SSH service under Ubuntu
Ubuntu 16.04 cannot switch root permissions
ubuntu root default password (initial password)
Tencent Cloud CentOS7 install LNMP+wordpress