Posts Tagged ‘user’

Adding New Users in Batches

Friday, February 1st, 2008

If you want to be able to add several users at once, rather than having to enter each one individually, use the mass_useradd script. It’s a shell script, so it should run just about anywhere. You’ll also need mass_passwd. Store the two scripts in the same directory. You should also install the pwgen utility, for generating passwords. You’ll need a colon-delimited text list of logins and usernames in this format:

(more…)

Killing User Processes the Easy, Fun Way

Friday, February 1st, 2008

If you need to delete a user, but userdel reports that some of the user’s processes are running. You sure would like single command to find and stop all of the user’s processes, use the slay program:

# slay foober
slay: -KILL is kicking foober’s butt!
slay: Whoa, I have the power supreme.

slay finds and kills all the user’s processes at once, saving you the trouble of hunting them down and killing them yourself. slay has four modes: nice, normal, mean, and butthead. Mean mode kills any nonprivileged user who attempts to slay another user. Set your desired mode in /etc/slay_mode.

The traditional method of finding processes belonging to a user is to use ps, as in:

$ ps U 1007

or:

$ ps U foober
3936 ? S 0:00 xchat
3987 ? S 0:00 /usr/lib/galeon-bin
4209 ? S 0:00 kdeinit: kio_file file /tmp/ksocket-carla/klauncherkF21rc.slave-

You can then kill one by one:

# kill 3936
# kill 3987
# kill 4209