Obtain Root permission when remote Ubuntu system

In daily use of Cloud Server, we often encounter that the server cannot obtain root privileges, especially the Ubuntu system. At the beginning of the system, you will be asked to use a custom name, similar to windows10, let you create one yourself An account is not a reason to use an Administrator account, but it is often useless to create an account by yourself. Especially when developers are developing projects, they often lead to insufficient permissions and unable to edit. Then I will solve this problem for everyone Right!

In fact, this problem is relatively simple. The main reason is that SSH improves the protection of the system to avoid unauthorized access. As long as you find the SSH configuration file and modify some, you can use the Root account to operate by default. Okay, not much nonsense ,start to act.

Under normal circumstances, do you first log in to the ubuntu system with the account you created, and then use the su root command to switch to root? In fact, it doesn't have to be so troublesome, just follow my method.

Reset Cloud Server Root Password##

If you are the first to use it, please specify a password for the root account for easy access:

sudo passwd root
root@VM-0-3-ubuntu:/# sudo passwd root
Enter newUNIX password: 
Retype newUNIX password: 
passwd: password updated successfully
root@VM-0-3-ubuntu:/# 

Modify SSH configuration##

sudo vi /etc/ssh/sshd_config

Find the item PermitRootLogin and change it to yes

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

Save and restart the ssh service:

sudo service ssh restart

Conclusion##

Okay, now you can directly use the root account to operate your own projects and see if you succeeded. If you have any questions, please leave a message in the comment area below, thank you!

Link to this article: https://www.debuginn.cn/2284.html

This article is licensed under the [CC BY-NC-SA 3.0 Unported] (https://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh) agreement, please keep the link to this article for reprinting

Recommended Posts

Obtain Root permission when remote Ubuntu system
Enable root user remote login on ubuntu system
Ubuntu system installation
Tencent Cloud ubuntu system changed to root login
Modify the default root password of the Ubuntu operating system
Ubuntu ssh-keygen remote login
ubuntu remote connection 22 port
Remote connection to Ubuntu 19.1
Ubuntu dual system installation
Explain the solution to the freeze when ubuntu dual system starts