- #!/bin/bash
- read USERNAME USER
- id $USERNAME
- if [ $? -ne 0 ]; then
- useradd $USERNAME -s /sbin/nologin -d /home/personsfolders/$USER
- echo $USERNAME | passwd --stdin $USERNAME
- fi
- (echo $USERNAME;echo $USERNAME;) | smbpasswd -as $USERNAME
- chmod 705 /home/personsfolders/$USER -Rf
- ######restart smb server######
- sed -i "/^valid users/s/$/,$USERNAME/" /etc/samba/smb.conf
- /etc/init.d/smb restart