Establish a large number of users 2

zhaozj2021-02-11  204

Establish a large number of users 2

Skill administrator (2000-12-24 10:59) 〖Back〗 〖Forward〗

1. Assume that use Excel to complete the establishment of the data field, other text files, FTP to Server, the contents of the data files have three fields, named ($ 1), password ($ 2), Name ($ 3), save to Server The file name is Data.txt2. Edit an awk program, file name: mkusers.awk, the content is as follows: {print "adduser -g users -d / home / st /" $ 1 "-s / bin / bash -c "$ 3" "$ 1} {Print" Echo "$ 1": "$ 2" | chpasswd "} Please note that the blue part is a string, before and after" number, $ 1 $ 2 $ 3 is the field variable. 3. Execute awk -f Mkusers.awk./data.txt | More Description: First look at the result of the output is wrong, correct it correctly, and change more to SH. If you want to delete these users at the same time, you only need to use UserDel -R UserName to replace the above The program is

转载请注明原文地址:https://www.9cbs.com/read-3577.html

New Post(0)