1754813 Members
3873 Online
108825 Solutions
New Discussion

new users script

 
SOLVED
Go to solution
matthew mills
Frequent Advisor

new users script

I am writing a script that will add 50 new users but I am using a secure system and when I go to modidy the password I get â password cannot be changed. Reason: Cannot access protected password entry.â I am simply adding the user to /etc/passwd. What else do I need to do? The script works great but how do I add the user to the protected password database? also, can I script in the password? This is part of the script:

CT=104
for i in for i in `ls *.prt`
do
NEWUSER="`echo ${i} |sed -e 's/..\.prt//'`"
echo "$NEWUSER:*:$CT:104:,,,:/ftp/ftproot/./$NEWUSER:/usr/bin/false" >> /etc/passwd
CT=`expr $CT + 1`
done
thanks in advance!

Ma
3 REPLIES 3
Patrick Wallek
Honored Contributor
Solution

Re: new users script

You really should be using the 'useradd' command to do this. All the users that you add must also be added to the /tcb/files/auth/ structure as well. I would not want to try to create each users entry in that structure manually.

# man useradd

for more information.
Umapathy S
Honored Contributor

Re: new users script

Matthew,
As Patrick pointed out, useradd is the right way to add new users. Create a wrapper script with useradd.
useradd -u -m .

man useradd for more details.
HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Steven Sim Kok Leong
Honored Contributor

Re: new users script

Hi,

I believe when you mention "secure system", you meant "trusted system". For trusted system, the protected password entry resides in /tcb/auth/files/...

Thus, any script that modifies /etc/passwd will need to modify the equivalent userid file in /tcb/auth/files/...

I do agree with the rest however that using robust system commands is cleanest.

Hope this helps. Regards.

Steven Sim Kok Leong