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

Re: Scripting question



On Tue, Jan 09, 2001 at 10:08:05AM +1100, Nathan Ridge wrote:
> I am trying to write a script for a couple of novice admins that changes
> shell to bash from false, logs in, runs elm from where they can purge
> certain emails from a users mailbox and then exit to change the shell back
> to false. So far I have:
> 
> #!/bin/bash
> USR=$1
> usermod -s /bin/bash $USR
> su - $USR
> elm
> usermod -s /bin/false $USR
> 
> but when the su - changes accounts the script stops, any help appreciated.

As pointed out already, you need su - $USR -c "elm"

Also, instead of mucking about with the shell, you can use 'passwd -l username'
to lock the account (if that is the ultimate goal) and then passwd -u username
to unlock it.

Tim

-- 
   >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
   >> Tim Sailer (at home)             ><  Coastal Internet, Inc.          <<
   >> Network and Systems Operations   ><  PO Box 671                      <<
   >> http://www.buoy.com              ><  Ridge, NY 11961                 <<
   >> tps@unslept.com/tps@buoy.com     ><  (631) 476-3031                  <<
   >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<



Reply to: