1

I've just installed Ubuntu on my PC, and so far the only user is the one set up through the install process (called master).

I'm trying to add a standard user account, but it's not letting me. Every time I enter my desired username, a no-entry symbol appears next to it and I'm told that -

A user with the username 'dgard' already exists

However, this cannot be the case, because as previously mentioned there is only one user called master on this PC.

I've tried sudo userdel -r dgard, although I didn't expect this to do anything due to not having set a user up. Indeed, I was presented with the below message, and an inspection of the file confirmed no entry for 'dgard' -

userdel: cannot remove entry 'dgard' from /etc/passwd

Can anyone please suggest why I may be encountering this problem?


Information from comments:

getent passwd dgard retunrs David Gard:/home/likewise-open/DD/dgard:/bin/bash. I am using Likewise to connect to a Windows domain, but it seems odd that this would prevent me from having a local user with the same username as a domain user?

5
  • 1
    Check existing users on your system with awk -F":" '{ print "username: " $1 "\t\tuid:" $3 }' /etc/passwd Oct 2, 2013 at 12:02
  • Do you have any kind of distributed authentication set up? What is the output of getent passwd dgard? Oct 2, 2013 at 12:03
  • @BrunoPereira - thanks, but that just lists the same usernames as when I veiw the /etc/passwd file, and 'dgard' is not included.
    – David Gard
    Oct 2, 2013 at 13:26
  • @steeldriver - getent passwd dgard retunrs David Gard:/home/likewise-open/DD/dgard:/bin/bash. I am using Likewise to connect to a Windows domain, but it seems odd that this would prevent me from having a local user with the same username as a domain user? Thanks.
    – David Gard
    Oct 2, 2013 at 13:30
  • I'm not familiar with Likewise so I don't know whether that's a feature or a bug - it may depend on your pam settings but that's beyond my level of expertise Oct 2, 2013 at 13:44

1 Answer 1

1

This is the expected behavior. You can't have two users with the same name, doesn't matter if they come from different user databases.

From useradd manpage:

You may not add a user to a NIS or LDAP group. This must be performed on the corresponding server.

Similarly, if the username already exists in an external user database such as NIS or LDAP, useradd will deny the user account creation request.

2
  • Thanks for the explanation, but it seems an odd way of going about things (for a mostly non-Linux user). What would happen if I reversed the actions for example? Say I created the user dgard locally first, and then added the machine to a domain using Likewise? It just seems inconsistent, as I doubt it would prevent the machine from joining the domain? Thanks.
    – David Gard
    Oct 7, 2013 at 11:22
  • @DavidGard Yes, this is possible. You could first create a local user and join the domain later, but you'll have problems when trying to use the duplicate user account (login, permission handling, etc). This will result in unpredictable behavior. There's an option in Samba that makes the domain name part of user names, like domain\username or domain+username, avoiding name conflicts, but this would force users to type the domain name before their usernames, which may be annoying. I don't know if Likewise has such an option. Oct 7, 2013 at 12:19

You must log in to answer this question.

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