Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a way to remove users in bulk? Maybe by a range of user id numbers.
I help run a school server for our Linux class. I create temp accounts for tests and now I just want to delete them. I really should delete the old users too but the Professer likes to let them have access even after the class.
Maybe use some type of script to take input from you about who you want to useradd -m "username" into the system while taking that variable that was used for the input and redirecting it to another file >> users.txt That is to be read later when making a script to remove userdel -f < /location/users.txt
obviously ran as either sudo or root.
the quickest idea I can come up with...
Last edited by zer0signal; 01-18-2011 at 06:30 PM.
Maybe use some type of script to take input from you about who you want to useradd -m "username" into the system while taking that variable that was used for the input and redirecting it to another file >> users.txt That is to be read later when making a script to remove userdel -f < /location/users.txt
obviously ran as either sudo or root.
the quickest idea I can come up with...
Good idea i'm going to add a few accounts and try it.
Do you know if userdel -f xkcd* would work? Where xkcd* is a list of users whose username begins with xkcd.
I don't think you can use the wildcard like that. =(
But I am not a great scripter, where I would look is into into a loop function for userdel, that would just keep that script running till it reached the end of user.txt.
Last edited by zer0signal; 01-18-2011 at 06:55 PM.
Buliding the list not be a problem. I can just take the passwd file import it into excel and erase the info i don't need and save it as text. But thanks I keep forgetting how powerful Unix is.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.