Introduction
Lab Procedure
Prerequisites
- Open an SSH console to your Linux system using the PuTTY software, login with your standard user account
- Make sure that webmin is installed on your system.
Install Samba
- With your favorite package manager, install the samba package.
- After samba is installed, login into webmin on your local computers web browser.
- Under the servers tab, notice how samba does not show up. This is because we just installed the package.
- On the bottom of the left toolbar, click refresh modules. After a minute, it should refresh the page. Now look under the servers tab again. Does samba now show up?
Share Home Folders
- Now we are going to setup Home Folders. By default they are enabled, but write access is not.
- First it must be noted that samba requres seperate user accounts from the system, just like mysql. So first, we are going to add your user account.
- On the Webmin Samba config page, click Samba Users. Notice how none are currently defined. Go back, and then click Convert Users. This is the tool we will use to convert the local unix user accounts to samba.
- Now select the "Only listed users or UID ranges", and enter your username.
- Now on the bottom, select "Use this password" and create a password for your samba user. Then click Convert Users when ready.
- When you are done, go to the Samba Users page again. Notice how your user account is now listed.
- Lastly we are going to setup write access to home folders, so you will be able to add files to your home directory over samba.
- On the samba config page, under Shares, click the home share. Next click Security and Access Control. Now set the Writable option to Yes, and then click save.
- Now go back to the Samba config page, and click the Restart Samba Servers option at the bottom. We do this to force samba to load the new configuration. You can also wait a minute or two if you don't want to disconnect any connected users.
- At this point, we should be ready to test out our configuration. On your Local Computer, open up command line, and enter \\172.17.50.xx (Your IP you setup for the static address), and press enter. Notice how you have an empty share because you are connected without any authentication. Now, in the top URL window, add \username to the path, so ex \\172.17.50.xx\user. You should now get a login popup. Login as your user, and you should be greeted with your home folder.
- Test creating and deleting a file to verify write access is working.
Setup PAM Auth Folder
- Now we are going to setup a PAM authentication folder share. PAM (Pluggable Authentication Modules) allows for dynamic authorization for applications and services on a Linux system. This means that as long as a user has an account defined in samba, they will have access to this shared folder we are creating.
- Now back in the webmin samba config panel, we are going to create a new share. Under shares, select the Create a new file share link.
- Use the following base configuration:
Share Name: PAM-Files
Directory to share: /srv/PAM-Share
Automatically Create Directory: Yes
Create with owner: root
Create with permissions: 775
Create with group: users
Available: yes
Browsable: yes
Share Comment: PAM user share folder
- Once the share is setup, click it to edit it. Once you are at the Edit File Share page, click File Permissions. Notice how the New Unix file and New Unix directory are set to 755 by default, even though we set the share to use 775 to create the directory. This is done for security purposes.
- Now set the New Unix file and New Unix directory mode to 775, and set Force Unix group to users. You can now press save. We do this to allow authenticated users to modify and edit files that may have been added by other users.
- Now we will need to enable write access to the folder, as well as define what users are valid. On the Edit file share page again, click Security and Access Control. Now set the Writeable option to Yes, and press save.
- At this point, you can test the share exactly the same way we did with the home folder share. Notice though how this share is set to browsable, so it shows up in the root share folder. Go ahead and create a file, and in putty, look at the user and group assigned to the files you created.
Setup Guest Folder