First, add regular users in batches
If you add user1, user2……user50, how many can be input interactively, and user prefixes are also input interactively. :
#!/bin/bash##Add User Scripts in Batches####Interactive Ways to Read User Prefixes and Number of Users####Passwords also use interactive input, user passwords are password prefixes + user serial numbers ## author: Barlow #### last modified: 2013-3-18 #### to create a user echo " Please input username: " read nameecho " Please input number of users: " read numn = 1while [ ,null,null,0],$n -le $num ]do/usr/sbin/useradd $name$n > /dev/null##You can also add new users to a group, such as the sshd group, so that they can log in to /usr/using ssh. Sbin/usermod -G sshd $name$nn=`expr $n + 1`done# Change password echo "Please input the password:"read passwdm=1while [ $m -le $num ]doecho $passwd$m |
/usr/bin/passwd --stdin $name$m > /dev/nullm=`expr $m + 1`doneexit
Second, add users without any rules in batches:
If you want to add a account to a server for the R&D department and the account is the full spell for each user, you can put these users' accounts into a specific file with less Read and create, the specific script is as follows:
#!/bin/bash##Add user scripts in batches####Read user names from user list file $1 and create ####Set all the user's password for the user name +888 #### author: Barlow #### last modified: 2013-3-18 ### for user in `less $ 1`do /usr /sbin /useradd $ user ## here You can also add new users to a group, such as the sshd group, so that they can use ssh to log in to /usr/sbin/usermod -G sshd $name$n#change the password echo $user"888" |
/usr/bin/passwd --stdin $userdoneexit
When executed, the following parameter is the user list file, such as:
sh useradd.sh user_list.txt
The Linux operating system has been around for 20 years without knowing it. Just 20 years ago, just
Perhaps the user will misuse the grub.conf file and it will not be able to enter Linux operating sy
The Gentoo Linux operating system (pronounced /ˈdʒɛntuː/) is a Linux meta-release
Get the NIC traffic through the 3rd party tool, this must be very clear. In fact, the effect can be
Under linux rm delete non-empty directory
How to implement file sharing in VMWARE
Linux How to prohibit root from using ssh to log in and modify ssh port
How to check the current version of the network card under the Linux operating system
Some tips on how to redirect in Linux I/O
Common commands for creating and deleting Linux directories
Find Out Server CPU Architecture(32 bit or 64 bit) in Linux
Use the nohup command to let the linux program run in the background
How to solve the abnormality of the WinXP hard disk icon?
We have 10% of users using Windows 8
Win Server 2012 CPU throttling configuration tips
Win7 boot display user name or password error how to solve
What is vi? What does vi mean?
Making an operating system USB recovery disk for Surface RT
How to add right-click installation for Win10 CAB update package?
Viewing the "Source File" menu is disabled
How to remove the shield icon on Win7 desktop shortcuts
Microsoft confirms that the transparent interface effect will return in Win10