Welcome to Server Circle. It's a friendly site and all levels of experience are welcome. Be aware that we use cookies for your login.
Server Circle - Ask questions about Servers and get answers from experts.
Beta (0.78 sec)
Deleting multiple accounts off a few servers

We have closed a department at work and I need to remove around thirty user accounts of a few servers.

Can you do this automatically (and safely) ?

Thanks.
Asked by:
Squeeze
754 points
 Report Abuse
 Share Page - Category: CentOS Linux - Tags: Deleting multiple accounts off a few servers
 Enter your response
Please use Pastie.org to paste lengthy code or to fix formatting issues with code
  • Responses in reverse (2)

Best Answer

You can cut just field one of /etc/passwd

cut -f1 -d: /etc/passwd > /tmp/$$

while read userid

do

userdel -r $userid

done < /tmp/$$

Response by:
jalal
3623 points
you can find in passwd file

you must find group id and lock user you can # that line or change /bin/bash to /sbin/nologinif is many you can do it with SED command

Response by:
mohamad_kian
1548 points


  • Related Questions
About Us : Contact Us : Etiquette : Terms : CDN Failover : ShorterURL : CDN Fallback : © 2013 Server Circle