(RHEL5) Not able to delete/add user : unable to lock group/password file
Hi,
Can anyone please guide me in the following situation : I am trying to delete a user and getting error : [B]userdel: unable to lock group file and while trying to add user, getting error : useradd: unable to lock password file Below is the exact commands and output i am getting : [root@hostname ~]#userdel -r <username> userdel: unable to lock group file [root@hostname ~]# useradd <username> useradd: unable to lock password file I googled for this, and found suggestions to remove /etc/passwd.lock, /etc/shadow.lock, /etc/gshadow.lock files, but i could not find any files by these names in my server. However i found /etc/shadow- , /etc/passwd-, /etc/gshadow- files. Please suggest. |
Can you try ls -al?
You might see .swp |
I tried but got the following :
ls -al /etc |grep passwd* -rw-r--r-- 1 root root 1935 Sep 16 14:17 passwd -rw-r--r-- 1 root root 1935 Sep 16 14:16 passwd- |
What account you use to run useradd command?
Is it normal user account? |
Possibly they've been set immutable; try
Code:
lsattr /etc/passwd http://linux.die.net/man/1/chattr |
thanks chrism01, but I haven't actually got u, that how it can resolve my issue. I checked the links, and found that I can list and change the attributes of a file with these commands.
|
Hi Myathu, i login with a normal user and then take sudo of root privileges, with which i am giving these commands.
|
In case, looks like your sudo config had issue. Why don't you try with another user account? If you are root administrator, try with root account.
So that we can make sure password files itself no issue. Later you need to review your sudoer config. |
I tried with root also. Below is the detailed commands and outputs.:
[user@hostname ~]$ su - Password: [user@hostname ~]# useradd -g admin bijayinee useradd: unable to lock password file [user@hostname ~]# userdel -r nishant userdel: unable to lock password file Earlier i logged in with a user who had sudo access, but this time i Logged in with user and did su and gave root password, but still the same result. |
In case, can you try chrism01 suggestion with lsattr command to see what is the output?
|
Below is the output for Chris1's suugestion :
[user@hostname ~]$ su - Password: [root@hostname ~]# lsattr /etc/passwd ------------- /etc/passwd [root@hostname ~]# lsattr /etc/group ------------- /etc/group [root@hostname ~]# lsattr /etc/shadow ------------- /etc/shadow [root@hostname ~]# |
(RHEL5) Not able to delete/add user : unable to lock group/password file
sorry.how abt mount output
|
[user@hostname ~]$ mount
/dev/sda1 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda9 on /home type ext3 (rw) /dev/sda7 on /opt type ext3 (rw) /dev/sda6 on /var type ext3 (rw) /dev/sda5 on /usr type ext3 (rw) /dev/sda3 on /tmp type ext3 (rw) /dev/sda2 on /orahome type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) |
Quote:
Look for ANY files in /etc with a .lock extension ("ls /etc/*.lock"). They *CAN* be passwd.lock...or pwck.lock...or pwd.lock. They can also be HIDDEN files, such as .passwd.lock, so be sure to look for those as well. And have you done a "ps -ef | grep passwd" on the system, to see if you have another user that has that command running in a terminal? If so, they may be 'locking' it manually. |
Quote:
Quote:
Quote:
These things should be very obvious to someone who has 'certifications'.... |
All times are GMT -5. The time now is 05:26 PM. |