Creating a Windows Accessible Samba Share Using Webmin - Paiet/SEC-440-Webmin GitHub Wiki
Getting ready for Samba
To set up Windows file sharing on your server, you need to install the Samba package from your distribution repository. If Samba is already installed, you will find the Samba Windows File Sharing module in the Servers section of Webmin's main menu; otherwise, you will find it in the Un-used Modules section.
On most systems, Webmin will automatically download the Samba package and its dependencies. Navigate to Un-used Modules
| Samba Windows File Sharing
and click the link to download and install the package.
Creating a UNIX pseudo user
We will create a shared network folder accessible to multiple users. This shared resource must be stored on our server's disk and belong to a UNIX user. To simplify the management of file ownership and permissions, we will create a special pseudo-user named Samba. This user will not be associated with anyone, and the account will not have the ability to log into our system. The user will own all files in the shared directory, which we'll create in /srv/samba
.
Username : samba Real name : Samba Home directory : Network Pseudo-user /srv/samba : Password : No login allowed Primary group : New group with the same name as user Copy template files to the home directory? : No Create user in other modules? : No Password : No login allowed Primary group : New group with the same name as user Copy template files to the home directory? : No Create user in other modules? : No
Creating a Samba shared network folder
The next step is creating the actually shared network resource. Webmin makes this part quite easy. Perform the following steps to create a shared network folder:
- Navigate to Servers | Samba Windows File Sharing .
- Click the Create a new file share link. Set Share name to SharedFolder or a more appropriate description.
- Set Directory to share to /srv/samba .
- Since we already created the directory when setting up a pseudo-user account, answer No to create a directory Automatically?
- Since we already created the directory when setting up a pseudo-user account, answer No to create a directory Automatically? .
- Set both Available and Browseable to Yes
- Click the Create button.
Creating Samba user accounts
Samba stores its own list of users separate from your system's user list. Webmin allows you to easily create Samba user accounts for system users by performing the following steps:
- Navigate to Servers | Samba Windows File Sharing.
- Click Convert Users in the Samba Users section.
- Set Unix users to convert to Only listed users or UID ranges and use the ellipsis button ( ... ) to bring up the user-selector pop-up and select a user you wish to grant Samba access to.
- Set For newly created users, set the password to Use this password and type in a password for the user.
- Click the Convert Users button.
Granting Samba users access to the shared folder
The final part of the process is to grant Samba users access to the shared folder we created. We'll also inform Samba that it should set UNIX ownership of all incoming files to the pseudo-user samba created in the preceding section. Perform the following: steps to grant Samba users access to the shared folder:
- Navigate to Servers | Samba Windows File Sharing.
- Click the name of the share we just created. On the Edit File Share screen, click the Security and Access Control icon. Set Writable? to Yes .
- Set Read/write users to a list of users who should have write access to the shared folder.
- Use the ellipsis ( ... ) button to bring up the helpful user-selector pop-up.
- Click the Save button.
- Back on the Edit File Share screen, click the File Permissions icon.
- Set Force Unix user and Force Unix group to samba .
- Click the Save button.