smbtool’s documentation!¶
smbtool.sh is a little bash script for manage samba users / groups and share. It is for personal use is not ready for production.
Provides the ability to :
- Add / delete users.
- Change user’s password.
- Add / delete groups.
- Add users into groups.
- Modify user’s groups.
- Add / delete share.
- Enable / disable share.
- Manage share access.
- List users.
- List groups with users.
- List share and allowed groups.
Contents:
Installation¶
It’s easy, you need to install samba and whois for command mkpasswd.
apt-get install samba samba-common-bin whois
You need also to install whiptail l >= 0.52.10-8 or dialog:
apt-get install whiptail
or:
apt-get install dialog
Note
I recommend you to use whiptail.
Last point the script need a filesystem with ACL enable. To install ACL :
Install the acl package :
apt-get install acl
Add acl option in your /etc/fstab file to enable this option at the next reboot :
/dev/sda2 /home ext4 defaults,acl 0 2
Note
If your partition is already mounted and you don’t wand to reboot now, you can execute the next command to remount the partition with acl option.
mount -o remount,acl /home
Configuration¶
Configure the script :
You can edit the script and change some value if you want to customize the behavior.
Change the graphical interface :
DIALOG="whiptail"
or
DIALOG="dialog"
Restart or reload the samba server when you change the configuration :
SMBOPTION="restart"
or
SMBOPTION="reload"
Change the location of the samba shares :
ALL_SHARES_PATH="/home/Samba/Shares"
Change the location of the smbtool log tile :
LOGPATH="/tmp/smbtool"
System owner of all samba shares :
SHARE_OWNERS="root:root"
Note
The user must be different from your samba users who have access to the shares. The acl give the access right and not the unix permission.