1

I ran

sudo userdel <username>

but I received the following error

userdel: cannot remove entry '<username>' from /etc/passwd

I check the /etc/passwd file and I indeed cannot find an entry for the username - I CTRL+F'd through to check.

Help would be really appreciated, already used to the search bar and no satisfactory answers turned up.

Cheers!

EDIT:

I believe I know what may be the issue. The user I am trying to delete does not authenticate locally, but on a network as the login is the same as my university login details which is why it is not locally storing details in /etc/passwd - The question is now how can I delete this sort of user that is authenticating over a network - Could someone help me with that?

EDIT2: Upon request below is the contents of /etc/nsswitch.conf

passwd:         files
group:          files
shadow:         files
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns
networks:       files

protocols:      db files
services:       db files sss
ethers:         db files
rpc:            db files

netgroup:       nis
sudoers:        sss
  • You've replaced the username with "<username>"? If you're doing that for privacy reasons please give a similar example of the username. – jdwolf Nov 17 '17 at 17:40
  • say i created a user called user1 - sudo userdel user1 - and I received in return "userdel: cannot remove entry user1 from /etc/passwd" – wrahman Nov 17 '17 at 17:41
  • Can you repeat that behavior? like if you useradd user2 then userdel user2? – jdwolf Nov 17 '17 at 17:47
  • Yep, I can confirm it works fine if I add a new user I can then delete the new user fine. It might be worth stating that this computer already came with a user (university provided), I created a new user and am now trying to remove the old user. I have full root and admin privileges on both accounts – wrahman Nov 17 '17 at 17:49
  • 1
    Have you tried using the userdel command with the -r switch? Also, have you tried using deluser to remove the user account? – Terrance Nov 17 '17 at 17:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.