精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>电脑技术>>● Linux>>Linux之应用篇>>软件篇>>超大批量一次性完成用户创建,并指定密码

主题:超大批量一次性完成用户创建,并指定密码
发信人: ghostmouse(Netkiller)
整理人: qiaoqian(2001-12-30 23:56:09), 站内信件
超大批量一次性完成用户创建,并指定密码

各位Postmasterw你们好,Qmail+Vpopmail+sqwebmail+mysql.....几乎是webmail的主流。很少人用/etc/passwd验证用户,所以系统中的用户很少,管理起来也方便。但是Qmail+Vpopmail+sqwebmail+mysql.....这套系统能做出来的人。哼恐怕没几个人做成吧?
所以好多系统管理员不得不用Sendmail+/etc/passwd验证mail用户,用户随时间而增加,到了50个用户时恐怕.....;
公司为了省钱一台服务器上装一大堆东东,如果万一那一天出了事。那么你的邮件用户就全完蛋 :( 。然后是重做系统,一个一个的建用户加改密码.....,至少搞上一天,公司收不到邮件,你还要被老板K

程序:
[root@linux netkiller]# cat mailuser
#!/bin/sh
MAILUSERLIST=mailuserlist
gawk '{print "/usr/sbin/adduser "$1" -s /usr/bin/passwd"}' $MAILUSERLIST > addmailuser
gawk '{print $1":123"}' $MAILUSERLIST > mailuserpasswd
chmod 755 addmailuser
./addmailuser
cat mailuserpasswd | /usr/sbin/chpasswd
rm -rf addmailuser mailuserpasswd

[root@linux netkiller]# cat mailuserlist
user1
user2
user3

脚本写的不好。
[root@linux_10 root]# man chpasswd
CHPASSWD(8)                                           CHPASSWD(8)

NAME
       chpasswd - update password file in batch

SYNOPSIS
       chpasswd [-e]

DESCRIPTION
       chpasswd  reads  a  file  of user name and password pairs from standard input and uses this information to
       update a group of existing users. Without the -e switch, the passwords are expected to be cleartext.  With
       the -e switch, the passwords are expected to be in encrypted form.  Each line is of the format

              user_name:password

       The  named  user  must  exist.  The supplied password will be encrypted as necessary, and the password age
       updated, if present.

       This command is intended to be used in a large system environment where many accounts  are  created  at  a
       single time.

CAVEATS
       The input file must be protected if it contains unencrypted passwords.

SEE ALSO
       passwd(1), useradd(8), newusers(8)

AUTHOR
       Julianne Frances Haugh ([email protected])

                                                      CHPASSWD(8)



----
OICQ:13721218   ICQ:101888222.
我的主页:http://www.9812.net http://www.xuser.net http://www.xaid.net
喜欢UNIX,BSD,LINUX,Winnt2000...
gcc,PHP,JSP,ASP,CVS....
WebServer,MailServer,DnsServer...Route/Switch
Intranet,Internetl(校园网,企业网),开发,架站,系统集成,群集管理,
希望能与兴趣相投朋友,聊一聊,共同学习共内进步
数风流人物还看今朝。。。看我的了   

[关闭][返回]