Samba Password Protect
From WL-HDD Wiki
| WL-HDD Contents |
|---|
| What is the WL-HDD |
| Features |
| Pro's/con's |
| Reviews |
| Hacking |
| Inserting the HDD |
| Hacking Guides |
| Basic setup guides |
| Packages guides |
| Requests |
| Troubleshooting |
| This Wiki |
| Credits |
| Editing help |
| Contact Me |
Contents |
Prerequisites
To complete this guide, the following is assumed:
| You are running Oleg's firmware (1.9.2.7-6b or later) |
| You have harddisk partitions up and running with an extended filesystem mounted to /opt |
| You have installed the Ipkg package system. |
| You have configured your partitions to automount. |
You have setup and successfully run Samba on your LAN (using the guest account) and you have some shares already setup in smb.conf. |
| You have already completed the Samba with Users guide |
Enable Share based Password Protection
Do you want certain shares to be accessible by certain users only?
- In this case there are two things you can do:
Force User or Group
Change your smb.conf file to the following, uncommenting the relevant force string:
[global] workgroup = <your workgroupname e.g. Workgroup> guest account = nobody security = user browseable = yes guest ok = no guest only = no log level = 1 max log size = 100 encrypt passwords = yes dns proxy = no
[<your 1st sharename e.g. Share1>] path=/opt/share/shared1 writeable = yes browseable = yes # force user = <the user you want to give access to, e.g. admin> # force group = <the group you want to give access to, e.g. share>
Either choose to force samba to only allow a particular user (e.g. admin)
- Uncomment # force user (by removing the # and space after it
Or Choose to force samba to only allow a particular group (e.g. share)
- Uncomment # force group (by removing the # and space after it)
You can use either of these two commands on any of your shares and if you create a group for each individual share and add the relevant users to that group then you can control who accesses each share.
Using Chmod
Another, less user friendly way of doing the above is setting the folder permissions of each share so that only certain users can access the share.
For example, if you only want the user 'admin' to access the share then you can do this:
chown admin /opt/path/to/the/share
You can also make sure the permissions for folders within the share are changed with:
chown -R admin /opt/path/to/the/share
You also need to chmod the folder so only that user can access it:
chmod 700 /opt/path/to/the/share
The -R flag also works with this command
If you want a group of users to be able to access the share, such as the group 'share' you can do this:
chgrp share /opt/path/to/the/share
You can also make sure the permissions for folders within the share are changed with:
chgrp -R share /opt/path/to/the/share
You also need to chmod the folder so only that user can access it:
chmod 700 /opt/path/to/the/share
The -R flag also works with this command You will need to add the relevant users to the group using the Making Groups guide.
Categories: Samba | Basic setup | Users
