中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

samba如何批量添加用戶

2019-04-29    來源:愛站科技

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用

? ? ? ?我們可以利用samba服務(wù)器共享服務(wù)器上面的文件,因此作為系統(tǒng)管理員我們需要經(jīng)常為機(jī)器添加用戶,但是一個(gè)個(gè)添加太麻煩了,那么你知道samba如何批量添加用戶嗎?

這2天接了個(gè)linux下文件服務(wù)器的單,所以研究samba,目前能做到的是批量導(dǎo)入用戶,有些方面的處理還不是很周到,以后有時(shí)間再改,先發(fā)上幾個(gè)相關(guān)文件.

安裝執(zhí)行辦法:

./update.sh remove

./update.sh install

設(shè)置smb

./update.sh set

user.txt為用戶密碼文件,user:password

update.sh

#!/bin/bash

if [ "$1" = "remove" ]; then

aptitude purge samba -y > /dev/null

apt-get remove samba* -y > /dev/null

rm -rf /etc/samba > /dev/null

elif

[ "$1" = "install" ]; then

echo "Waiting..................."

aptitude install samba -f -y

aptitude install winbind -f -y

aptitude install expect -y

addgroup kx

elif

[ "$1" = "set" ]; then

/etc/init.d/samba stop

cp ./smb.conf /etc/samba/smb.conf -f

SAVEDIFS=$IFS

IFS=:

while read xname other

do

smbpasswd -x $xname

done & /dev/null

chown $name.kx /home/$name

./expect_smb.sh $name $passwd > /dev/null

echo "Add user ##$name## with password ##$passwd## over!"

done < ./user.txt

/etc/init.d/samba restart

fi

./expect_smb.sh

#!/usr/bin/expect -f

#FileName:expect_smb.sh

#Add user to the samba server

# 1---The name of user

# 2---The passwd of user

set username [lindex $argv 0]

set password [lindex $argv 1]

spawn smbpasswd -a $username

expect "*password:"

send "$password\n"

expect "*password:"

send "$password\n"

expect eof

smb.conf

[global]

workgroup = mygroup

server string = %h server

; wins support = no

; wins server = w.x.y.z

dns proxy = no

; name resolve order = lmhosts host wins bcast

; interfaces = 127.0.0.0/8 eth0

; bind interfaces only = true

log file = /var/log/samba/log.%m

max log size = 1000

; syslog only = no

syslog = 0

panic action = /usr/share/samba/panic-action %d

security = user

encrypt passwords = true

passdb backend = tdbsam

obey pam restrictions = yes

invalid users = root

; unix password sync = no

passwd program = /usr/bin/passwd %u

passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n *password\supdated\ssuccessfully* .

; pam password change = no

domain logons = no

; logon path = \\%N\profiles\%U

; logon path = \\%N\%U\profile

; logon drive = H:

; logon home = \\%N\%U

; logon script = logon.cmd

; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

load printers = no

; printing = bsd

; printcap name = /etc/printcap

; printing = cups

; printcap name = cups

; printer admin = @ntadmin

; include = /home/samba/etc/smb.conf.%m

# You may want to add the following on a Linux system:

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

; domain master = auto

; idmap uid = 10000-20000

; idmap gid = 10000-20000

; template shell = /bin/bash

winbind enum groups = yes

; winbind enum users = yes

#======================= Share Definitions =======================

[homes]

comment = Home Directories

browseable = no

writable = yes

create mask = 0700

directory mask = 0700

valid users = %S

[wind]

comment = wind

path = /home/wind

writable = yes

create mask = 0770

directory mask = 0770

[tools]

comment = tools

path = /home/tools

writeable = yes

create mask = 0700

directory mask = 0700

; write list = root, @ntadmin

; postexec = /bin/umount /cdrom

user.txt

kx1:0

kx2:0

kx3:0

kx4:0

? ? ? ?以上就是愛站技術(shù)頻道小編為大家準(zhǔn)備samba如何批量添加用戶的內(nèi)容,希望你正好需要,更多精彩內(nèi)容,請繼續(xù)關(guān)注愛站技術(shù)頻道。

標(biāo)簽: [db:TAGG]

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:如何解決shmmax 共享內(nèi)存不足的問題

下一篇:增強(qiáng)Linux服務(wù)器安全的配置