Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I tried to install an OpenVPN access server in Centos 6 on a linode VPS.

The installation is okay for my ubuntu 11.10 distro in another VPS. The installation error occours when adding the user "openvpn" in Centos.

The error message is

"useradd: canot open /etc/passwd"

The detail of My "/etc/passwd" file:

"-rw-r--r-- 1 root root 1194 Oct  9 00:33 /etc/passwd"

I am not quite familiar with Centos, so how can I add the user "openvpn" in order to setup the VPN service?

Thanks.

share|improve this question
    
Are these messages generated by the openvpn pacakge, or are you running things by hand? –  cjc Nov 7 '12 at 11:09

2 Answers 2

up vote 2 down vote accepted

I have found out solution for this.

The attributes of "/etc/passwd" and "/etc/shadow" are set hiden in Centos.

Change the attributes of the two files by the following two commands:

chattr -ai /etc/passwd
chattr -ai /etc/shadow

Then I can add user by typing:

useradd -s /sbin/nologin openvpn
share|improve this answer

If you are only adding one user account I would user adduser not useradd. Adduser has a friendlier interface. Ontop of that, make sure you can access /etc/passwd, do cat /etc/passwd and make sure you can actually see that file and its not user permissions.

share|improve this answer
    
cat /etc/passwd does very little to verify that you can write to the file, especially given that the permissions as stated by the OP are 644. –  cjc Nov 7 '12 at 11:16
    
I am in root, and "cat /etc/passwd" is Okay, and using adduser "adduser -s /sbin/nologin "opevpn"", stiil the same error message:"adduser: cannot open /etc/passwd ". –  zfz Nov 7 '12 at 11:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.