Linux adduser && smb setting

1) sudo apt-get install gedit samba

 

2) sudo groupadd dev

root@iwgame:~/test# cat batch_adduser
#! /bin/bash

set -x

for i in `seq 2 9`;
do
  u_name="public$i"
  if [ -n $u_name ]
  then
    useradd -d "/home/$u_name" -m $u_name -g dev
    echo $u_name:$u_name | chpasswd
    echo "Done"
  fi
done

 

 

#####################
$ cat generate_smb.sh 
for i in `seq 2 9`;do
share_path="/home/public$i/public$i"
echo -e "\n["public$i"]"
echo    comment = "public$i share"
echo    path = $share_path
echo    writable = yes
echo    browseable = yes
echo -e "valid users = public$i \n"
done

 

#####################

 

3) sudo visudo   : /etc/sudoers

%dev ALL=(ALL) ALL

public2 ALL =(ALL) ALL 

 

4) cat /etc/apt/source.list

###### Ubuntu Main Repos
deb http://ftp.sjtu.edu.cn/ubuntu/ precise main restricted universe multiverse
###### Ubuntu Update Repos
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-updates main restricted universe multiverse

 

 

5) apt-get install samba

[public]

comment = '%u share'

path = /home/%u/%u

browseable = yes
writable = yes
available = yes/no
valid users = %u

 

posted @ 2016-03-22 10:12  Nancy0401  阅读(218)  评论(0)    收藏  举报