- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Copy/clone user in linux
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
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
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
тАО07-08-2010 02:42 PM
тАО07-08-2010 02:42 PM
Copy/clone user in linux
I have a small query on user management.
I want to create a list of users, the shell, group of these users must the same replica of an existing user.
But only the condition is, the UID must be unique, the duplication of the UID is not required here, I just want to create many users with the same group and shells
* Points will be shared without fail :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-08-2010 08:28 PM
тАО07-08-2010 08:28 PM
Re: Copy/clone user in linux
suppose all users you want created are members of the groupa (primary group )and groupb groups, the shell is /bin/someshell and you want their password to be "somepass"
I'd create a txt file containing the usernames:
#cat userlist
usera
userb
userc
Then the following piece of script should do the trick
for user in `cat userlist`
do useradd $user -g groupa -G groupb -s /bin/someshell
echo somepass | passwd --stdin $user
done
Hope it was helpful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-08-2010 08:38 PM
тАО07-08-2010 08:38 PM
Re: Copy/clone user in linux
On HP-UX there is a profile called /etc/skel which controls default user creation.
The useradd commadn in Linux, has extra parameters that will allow you to use group or user templates.
Its all in the man page for useradd.
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
тАО07-09-2010 11:58 AM
тАО07-09-2010 11:58 AM
Re: Copy/clone user in linux
#!/bin/bash
if [ $# -lt 2 ]
then
echo "Usage: $0
exit 1
fi
PROTOUSER=$1
NEWUSER=$2
PROTOSHELL=$(grep "$PROTOUSER:x" /etc/passwd | cut -f 7 -d ":")
PROTOGID=$(grep "$PROTOUSER:x" /etc/passwd | cut -f 3 -d ":")
echo "Adding new user $NEWUSER based on $PROTOUSER"
useradd -s $PROTOSHELL -g $PROTOGID $NEWUSER
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2010 04:18 PM
тАО07-09-2010 04:18 PM
Re: Copy/clone user in linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2010 02:50 AM
тАО07-11-2010 02:50 AM
Re: Copy/clone user in linux
for i in `seq 1 100`
do useradd user$i -g
echo user$i | passwd --stdin user$i
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2010 11:51 PM
тАО07-13-2010 11:51 PM
Re: Copy/clone user in linux
I will look for option "Webmin".