FREEBSD中使用IPFW來過濾ICMP服務
2024-07-26 00:29:12
供稿:網友
##############
# adduser.pl #
##############
#!/usr/bin/perl
$filename = 'class.txt' ;
open(file,$filename) ;
while( $name= ) {
chop $name ;
@name_array = split /,/,$name ;
$PW_COMMAND="/usr/sbin/pw useradd $name_array[0] -m -h 0" ;
$fname="|".$PW_COMMAND ; open(OUT, $fname) ;
PRint OUT $name_array[1] ;
close(OUT) ;
print "UserName: ",$name_array[0],"/t/t",
"PassWord: ",$name_array[1],"/n";
}
print "/n" ;
close(file) ;
################
# /etc/pw.conf #
################
logfile /root/pw.log
defaultpasswd yes
home /home
defaultshell /usr/local/bin/bash
defaultgroup user
reuseuids yes
minuid 2000
##############
# 額外說明 #
##############
1.home -->預設的家目錄
defaultshell -->預設的shell路徑
defaultgroup -->預設的群組
1.minuid -->起始的uid
############
# 使用方式 #
############
1.先備檔案
a. adduser.pl
b. /etc/pw.conf
c. 帳號的來源檔 class.txt
形式:
帳號,密碼
帳號,密碼
2.步驟
a.將adduser.pl改為可以執行
chmod 700 adduser.pl
b.adduser.pl及class.txt需在同一目錄下,不然則需更改路徑
c.執行adduser.pl
d.完成