Easier User Administration

From SynologyWiki

Jump to: navigation, search

Background

Currently to setup a share for each user it is necessary to :

  1 Create the Share
  2 Set the permissions.

As it is the setting of permissions that is the most time and labour intensive it would be nice to be able to do this automatically. Fortunately the Samba developers have provided this feature already, and by using it we also get the benefit of considerably reducing the size and complexity of the Samba configuration file making it much easier to maintain.

Disclaimer : This works for me but try it at your own risk.


Pre-requisites

  The SSH Patch must have been previously installed on your NAS box.

Method

Within the Synology Management console create a share caled "homedirs" and mark it as hidden in your network places. This will be the share containing all the users private folders. This share will be used to allow the Admin user to create a folder for each new user. The console will create the folder as /volume1/homedirs on your NAS box

Step 1

  SSH to the NAS and edit Sambas config file.

Step 2

  vi /usr/syno/etc/smb.conf

Step 3

  Add the following section replacing MYDOMAIN with your domain. eg. if your domain was synology then @MYDOMAIN would become @synology
[homes]
write list=nobody,@users,@MYDOMAIN\domain users,nobody
comment="%U - My Documents"
browseable=no
read list=nobody,@MYDOMAIN\domain users,nobody
valid users=nobody,@users,@MYDOMAIN\domain users,nobody
invalid users=nobody,nobody
writable=yes
guest ok=yes
create mask=0777
directory mask=0777
path=/volume1/homedirs/%U

The key lines are:

[homes] - This is the "magic" samba section that handles the users shares
create mask=0777 - Create all files with the same permissions as the NAS device normally would
directory mask=0777 - Create all directories with the same permissions as the NAS device normally would
path=/volume1/homedirs/%U - Specify the path for each users directory to be /volume1/homedirs/username
                            i.e. Within the share you created above in Step 1

To add a user :

Using Filestation connect to the "homedirs" share as admin, and create a folder with the same name as the users username. That's it. No need to set permissions etc. The same few lines will work for 1 user, 100 users, or 1000 users. This saves effort setting up multiple users, keeps the samba config file small, uses only 1 of your 100 shares regardless of the number of users, and is much easier to maintain.

Note: each user will be able to see and access only their own folder as access is managed and controlled by Samba. If you wish to share folders between users then you will have to create a normal Synology share.

Personal tools