Today I have configured NX server.
Now, Next task is to create users and really its very time consuming and boring task.
Usually you use useradd command to create a new user or update default new user information from command line.
So i have explore Linux and searched on Google , I have found few scripts to do this. But later I have found one good and easy solution.
Here is that,
Update and create new users in bulk.
newusers command reads a file of user name and clear-text password pairs and uses this information to update a group of existing users or to create new users. Each line is in the same format as the standard password file.
This command is intended to be used in a large system environment where many accounts are updated at a single time (batch mode). Since username and passwords are stored in clear text format make sure only root can read/write the file. Use chmod command:
# touch /root/bulk-user-add.txt
# chmod 0600 /root/bulk-user-add.txt
Create a user list as follows. Open file:
# emacs /root/bulk-user-add.txt
Append username and password:
sanjay:mypass99:555:555:Sanjay Singh:/home/Sanjay:/bin/bash
frampton:mypass99n:556:556:Frampton Martin:/home/Frampton:/bin/bash
----
--
---
barun:mypass99:560:560:Barun Ghosh:/home/Barun:/bin/bash
Now create users in batch:
# newusers /root/bulk-user-add.txt
Read man page of newusers for more information.
May be I will automate entire procedure using a php
Subscribe to:
Post Comments (Atom)
SHOW ENGINE INNODB STATUS
The SHOW ENGINE INNODB STATUS command in MySQL provides detailed information about the internal state of the InnoDB storage engine. This ...
-
Change Views DEFINER without ALTER VIEW: UPDATE `mysql`.`proc` p SET definer = ‘root@localhost’ WHERE definer=’root@foobar’ AND db=’w...
-
The Unix top command is designed to help users determine which processes are running and which applications are using more memory or process...
-
MySQL's InnoDB storage engine data refresh every situation. This post from InnoDB down, look at the data from the memory to the InnoDB ...
2 comments:
Thanks Prabhat! Exactly what I was looking for. I'll share something with you, too. When kickstarting and using an "anaconda.cfg" file or such this has been handy to include in the %post section:
cat << EOF > /tmp/user.pwd
userid1:13z8NPbGls2Dc
userid2:CJafCFDqY7NWc
..
..
EOF
#>-----------------------------------------------------------------------
# EASY WAY to change multiple passwords
#--------------------------------------
# 1. Use the following command to create encrypted passwords:
# perl -e 'print crypt("mypassword", "XX"), "\n";'
# 2. Create a file, like /tmp/user.pwd above
# 3. Run the chpasswd command that updates passwords in batch mode
# for anyone in the /tmp/user.pwd file:
chpasswd -e < /tmp/user.pwd
Cheers,
Drea
Hi, Thanks its really Good way to save time if you have tons of users.
Post a Comment