In centos, the general user is promoted to the root permission.

Source: Internet
Author: User
Tags centos


Here I have a new general user named 361way, which can be promoted to root as follows:


Method 1: modify the/etc/sudoers file, find the following line, and remove the comment (#).

# Allows people in group wheel to run all commands
% Wheel ALL = (ALL) ALL

Then modify the user and make it belong to the root group (wheel). The command is as follows:

# Usermod-g root 361way

After the modification is completed, you can log on with the 361way account and run the su-command to obtain the root permission for the operation.

Method 2: modify the/etc/sudoers file, find the following line, and add a line under root, as shown below:

# Allow root to run any commands anywhere
Root ALL = (ALL) ALL
361way ALL = (ALL) ALL

Method 3: modify the/etc/passwd file, find the following line, and change the user ID to 0, as shown below:

361way: x: 500: 500: 361way:/home/361way:/bin/bash

After modification

361way: x: 0: 500: 361way:/home/361way:/bin/bash

Save. After logging on to the 361way account, you can directly obtain the permissions of the root account.

In addition, the S-bit permission and system vulnerabilities (such as udevd service vulnerabilities, crontab core dump, and automatic overflow...) can also be exploited ......) And rootkit to root.

Method 4: After a common user logs on to Linux, how can this user become a root user?
 
The procedure is as follows:
 
Sudo gedit/etc/passwd
 
Find the section describing the user and change its id to 0. Save and log out of the user. Log on to the user again. The user is already the root user.
 
User.
 
For example:
 
Find the following line in passwd
Lulipeng: x: 1000: 1000:,:/home/lulipeng:/bin/bash
 
Change the positions of both 1000 to 0.
 
Note:
 
Some strange problems may occur after the id is modified. The method for canceling a cancellation is as follows:
 
1. Terminal input
 
Sudo restart lightdm
 
2. Find the logout option in the upper-right corner of the desktop.
 
3. Directly press the power button.

After the modification is completed, you can log on with the 361way account and run the su-command to obtain the root permission for the operation.

Supplement: the general user switches to the root user.

1. open the terminal and prompt "$", indicating that the user is a common user. In this case, directly enter su, press enter, enter the root password, and press enter to switch to the root user, at this time, the prompt is changed to "#".
Note that the terminal is not displayed when you enter the password, and each time you switch to the root user, this process is required.
2. Switch back to a common user. You only need to enter the "su user name.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.