Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

As the subject says, I'm trying to add a new user. When I run the command, it says the user already exists. But looking in /etc/passwd, /etc/group, and /etc/shadow shows that the user does not exist.

Running the command on my local machine works just fine. I'm running Ubuntu 11.10 on both.

Here's my terminal commands and output:

root@ws-prod-www-01:~# useradd -s /sbin/nologin -m -d /var/www/html/atc -g 33 -u 10141 atc
useradd: user 'atc' already exists
root@ws-prod-www-01:~# grep atc /etc/passwd
speech-dispatcher:x:111:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/sh
root@ws-prod-www-01:~# grep atc /etc/shadow
speech-dispatcher:!:15259:0:99999:7:::
root@ws-prod-www-01:~# grep atc /etc/group
root@ws-prod-www-01:~# 

I also tried:

root@ws-prod-www-01:~# adduser --shell /sbin/nologin --home /var/www/html/atc --gid 33 --uid 10141 atc
Warning: The home dir /var/www/html/atc you specified already exists.
adduser: The user `atc' already exists.
root@ws-prod-www-01:~# 

Any thoughts?

share|improve this question
3  
Is the uid in use already? –  Zoke Feb 16 '12 at 19:33
    
IIRC adduser is preferred over useradd on Debian/Ubuntu. –  0xC0000022L Feb 16 '12 at 23:03
add comment

2 Answers

up vote 2 down vote accepted

Try typing the following in a terminal

sudo userdel -r atc

This should remove all instances of the user

share|improve this answer
    
Right, never selected an answer for this question. If I remember correctly, I did have a different atc user, and deleting it fixed the problem. So I'm picking this as my answer. –  David R. Nov 2 '12 at 22:06
add comment

Is there any reason you are specifying the uid rather than letting the system choose one for you? You can see if your chosen id is in use by doing grep '10141' /etc/passwd. If that is the case then the error message is certainly a bit misleading :/

It's also quite possible that your system recognises users who are not in /etc/passwd - for example by using LDAP. One quick way to test that is to do id atc and see if the system recognises it. Another way would be getent passwd atc which will also show you users the system recognises who are not in /etc/passwd. Or you could again check if the uid is in use with getent passwd 10141. (You can also run getent passwd to get the full list of entries.) More about getent.

To see where these users might come from you could look at /etc/nsswitch.conf (man page) - the line starting passwd will show you where your system is looking for users. Common default values are files and compat, though more complex setups may have multiple values including values such as ldap, dns and winbind. files means the standard files including /etc/passwd.

I'm not so clear on the exact meaning of compat, but my reading of the nsswitch.conf man page suggests it is a combination of files and nis. nis is the Network Information Service which is largely superceded these days but may affect your system.

share|improve this answer
2  
I did grep the etc files for the UID. As for why I'm using it... I'm mounting files from NFS that are owned by that UID. So it's simpler to just add the users with their existing UIDs than to go chown all the files to the new UID. I do use LDAP authentication, but I know for a fact that there is no atc user in LDAP. goes to try the id and getent commans –  David R. Feb 16 '12 at 23:06
1  
Hmm... And it does exist somewhere. Now, to figure out if it's safe to delete. root@ws-prod-www-01:~# id atc uid=199999999(atc) gid=20(dialout) groups=20(dialout) root@ws-prod-www-01:~# getent passwd atc atc:x:199999999:20:atc:/Users/atc:/bin/tcsh –  David R. Feb 16 '12 at 23:10
add comment

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.