-1

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.

1
  • Are these messages generated by the openvpn pacakge, or are you running things by hand?
    – cjc
    Nov 7, 2012 at 11:09

2 Answers 2

2

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
0

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.

2
  • 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, 2012 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, 2012 at 11:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .