- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- create users using custom 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
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
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
10-04-2011 07:31 AM
10-04-2011 07:31 AM
create users using custom script
Hello,
I need to create on my server +30 users.
I want to use a custom shell script that read a txt file and execute "useradd" command.
I dont want to set a default password for user. I want that on first login user must set/change new password.
my txt file is formatted in this fom:
#username&group
user1 group1
user2 group1
user3 group2
.
.
.
Any ideas?
Thanks.
- Tags:
- useradd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2011 08:15 AM
10-04-2011 08:15 AM
Re: create users using custom script
Hi:
What have you tried? I suggest a search of this community with keywords like 'useradd' and 'script'.
In general you can read a file that contains the elements you describe thusly:
#!/usr/bin/sh while read USER GROUP WHATEVER do useradd -G ${GROUP} ${USER} done < /var/tmp/addusers
...where '/var/tmp/addusers' contains the username and the group to which the user belongs --- one entry per line using whitespace delimited fields.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2011 08:21 AM
10-04-2011 08:21 AM
Re: create users using custom script
Do "useradd -G group user" force user to set password on first login?
I dont want to set a password for all users.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2011 08:35 AM
10-04-2011 08:35 AM
Re: create users using custom script
A quick glance at the useradd man page tells us that "the new login remains locked until the passwd (see passwd(1)) command is invoked."
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2011 08:38 AM
10-04-2011 08:38 AM
Re: create users using custom script
@Pietro84 wrote:
Do "useradd -G group user" force user to set password on first login?
I dont want to set a password for all users.
You are going to need to decide how you want to handle the setup. The 'useradd' I suggested will create the account but leave it locked until a 'passwd' command is run. The manpages are your friend!
Regards!
...JRF...