Why the Linux system cannot add user accounts for analysis

Source: Internet
Author: User

Production environment configuration:

Operating system: CentOS 6.6

1. The problem arises:

"SERADD:CANNOTOPEN/ETC/PASSWD" appears when you add an account using the Useradd command

[[Email protected] ~] #useradd-D/home/wwwroot/ftupuser-g ftp-s/sbin/nologin Ftpuser

useradd:cannotopen/etc/passwd

2. reasons for the resulting:

a) After adding the "I" hidden property, the file cannot be changed.

[[Email protected] ~] #chattr +i/etc/passwd

[[Email protected] ~] #chattr +i/etc/shadow

[[Email protected] ~] #chattr +i/etc/group

[[Email protected] ~] #chattr +i/etc/gshadow

b) The last time you use SSH to telnet to the "change" to half is a power outage, restart, or some programs also need to access the properties of a particular file.

3. problem Solving:

[email protected] ~] #chattr-I/etc/passwd

[[Email protected] ~] #chattr-I/etc/shadow

[[Email protected] ~] #chattr-I/etc/group

[[Email protected] ~] #chattr-I/etc/gshadow

through the above approach, there is no problem solved. the "lsattr" command to further review the related properties, found that there is a "chattr +a" permission attribute is not removed, so the right to operate.

[[Email protected] ~] #lsattr/etc/passwd

-----a-------e-/etc/passwd

[[Email protected] ~] #lsattr/etc/passwd

-----a-------e-/etc/passwd

[[Email protected] ~] #lsattr/etc/shadow

-----a-------E-/etc/shadow

[[Email protected] ~] #lsattr/etc/group

-----a-------E-/etc/group

[[Email protected] ~] #lsattr/etc/gshadow

-----a-------E-/etc/gshadow

[[Email protected] ~] #chattr-a/etc/passwd

[[Email protected] ~] #chattr-a/etc/shadow

[[Email protected] ~] #chattr-a/etc/group

[[Email protected] ~] #chattr-a/etc/gshadow

[[Email protected] ~] #lsattr/etc/passwd

-------------E-/ETC/PASSWD

[[Email protected] ~] #lsattr/etc/shadow

-------------E-/etc/shadow

[[Email protected] ~] #lsattr/etc/group

-------------E-/etc/group

[[Email protected] ~] #lsattr/etc/gshadow

-------------E-/etc/gshadow

[[Email protected] ~] #useradd-P/home/wwwroot/ftpuser-g ftp-s/sbin/nologin Ftpuser

[[Email protected] ~] #useradd-P/home/wwwroot/ftpuser-g ftp-s/sbin/nologin Ftpuser

Useradd:user ' Ftpuser ' already exists

solve the problem by doing the above.


This article is from the "linux~dba~mba~edu" blog, make sure to keep this source http://sky9896.blog.51cto.com/2330653/1698416

Why the Linux system cannot add user accounts for analysis

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.