Added general users and wheel group users to centos

Source: Internet
Author: User
Centos adds 2009-12-1612: 56 [1] system logon and exit samplelogin: root & larr; to log on to the system as the root user and enter the username rootPassword: & larr; enter the root password set during installation here, and the password will not be displayed when you enter [added general users in centos and logon and logout of the system for users in the wheel group [1]
Sample login: root users use the root user to log on to the system and enter the root user name.
Password: KeyStore enter the root Password set during installation.

[Root @ sample ~] # Successfully logged on as the root user. the prompt is "#". If a user logs on successfully, the prompt is "$"

[Root @ sample ~] # Exit logging out of the system



[2] General User creation and deletion
[Root @ sample ~] # Useradd centospub general user who creates a centospub user
[Root @ sample ~] # Passwd centospub secret set a password for your centospub
Changing password for user centospub.
New UNIX password: login enter the password (the password will not be displayed)
Retype new UNIX password: login enter the password again to confirm the two passwords are consistent
Passwd: all authentication tokens updated successfully. login password set successfully

[Root @ sample ~] # Userdel-r centospub users delete



[3] using a common user to log on as a root user

Because the root user has full operation permissions on the system, in order to avoid some mistakes, we recommend that you log on to the system as a general user. if necessary, you need root operation permissions, then, run the "su-" command to log on as the root user.
Centospub @ sample ~] The $ login prompt is "$", indicating that the current status is normal user centospub login in the system

[Centospub @ sample ~] $ Su-login: enter the command used to log on as the root user.
Password: login enter the root Password (the Password will not be displayed), press enter

[Root @ sample ~] # Login successful login as root user, prompt changed to "#"

[Root @ sample ~] # Exit logging back to normal user logon status

[Centospub @ sample ~] The $ login prompt is changed to "$" and returns to the status of the general user centospub logging on to the system.



[4] creating common users in the administrator Group

Generally, you can log on as the root user to configure the system as administrator by executing the "su-" command and entering the correct root password. However, in order to further enhance the security of the system, it is necessary to establish an administrator group that only allows users in this group to execute the "su-" command to log on as the root user, users in other groups cannot log on as root even if they execute "su-" and enter the correct root password. In UNIX, the group name is usually "wheel ".


Root @ sample ~] # Usermod-G wheel centospub worker add the general user centospub to the administrator Group's wheel Group

[Root @ sample ~] # Vi/etc/pam. d/su Hei open this configuration file

# Auth required pam_wheel.so use_uid locate this line and remove "#" from the beginning of the line
Bytes
Auth required pam_wheel.so use_uid then changed to this state (approximately at the location of 6th rows)

[Root @ sample ~] # Echo "SU_WHEEL_ONLY yes">/etc/login. defs statement: add the statement to the end of the row.



After completing the preceding operations, you can create a new user. then, you can use the new user to test the user. if the user is not added to the wheel Group, run the "su-" command, even if you enter the correct root password, you cannot log on as the root user.
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.