Deleting users in linux

I couldn't be bothered to spin up a VM for a Uni assignment and ended up adding a bunch of users and groups to my personal OS. Below is a record of what I did as cleanup. The things I did were; - create 4 users - create 3 groups - create some stuff in /srv (this is trivial to clean up) I'm wondering if I may have missed anything with these steps. I'm not entirely familiar with user/group related stuff so I might have residual files laying around.
root@pop-os:/# userdel -rf stark
userdel: stark mail spool (/var/mail/stark) not found
root@pop-os:/# userdel -rf lannister
userdel: lannister mail spool (/var/mail/lannister) not found
root@pop-os:/# userdel -rf kit
userdel: kit mail spool (/var/mail/kit) not found
root@pop-os:/# userdel -rf nicky
userdel: nicky mail spool (/var/mail/nicky) not found
root@pop-os:/# su stark
su: user stark does not exist or the user entry does not contain all
the required fields
root@pop-os:/# su lannister
su: user lannister does not exist or the user entry does not contain
all the required fields
root@pop-os:/# su kit
su: user kit does not exist or the user entry does not contain all
the required fields
root@pop-os:/# su nicky
su: user nicky does not exist or the user entry does not contain all
the required fields
root@pop-os:/# groupdel acme-manager
root@pop-os:/# groupdel acme-employee
root@pop-os:/# groupdel acme-all
root@pop-os:/# getent group | grep -i "acme-manager"
root@pop-os:/# getent group | grep -i "acme-employee"
root@pop-os:/# getent group | grep -i "acme-all"
root@pop-os:/# userdel -rf stark
userdel: stark mail spool (/var/mail/stark) not found
root@pop-os:/# userdel -rf lannister
userdel: lannister mail spool (/var/mail/lannister) not found
root@pop-os:/# userdel -rf kit
userdel: kit mail spool (/var/mail/kit) not found
root@pop-os:/# userdel -rf nicky
userdel: nicky mail spool (/var/mail/nicky) not found
root@pop-os:/# su stark
su: user stark does not exist or the user entry does not contain all
the required fields
root@pop-os:/# su lannister
su: user lannister does not exist or the user entry does not contain
all the required fields
root@pop-os:/# su kit
su: user kit does not exist or the user entry does not contain all
the required fields
root@pop-os:/# su nicky
su: user nicky does not exist or the user entry does not contain all
the required fields
root@pop-os:/# groupdel acme-manager
root@pop-os:/# groupdel acme-employee
root@pop-os:/# groupdel acme-all
root@pop-os:/# getent group | grep -i "acme-manager"
root@pop-os:/# getent group | grep -i "acme-employee"
root@pop-os:/# getent group | grep -i "acme-all"
7 Replies
Jochem
Jochem•2y ago
this isn't an exhaustive list, but check that there's nothing left in /home for those users, and check /etc/groups for any auto-created user groups if you installed samba, you might have an smbpasswd entry, though I'm not sure where that's stored other than that, I check /etc/default/useradd, there might other settings also just don't worry about it too much, if there's a dangling user file here or there that won't hurt your system at all
WillsterJohnson
WillsterJohnsonOP•2y ago
looking through /etc/groups doesn't reveal anything that looks odd, though there's a lot of stuff in there. Home dirs only shows my stuff
$ ll /home
total 4.0K
drwxr-xr-x 102 will will 4.0K Jun 7 15:10 will/
$ ll /home
total 4.0K
drwxr-xr-x 102 will will 4.0K Jun 7 15:10 will/
the useradd file only contains comments and SHELL=/bin/sh I know it won't hurt if something's left over, and tbh it doesn't matter as I'm (hopefully) getting a new laptop soon, but I wanna clean up at least most of it just to know that I'm not gonna run into anything in time. From the additional checks you mentioned, looks like everything's reverted
Jochem
Jochem•2y ago
luckily users on linux are pretty simple, really not much more than a few files and an entry or three in /etc
WillsterJohnson
WillsterJohnsonOP•2y ago
yeah, simple... It definitely didin't take me three hours to get the users & groups set up along with some file permissions stuff... such a headache, the way I use linux either I can do something, or I can sudo do something, and it just works. managing user permissions? I'll stick to JavaScript I think 😂
Jochem
Jochem•2y ago
Wait until you add selinux or setfacl 😄 Mostly meant there's not much to what's created in disk, though
WillsterJohnson
WillsterJohnsonOP•2y ago
nope I'm good, this assignment was the only thing on the entire course that's even remotely sysadmin and I'm very content with that I don't think it was related to this but I had to completely reinstall today due to a boot error 🎉
Jochem
Jochem•2y ago
oof x_x yeah, I can't imagine that being related to messing with users
Want results from more Discord servers?
Add your server