0

How to add multiple user in samba using shell script

I have try to add multiple user in samba, by using shell script. But i got error while set smb password, if any one knows please help me to solve the issus. This is my shell script code

echo " \nmulti user adding process"
while read user
do
useradd $user
echo -e " $user@123\n" | smbpasswd $user -a
done < /root/user.txt

Shell Script Samba Add a comment
landon
asked Oct 25 2017

Answer

0

To add Multiple users in SAMBA Follow these steps

First create a file which contains all the user name. Something like this

Net
linux

Save the file as userlist.txt. Now create the following bash file:

#!/bin/sh
for i in `more userlist.txt `
do
echo $i
adduser $i
done

save the file and exit.

Give permission for that file.

#chmod 755 userlist.txt
now run thr file

./userlist.txt"

Add a comment
linuxhelp
asked Jan 14 2019
Post your Answer