HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Adding Multiple Users
Operating System - HP-UX
1832351
Members
2591
Online
110041
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
04-22-2003 12:37 PM
04-22-2003 12:37 PM
Adding Multiple Users
Actually this is a two part question, but I would like to get some ideas of scripts in place.
We currently already have NIS and NIS+ (scary hu?) in two different environments.
All our 10.20 systems are on NIS the 11.00 systems are on NIS+. We have been asked to add roughly 700 users to BOTH environments. I have already successfully added the 700 users to the passwd on NIS, we are currently working on a way to add in NIS+ but what I need to do in the mean time is come up with some scripts that will ease the pain. What I need is a script (very new to scripting) that I can give a list of users, then have it copy a default directory then chown on the permissions then move onto the next id in the list. I am sure this is very easy for some of you but would appreciate all of your input and ideas. Maybe someone else has had to do this as well.
Thanks for your time.
ekelley
We currently already have NIS and NIS+ (scary hu?) in two different environments.
All our 10.20 systems are on NIS the 11.00 systems are on NIS+. We have been asked to add roughly 700 users to BOTH environments. I have already successfully added the 700 users to the passwd on NIS, we are currently working on a way to add in NIS+ but what I need to do in the mean time is come up with some scripts that will ease the pain. What I need is a script (very new to scripting) that I can give a list of users, then have it copy a default directory then chown on the permissions then move onto the next id in the list. I am sure this is very easy for some of you but would appreciate all of your input and ideas. Maybe someone else has had to do this as well.
Thanks for your time.
ekelley
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 12:44 PM
04-22-2003 12:44 PM
Re: Adding Multiple Users
Hi,
Something like this?
#!/bin/sh
# add_users.sh
while read USER
do
echo "Adding user $USER"
done
Create a file named add_users.sh with the lines listed above, and do a chmod +x add_users.sh to make the script executable.
Now, create a file with a list of user names, call it user.dat. You can execute your new script like this:
./add_users.sh
Inside of the do-loop, where the 'echo' statement is, you can add lines that will operate with the $USER variable as needed. You can add lines to cp, chmod, etc. as needed.
This little snippet of code should be enough to get you started.
Have fun!
JP
Something like this?
#!/bin/sh
# add_users.sh
while read USER
do
echo "Adding user $USER"
done
Create a file named add_users.sh with the lines listed above, and do a chmod +x add_users.sh to make the script executable.
Now, create a file with a list of user names, call it user.dat. You can execute your new script like this:
./add_users.sh
Inside of the do-loop, where the 'echo' statement is, you can add lines that will operate with the $USER variable as needed. You can add lines to cp, chmod, etc. as needed.
This little snippet of code should be enough to get you started.
Have fun!
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2003 12:47 PM
04-22-2003 12:47 PM
Re: Adding Multiple Users
You can take the /etc/passwd file on the master NIS server that has the 700 users and write a script that uses awk to get the username out and input it to the useradd command on the 11.00 NIS+ server.
Rough example.
newuser=`cat /etc/passwd | awk {print $1}`
then the value in $newuser is the input to useradd
useradd $newuser
Then its NIS push time.
SEP
Rough example.
newuser=`cat /etc/passwd | awk {print $1}`
then the value in $newuser is the input to useradd
useradd $newuser
Then its NIS push time.
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP