Hi Richard
I can solve the problem only admin need use this command :"sudo ud" and
then everything will be OK.
Thank you very much for your guidance .
-by
-Sophia

Richard Higson wrote:

On Tue, Jan 20, 2004 at 01:10:19PM +0330, Alikhani wrote:


Date: Tue, 20 Jan 2004 13:10:19 +0330
From: Alikhani <[EMAIL PROTECTED]>
Subject: Re: sudo
To: [EMAIL PROTECTED]

I write a script that contains:
#!/bin/bash
echo "Enter username: "
read username
/usr/sbin/useradd -d /home/$username -m $username
/usr/bin/quotatool -u $username -bq 10M -l 10M /var/spool/mail
/usr/bin/quotatool -u $username -bq 1-M -l 10M /home
-------------------------------------------------------
but when admin as a user run this script the system says:
useradd: unable to lock password file
-----------------------------------------------------------
what changing is need for solving this problem?


The script is a Good Idea [tm]
However you might want to consider:
#  The script should read input
#     check it (username lowercase, length, alpha or alphanum,
#     nothing politically or otherwise incorrect)
#  then
 /usr/bin/sudo /usr/sbin/useradd -d /home/$luser -m $luser
 /usr/bin/sudo /usr/bin/quotatool \
                  -u $luser -bq 10M -l 10M /var/spool/mail
# and so on

In other words, your script can run as admin,
doing all the parsing, sanity-checking, whatever
as a normal user, and only go to `/usr/bin/sudo $something`
when you know that $something is OK and reasonable.

Richard
--
Vegetarians eat vegetables. That's OK.
It's the Humanitarians I'm worried about.
Have a nice day ;-) Richard Higson mailto:[EMAIL PROTECTED]






______________________________________ Inflex - installed on mailserver for domain @itrc.ac.ir Queries to: admin@

Reply via email to