Solve the problem that users and groups cannot be added in linux (the groupadd command is unavailable)

Source: Internet
Author: User
To solve the problem that users and groups cannot be added in linux (the groupadd command is unavailable), you need to install mysql on a linux server. when installing mysql, an error message is displayed: www.2cto.com [root @ localhostsoftwarwaretools] # rpm-ivhMySQL-server -... to solve the problem that users and groups cannot be added in linux (the groupadd command is unavailable), you need to install mysql on a linux server. when installing mysql, an error message is displayed: www.2cto.com [root @ localhost softwaretools] # rpm-ivh MySQL-server-5.5.23-1.rhel5.x86_64.rpmPreparing... ######################################## ### [100%] 1: mySQL-server ########## ################################# [100%] chown: "mysql: mysql": invalid user chown: "mysql: mysql": invalid user because mysql needs to create a mysql group and a mysql User during installation, as a result, you can manually create a group and a user, and then reinstall mysql. Result: run the command [root @ localhost softwarwaretools] # groupadd mysqlgroupadd: The group file cannot be opened (groupadd: unable to open group file). This is strange. Currently, the root user is used, why are you not authorized to create a group or user. Next, there will be a bunch of Baidu, Google, and various blog forums. Come up with a conclusion: www.2cto.com 1, add users need to use the passwd and shadow Files 2, add groups need to use the shadow and gshadow files at this time the first feeling, may be a File permission problem, use the ls-l command to find that the permission is normal. It was strange, so I needed to find Duniang and Gu Ge again. Finally, I found the problem and found two commands (lsattr and chattr), because the permission was hidden: the following is a simple description of these two commands: [html] can append and hide permission settings for files with special requirements (such as server logs. These hidden permissions include: Append only (a), compressed (c), no dump (d), immutable (I), data journalling (j), secure deletion (s ), no tail-merging (t), undeletable (u), no atime updates (A), synchronous directory updates (D), synchronous updates (S ), and top of directory hierarchy (T ). the lsattr command is used to view hidden permission settings, while the chattr command is used to change hidden permissions. First, use lsattr to view these files: [java] [root @ localhost ~] # Lsattr/etc/passwd -------------/etc/passwd [root @ localhost ~] # Lsattr/etc/group ---- I --------/etc/group [root @ localhost ~] # Lsattr/etc/shadow -------------/etc/shadow [root @ localhost ~] # Lsattr/etc/gshadow ---- I --------/etc/gshadow: you can see the hidden permission set for the object. I: sets that the object cannot be deleted, renamed, or set the link relationship, you cannot write or add new content. The I parameter is very helpful for security settings of the file system. In this case, you only need to remove the I permission. Run the chattr command to modify the file hiding permission. run the following command: chattr-I/etc/gshadowchattr-I/etc/group and then manually add a user for testing, the result can be executed normally. Finally, I uninstalled mysql thoroughly and reinstalled it. everything went well.
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.