What should I do if the ROOT permissions are insufficient when creating a new user under CentOS 7?

coldplay.xixi
Release: 2020-07-29 10:04:14
Original
5327 people have browsed it

The solution to the problem of insufficient ROOT permissions when creating a new user under CentOS 7: first modify the [/etc/sudoers] file and use tom to log in; then use the s[udo su -] or [sudo] command and enter tom Password; finally use exit to exit the root user mode.

What should I do if the ROOT permissions are insufficient when creating a new user under CentOS 7?

Solution to the problem of insufficient ROOT permissions when creating a new user under CentOS 7:

Step 1: Add user

Command:

#adduser tom    <!--此处以用户tom为例-->
Copy after login

Step 2: Change password

Command:

#passwd tom
Copy after login

Enter according to the prompts Enter the password twice to complete the password setting.

Step 3: Set user permissions

Method 1: Modify the /etc/sudoers file (recommended method)

Command:

    #visudo    <!--找到下面一行,并在其后新增一行,如下所示:-->
    ## Allow root to run any commands anywhere
    root    ALL=(ALL)     ALL
    tom    ALL=(ALL)     ALL    <!--新增行-->
Copy after login

Save and exit, use tom to log in, then use sudo su - or sudo command, enter tom's password, you can obtain root permissions to execute the command; use exit to exit the root user mode.

Method 2: Add the user to the root group

Command:

    #usermod -g root tom
Copy after login

Use su - to obtain root permissions; use exit to exit root user mode.

Method 3: Modify the /etc/passwd file, find the following line, change the user ID to 0

    tom:x:1000:1000::/home/tom:/bin/bash
Copy after login

Change to:

    tom:x:0:0::/home/tom:/bin/bash
Copy after login

Related tutorial recommendations: centos tutorial

The above is the detailed content of What should I do if the ROOT permissions are insufficient when creating a new user under CentOS 7?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!