- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: need useradd scripts
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2006 10:28 AM
08-14-2006 10:28 AM
I need a script to create 3 hundreds of new user accounts and their home directories at /oralog/
Best Regards,
Jan Shu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2006 10:35 AM
08-14-2006 10:35 AM
Re: need useradd scripts
for u in `cat /tmp/userlist`
do
useradd -d /oralog/$u -m $u
mkdir /oralog/$u/directory1
mkdir /oralog/$u/directory2
mkdir /oralog/$u/directory3
chown $u /oralog/$u
chmod 755 /oralog/$u
chmod 775 /oralog/$u/*
echo $u " created successfully."
done
hope this helps
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2006 10:38 AM
08-14-2006 10:38 AM
Re: need useradd scripts
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050
Two more threads in that thread.
The largest concentration of scripts sysadmins can't live without in ITRC.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2006 10:46 AM
08-14-2006 10:46 AM
Re: need useradd scripts
Thanks for the reply. This link http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=51050 web page is more than 1 mile long. Can you please kindly point out the sessions where I can find useradd scripts? I searched the keyword "useradd" but find no match.
Thanks again.
Best Regards,
Jan Shu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2006 11:35 PM
08-14-2006 11:35 PM
Re: need useradd scripts
Make a new text file (here ./text_file_with_users.txt) with list of user like this:
...
username1 password1 mygroup1
beny We5gG5^qw@ users
username2 password2 mygroup2
...
and run this script:
#!/usr/bin/ksh
NEW_USERS="./text_file_with_users.txt"
HOME_BASE="/oralog/"
cat ${NEW_USERS} | \
while read USER PASSWORD GROUP
do
useradd -g ${GROUP} -p ${PASSWORD} -m -d ${HOME_BASE}${USER} ${USER}
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 04:22 AM
08-15-2006 04:22 AM
Re: need useradd scripts
Hi Marek, I don't think useradd command has -p option. Can you please check? Thanks.
Have a good one.
Regards,
Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 05:51 AM
08-15-2006 05:51 AM
SolutionWhen the user gets created, there is no password assigned to the user. And user can not login before a password is assigned.
Depending on your trusted or non-trusted security status, there are few options that you can set the initial passwords to a certain string. The common and unsupported way of mass changing the password, which you can use regardless if you are in a trusted or non-trusted computing mode.
all you have to do is to manually change the password for any one user. Grab the encrypted password string from this users record:
a) if non-trusted
enc_pwd=`grep $username /etc/passwd|cut -d: -f2`
b) if trusted
enc_pwd=`grep u_pwd /tcb/files/auth/$(echo $username|cut -c1)/$username|cut -d= -f2 |cut -d: -f1`
then run this little script again
for user in `cat /tmp/myuserfile`
do
/usr/sam/lbin/usermod.sam -p $enc_pwd $user
/bin/passwd -f $user #force user to change on first login
echo "password of user $user has been changed"
done
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 05:54 AM
08-15-2006 05:54 AM
Re: need useradd scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2006 05:55 AM
08-15-2006 05:55 AM