Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Warning: Cannot modify header information - headers already sent by (o

Status
Not open for further replies.

bobbiedigital

Programmer
Sep 18, 2004
83
AU
Hi i have installed a copy of mandrake 10.1 on a server, i have created a adduser.sh which is as such

#!/bin/sh

username=$1
password=$2
group=$3
mkdir /home/$username
mkdir /home/$username/public_html
cp .htaccess /home/$username/public_html/.htaccess
/usr/sbin/useradd -g $group \-d /home/$username -s /bin/bash $username

chmod 7755 /home/$username
chmod 7755 /home/$username/*

chown -R $username:$group /home/$username/*

echo $username:$password | /usr/sbin/chpasswd
exit


we has this working when using a user under the admin group,
then it kept changing the permissions to user:root, group:root, and it stopped from working giving us this error
useradd:unable to lock password file

any help would be greatly appreciated.

thankkyou bobbie
 
Check to see if you have a hanging passwd or chpasswd processes -- this should fix things.

If useradd doesn't work, giving permission to a user that doesn't exsist isn't possible, so it defalts to giving it to the administrators... When in doubt remove the lock file for passwd and shaddow files... and try again.

[plug=shameless]
[/plug]
 
Thanks for the reply, i think i have fixed it, using sudo, do you know any issues with using sudo??
cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top