[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Suspending Sites & Users



At 5/7/01 06:50 AM +0100, you wrote:
Did you say you HAD found a shell too that enabled you to suspend users (individually only) ? If so you could easily gain a list via shell of all users for a particular site (see example below), and pipe them through this script! You could even write a little script that requires a site number to be entered, and let it collect the list of users and pipe each through the suspend prog. Thats all assuming you found a shell suspend program ! :) (I havn't gone looking yet!)

Heres a one-liner that will list all users under a site number: (replace site6 with whatever site has been naughty :) - keep the trailing space after the site number tho) ls -Al /var/spool/mail/* | grep "site6 " | awk {'print $9'} | sed 's~.*/~~'

I forget exactly (and can't get to my server until tonight), but check the man pages for useradd, usermod, and passwd. One of them (passwd, methinks) has a simple -l parameter that will suspend a user by safely modifying /etc/passwd or /etc/shadow (whichever is applicable, hopefully the latter) and adding a '*' before the password. Then you can rerun the command with a -u to unlock.

Write your script to find the list of users in a site (/etc/group, maybe?), and then -l them. Done.

Now, since their password and account are disabled, they can't FTP or POP. Disabling sendmail from receiving mail shouldn't be required, but procmail for forwarding is still a problem. Fine: add to your script a simple command that goes through the users' directories and looks for .forward files, then moves them to .noforward.

Your little script can then easily undo all your changes.


--
Rodolfo J. Paiz
rpaiz@xxxxxxxxxxxxxx