- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Useradd script
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
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
06-19-2005 11:06 PM
06-19-2005 11:06 PM
Useradd script
Is any script available for it.
I need to specify user id as its Emp id. & as comment is First name and Last name.
Password will be this loginname .
Regards
Abhijeet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2005 11:14 PM
06-19-2005 11:14 PM
Re: Useradd script
As for a script, you can use vi to build one rather quickly, provided you have the list of employee names and ID's available. The hardest part will be creating unique USER NAMES.
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2005 11:23 PM
06-19-2005 11:23 PM
Re: Useradd script
--- employee.log ---
# ID Login First Name ast Name
1200 Muthu Muthukumar Kandasamy
....
....
#!/bin/sh
print "Enter group name to add all employee"
read group
groupadd $group
while read line; do
$(echo $line | grep -qEv '^$|^#')
if [[ $? -ne 0 ]]
then
user=$(echo $line | awk '{ print $2 }')
comment=$(echo $line | awk '{ print $3" "$4 }')
uid=$(echo $line | awk '{ print $1 }')
useradd -u $uid -c "$comment" -g $group $user
fi
done
## end ###
Try for two users and delete it. Try again to all.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2005 12:17 AM
06-20-2005 12:17 AM
Re: Useradd script
Suppose I have text file with above information , how to use this text file with your script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2005 12:27 AM
06-20-2005 12:27 AM
Re: Useradd script
#cat userlist
60000 loginname1 Tom,Cruise
60001 loginname2 Jerry,Maquire
60002 loginname3 Kevin,Mitnick
#cat script_useradd.sh
#!/bin/ksh
cat userlist|while read $uid $login $comment
do
echo "Adding ... $uid $loginname"
useradd -u $uid -g users -d /home/$loginname -c $comment -m $loginname
./ch_pass $loginname $loginname
done
# chmod 700 script_useradd.sh
simply just execute ./script_useradd.sh
this are sample, change the script to fill your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2005 12:31 AM
06-20-2005 12:31 AM
Re: Useradd script
do
# insert the above code here.
done < textfile
This will let you read through the file and process the entire textfile with the code provided above.
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
06-20-2005 12:38 AM
06-20-2005 12:38 AM