You are not logged in.

#1 2025-07-23 20:32:22

TheFinnishOne
Member
Registered: 2025-07-18
Posts: 6

[SOLVED] How do I remove multiple accounts at the same time?

When trying to make guest sessions to work, I accidentally made multiple guest accounts that start with "guest-" and 6 random letters and numbers. They filled my available IDs, so I need to remove them. How do I remove all accounts starting with "guest-"? I tried "userdel guest-*" but it didn't work.

Last edited by TheFinnishOne (2025-07-23 21:08:16)

Offline

#2 2025-07-23 20:58:33

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,214

Re: [SOLVED] How do I remove multiple accounts at the same time?

Sanity check:

for GUEST in $(awk -F: '/guest-/{print $1}' /etc/passwd); do echo "userdel $GUEST"; done

Action:

for GUEST in $(awk -F: '/guest-/{print $1}' /etc/passwd); do userdel $GUEST; done

Offline

#3 2025-07-23 21:09:00

TheFinnishOne
Member
Registered: 2025-07-18
Posts: 6

Re: [SOLVED] How do I remove multiple accounts at the same time?

This worked, thanks! I need to start learning shell scripting more...

Offline

Board footer

Powered by FluxBB