Franske ITC-2480 Lab 7: Difference between revisions

From ITCwiki
Jump to navigation Jump to search
(Update to mjnk version)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Introduction=
=Introduction=
This lab assumes you know how to install a package from the Debian repository and you have Webmin installed. If you need help please see '''[[Lab_1_mnjk#Installing_sudo_and_checking_your_IP_address | Lab 1]]''' and '''[[Lab_3_mnjk#Install_the_Webmin_Control_Panel | Lab 3]]'''.


=Lab Procedure=
In this lab you will perform the following tasks:
* Install [https://www.samba.org/samba/ Samba]
* Setup a Guest Share
* Share Home Directories
* Setup a group share
 
You will not be introduced to new commands.
 
= Lab Procedure =
== Prerequisites ==
== Prerequisites ==
# Open an SSH console to your Linux system using the PuTTY software, login with your standard user account
<ol>
# Make sure that ''Webmin'' is installed on your system.
<li> Open an SSH console to your Linux system using the PuTTY software, login with your standard user account. </li>
# Make sure you have an up-to-date list of packages on your system using the '''apt update''' system
<li> Make sure that Webmin is installed on your system. </li>
# Make sure you have all the latest software upgrades on your system using the '''apt upgrade''' method
<li> Make sure you have an up-to-date list of packages on your system using the '''apt update''' system. </li>
<li> Make sure you have all the latest software upgrades on your system using the '''apt upgrade''' method. </li>
</ol>
: ''NOTE: This lab sets up Samba with anonymous guest access which is not supported by Windows 10 anymore. You can work around this (directions for doing so are below) but you can't work around it on IHCC campus managed PCs so this lab really requires access to a PC which you have full administrative control over.''


== Install Samba ==
== Install Samba ==
# With your favorite package manager, install the ''samba'' package.
'''''[https://www.youtube.com/watch?v=h15fXbqYx5Y&feature=youtu.be Video Tutorial - Install Samba]''''' <br>
# 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?
== Setup a Guest Share==
<ol>
<ol>
<li>The first thing we are going to do is we are going to create a guest share. This share will allow for all users, even those who have not authenticated, to read files.</li>
<li> With your favorite package manager, install the '''samba''' package. </li>
<li>To help you better understand samba, this first share will be configured from PuTTY and command line. First, change into the ''/etc/samba/'' directory and view a directory listing. In here we have one main file, ''smb.conf'', which holds all of the Samba share and authentication settings. There may also be a few other files and directories which can be used for more advanced Samba features such as TLS certificate based authentication.</li>
<li> After Samba is installed, login into Webmin on your local computer's web browser. </li>
<li>Now with your favorite text editor, open up ''smb.conf'' with administrative permission.</li>
<li> Under the servers tab, notice how Samba does not show up. This is because we just installed the package. </li>
<li> 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?</li>
</ol>
 
== Setup a Guest Share ==
'''''[https://www.youtube.com/watch?v=BmgKPYIVaPY&feature=youtu.be Video Tutorial - Setup a Guest Share]''''' <br>
 
The first thing we are going to do is we are going to create a guest share.
This share will allow for all users, even those who have not authenticated, to read files.</li>
To help you better understand samba, this first share will be configured from PuTTY and command line.
<ol>
<li>Change into the '''/etc/samba/''' directory and view a directory listing.
: In here we have one main file, '''smb.conf''', which holds all of the Samba share and authentication settings. There may also be a few other files and directories which can be used for more advanced Samba features such as TLS certificate based authentication.</li>
<li>With your favorite text editor, open up '''smb.conf''' with administrative permission.</li>
<li>Scroll to the bottom of the file, and notice how shares are defined. They all have a similar format such as:
<li>Scroll to the bottom of the file, and notice how shares are defined. They all have a similar format such as:
<pre>
<pre>
[Share Name]
[Share Name]
         comment = Share Comment
         comment = Share Comment
         options....</pre></li>
         options....</pre>
<li>Where options are the different configuration settings. Lets try creating the guest share folder from the config file manually.</li>
:'''options''' are the different configuration settings.</li>
<li>Exit out of nano, and create the folder ''/srv/Guest-Files'' as root. This will be the folder we are sharing.</li>
Let's try creating the guest share folder from the config file manually.
<li>Now open up ''/etc/samba/smb.conf'' in a text editor again as root, and go to the bottom of the file.</li>
<li>Exit out of the text editor, and create the folder '''/srv/Guest-Files''' as root.
: This will be the folder we are sharing.</li>
<li>Open up '''/etc/samba/smb.conf''' in a text editor again as root, and go to the bottom of the file.</li>
<li>Enter the following:
<li>Enter the following:
<pre>[Guest Share]
<pre>[Guest Share]
         comment = Public File Share
         comment = Public File Share
         public = yes
         public = yes
         path = /srv/Guest-Files</pre></li>
         path = /srv/Guest-Files</pre>
<li>You have now created the public share. In order to make the share take effect you need to restart the Samba service on your machine with the '''service smbd restart''' command. Note, restarting services requires administrative permission.</li>
You have now created the public share.  
<li>To test this share, go into ''/srv/Guest-Files'' and create a text file and enter some information. We will use this file to test the read-only settings of the share.</li>
</li>
<li>At this point, we should be ready to test out our configuration. On your Local Computer, open up the run dialog box, and enter \\172.17.50.xx (The IP you setup for the static address of your VM), and press enter. You should see a share folder called Guest Share. Open it up, and see if your text file is in the share. Open up the file, and try to edit and save the file. What error do you get?</li>
 
<li>In order to make the share take effect you need to restart the Samba service on your machine with the following command:
<br>
<code>service smbd restart</code>
 
: ''NOTE: Restarting services requires administrative permission.''</li>
<li>To test this share, go into '''/srv/Guest-Files''' and create a text file and enter some information.
: We will use this file to test the read-only settings of the share.
: At this point, we should be ready to test out our configuration. </li>
<li>On your Local Computer, open up the run dialog box, and enter '''\\172.17.50.xx''' (The IP you setup for the static address of your VM), and press enter.
: You should see a share folder called Guest Share.
:[[file:Samba-windows-guest.png | link= https://wiki.ihitc.net/mediawiki/images/d/d4/Samba-windows-guest.png | 500px]]
:[[media:Samba-windows-guest.png | Click for Larger Image]]</li>
: ''NOTE: If you receive an error on your local system and can't access the Samba share, it might be your firewall blocking the connection.  This has been the case with non-Windows Firewalls such as BitDefender.  If you are using one of these firewalls you may have to make a rule to allow traffic.  This link might help: [https://www.bitdefender.com/consumer/support/answer/2397/ https://www.bitdefender.com/consumer/support/answer/2397/]''
<li>Open the Guest Share folder and see if your text file is in the share.</li>
<li>Open up the file, and try to edit and save the file. What error do you get?</li>
: '''''SPECIAL NOTE for Windows 10 Client PCs:''' If the computer your are using to try and connect to this share is running Windows 10 version 1709 or later [https://support.microsoft.com/en-us/help/4046019/guest-access-smb2-disabled-by-default-in-windows-10-server-2016 Microsoft has disabled SMB guest share access] You have a few different options for completing this:''
:* Use an earlier version of Windows (remember you'll need to install OpenVPN and be connected to ITCnet) such as Windows 10 before version 1709, Windows 8, or Windows 7 to attempt to connect to the share.
:* Follow the instruction on the above Microsoft page to re-enable guest share access on your Windows 10 version 1709 or later system using the group policy editor (requires Windows 10 Professional or Enterprise)
:* Use the registry editor to set the key [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters] "AllowInsecureGuestAuth" to dword:1 (Note: editing your registry can cause your system not to boot and other unexpected behavior, so be careful and be sure of what you are doing)
: '''''SPECIAL NOTE for Personal Windows PCs:''' If you are getting an error after hitting enter in the run dialog box, try either disabling your firewall or making a firewall exception for the IP address of your server.''
</ol>
</ol>


== Share Home Directories==
== Share Home Directories ==
# Now we are going to setup Home Directory Sharing. By default this is enabled, but write access is not and no users are setup.
'''''[https://www.youtube.com/watch?v=MOJ6wwiQ1mk&feature=youtu.be Video Tutorial - Share Home Directories]''''' <br>
# First it must be noted that Samba requires separate user accounts from the system, just like MySQL. So first, we are going to add your user account.
Now we are going to setup Home Directory Sharing. By default this is enabled, but write access is not and no users are setup.
# To do this, we are now going to use Webmin to configure the shares. Notice also what other shares are enabled in Samba by default when looking at the Webmin page for Samba.
First it must be noted that Samba requires separate user accounts from the system, just like MySQL. So first, we are going to add your user account.
# On the Webmin Samba configuration 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/copy the local Unix user accounts to Samba accounts.
<ol>
# Leave the Unix users to convert option set to all except listed users and UID ranges with the option of -499. This will add all user accounts with a UID of 500 or more to Samba. Lower UID values are typically used on Debian systems as service accounts (like ''www-data'') who should not have Samba permissions.
<li> To do this, we are now going to use Webmin to configure the shares.
# Now on the bottom, select "No password". We are doing this as we will define unique passwords for each user. Then click Convert Users when ready.
: Notice also what other shares are enabled in Samba by default when looking at the Webmin page for Samba. </li>
# When you are done, go to the Samba Users page again. Notice how your user account is now listed. From here you can now add passwords to the different user accounts you added in the last step. Be sure to set the passwords for each user you intend to connect with.
:[[file:Webmin-samba-dashboard.png | link= https://wiki.ihitc.net/mediawiki/images/9/9d/Webmin-samba-dashboard.png | 500px]]
# 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.
:[[media:Webmin-samba-dashboard.png | Click for Larger Image]]
# 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.
<li> On the Webmin Samba configuration page, click '''Samba Users'''.
# 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.
: Notice how none are currently defined.</li>
# At this point, we should be ready to test out our configuration. On your Local Computer, open up run dialog box, and enter \\172.17.50.xx (Your IP you setup for the static address), and press enter. Notice how you do not see a home directory share because you are connected without any authentication. Now, in the top URL window, add \''username'' to the path, e.g. \\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.
<li>Go back and click '''Convert Users'''.
#* NOTE: If your user is unable to login you may have forgotten to set a Samba password for the user as directed above. You need to set a password for each user within Samba.
: This is the tool we will use to convert/copy the local Unix user accounts to Samba accounts.
# Test creating and deleting a file to verify write access is working.
<li>Leave the Unix users to convert option set to all except listed users and UID ranges with the option of -499.</li>
# Now try to access a home share of another user that was added to samba. Notice how you do not have permissions. Try logging in with another user account to access a different home share.
: This will add all user accounts with a UID of 500 or more to Samba. Lower UID values are typically used on Debian systems as service accounts (like ''www-data'') who should not have Samba permissions. </li>
#* Note: To use another user account in a samba share, you may have to logout and then back in on your local machine.
<li> On the bottom, select '''No password'''.
: We are doing this as we will define unique passwords for each user.</li>
<li>Click '''Convert Users''' when ready. </li>
<li> When you are done, go to the '''Samba Users''' page again.
: Notice how your user account is now listed.</li>
<li>From here you can now add passwords to the different user accounts you added in the last step. Be sure to set the passwords for each user you intend to connect with. </li>
 
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.
 
<li> On the Samba config page, under '''Shares''', click the '''home share'''.</li>
<li> Click '''Security and Access Control'''.</li>
<li> Set the '''Writable''' option to '''Yes''', and then click save. </li>
<li> 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. </li>
: At this point, we should be ready to test out our configuration.
<li>On your Local Computer, open up the run dialog box, and enter '''\\172.17.50.xx''' (Your IP you setup for the static address), and press enter.
: Notice how you do not see a home directory share because you are connected without any authentication.</li>
<li>In the top URL window, add '''\<username>''' to the path, e.g. '''\\172.17.50.xx\user'''.
: You should now get a login popup.</li>
<li>Login as your user, and you should be greeted with your home folder.
: ''NOTE: If your user is unable to login you may have forgotten to set a Samba password for the user as directed above. You need to set a password for each user within Samba.''
: ''NOTE: On local systems running an operating system other than Windows follow whatever process you would normally use to connect to a Windows file share using the IP address of your VM as the server name.'' </li>
<li> Test creating and deleting a file to verify write access is working.</li>
<li> Try to access a home share of another user that was added to Samba.
: Notice how you do not have permissions.</li>
<li>Try logging in with another user account to access a different home share.
: ''NOTE: To use another user account in a samba share, you may have to logout and then back in on your local machine.'' </li>
</ol>


== Setup a Group Share ==
== Setup a Group Share ==
'''''[https://www.youtube.com/watch?v=1C7BBUC_V3A&feature=youtu.be Video Tutorial - Setup a Group Share]''''' <br>
Now we are going to setup a group folder share that will allow for all samba users to read and write to the folder.
<ol>
<ol>
<li>Now we are going to setup a group folder share that will allow for all samba users to read and write to the folder.</li>
<li>Go back to the Webmin Samba configuration panel.
<li>Now back in the Webmin Samba configuration panel, we are going to create a new share. Under ''shares'', select the ''Create a new file share'' link. Use the following base configuration:
: We are going to create a new share.</li>
<pre>Share Name: Share-Files
<li>Under '''shares''', select the '''Create a new file share''' link. Use the following base configuration:
Directory to share: /srv/Group-Share
<br>
Automatically Create Directory: Yes
<code>Share Name: Share-Files<br>
Create with owner: root
Directory to share: /srv/Group-Share<br>
Create with permissions: 775
Automatically Create Directory: Yes<br>
Create with group: users
Create with owner: root<br>
Available: yes
Create with permissions: 775<br>
Browsable: yes
Create with group: users<br>
Available: yes<br>
Browsable: yes<br>
Share Comment: group share folder
Share Comment: group share folder
</pre></li>
</code></li>
<li>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.</li>
<li>Once the share is setup, click it to edit it.</li>
<li>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.</li>
<li>Once you are at the '''Edit File Share''' page, click '''File Permissions'''.
<li>Now we will need to enable write access to the folder. On the Edit file share page again, click ''Security and Access Control''. Now set the ''Writable'' option to ''Yes'', and press save.</li>
: 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 as it would only allow the owner to have modification privileges for the files and directories they create. We need to modify this so that all users on the system have full access to files in this share.</li>
<li>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 through your host computer. Then use PuTTY to look at the user and group assigned to the files you created.</li>
<li>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 all authenticated users permission to modify and edit files that may have been added by other users.</li>
<li>It is important to note that even if a user has read or write permission in Samba they must ''also'' have permission to read or write the file/directory on the underlying Linux filesystem. Many problems with making Samba work can be traced to permissions errors where a user does not have correct permission to work with a file or directory either by the Samba software ''or'' by the filesystem.</li>
: Now we will need to enable write access to the folder.
<li>Finally, take a look at your ''smb.conf'' file and see what changes Webmin made in order to setup your group share.</li>
<li>On the '''Edit file share''' page again, click '''Security and Access Control'''.</li>
<li>Set the '''Writable''' option to '''Yes''', and press '''save'''.</li>
<li>At this point, you can test the share exactly the same way we did with the home folder share.</li>
: Notice though how this share is set to '''browsable''', so it shows up in the root share folder. Go ahead and create a file through your host computer. Then use PuTTY to look at the user and group assigned to the files you created.
: It is important to note that even if a user has read or write permission in Samba they must ''also'' have permission to read or write the file/directory on the underlying Linux filesystem. Many problems with making Samba work can be traced to permissions errors where a user does not have correct permission to work with a file or directory either by the Samba software ''or'' by the filesystem.
<li>Look at your '''smb.conf''' file and see what changes Webmin made in order to setup your group share.</li>
</ol>
</ol>
= Checking Your Work =
<li> Automatically check your results by running this command:</li>
<code><nowiki>
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_07_test.py | python3
</nowiki></code>
=Web App=
You can check your progress on any of the labs in the ITC-2480 course from a webapp from this link:  <br>
[http://webcheck.itc2480.campus.ihitc.net webcheck.itc2480.campus.ihitc.net]<br>
You must be logged into the campus VPN to use this application.

Latest revision as of 19:59, 3 December 2021

Introduction

This lab assumes you know how to install a package from the Debian repository and you have Webmin installed. If you need help please see Lab 1 and Lab 3.

In this lab you will perform the following tasks:

  • Install Samba
  • Setup a Guest Share
  • Share Home Directories
  • Setup a group share

You will not be introduced to new commands.

Lab Procedure

Prerequisites

  1. Open an SSH console to your Linux system using the PuTTY software, login with your standard user account.
  2. Make sure that Webmin is installed on your system.
  3. Make sure you have an up-to-date list of packages on your system using the apt update system.
  4. Make sure you have all the latest software upgrades on your system using the apt upgrade method.
NOTE: This lab sets up Samba with anonymous guest access which is not supported by Windows 10 anymore. You can work around this (directions for doing so are below) but you can't work around it on IHCC campus managed PCs so this lab really requires access to a PC which you have full administrative control over.

Install Samba

Video Tutorial - Install Samba

  1. With your favorite package manager, install the samba package.
  2. After Samba is installed, login into Webmin on your local computer's web browser.
  3. Under the servers tab, notice how Samba does not show up. This is because we just installed the package.
  4. 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?

Setup a Guest Share

Video Tutorial - Setup a Guest Share

The first thing we are going to do is we are going to create a guest share.

This share will allow for all users, even those who have not authenticated, to read files. To help you better understand samba, this first share will be configured from PuTTY and command line.

  1. Change into the /etc/samba/ directory and view a directory listing.
    In here we have one main file, smb.conf, which holds all of the Samba share and authentication settings. There may also be a few other files and directories which can be used for more advanced Samba features such as TLS certificate based authentication.
  2. With your favorite text editor, open up smb.conf with administrative permission.
  3. Scroll to the bottom of the file, and notice how shares are defined. They all have a similar format such as:
    [Share Name]
            comment = Share Comment
            options....
    options are the different configuration settings.
  4. Let's try creating the guest share folder from the config file manually.

  5. Exit out of the text editor, and create the folder /srv/Guest-Files as root.
    This will be the folder we are sharing.
  6. Open up /etc/samba/smb.conf in a text editor again as root, and go to the bottom of the file.
  7. Enter the following:
    [Guest Share]
            comment = Public File Share
            public = yes
            path = /srv/Guest-Files

    You have now created the public share.

  8. In order to make the share take effect you need to restart the Samba service on your machine with the following command:
    service smbd restart
    NOTE: Restarting services requires administrative permission.
  9. To test this share, go into /srv/Guest-Files and create a text file and enter some information.
    We will use this file to test the read-only settings of the share.
    At this point, we should be ready to test out our configuration.
  10. On your Local Computer, open up the run dialog box, and enter \\172.17.50.xx (The IP you setup for the static address of your VM), and press enter.
    You should see a share folder called Guest Share.
    Samba-windows-guest.png
    Click for Larger Image
  11. NOTE: If you receive an error on your local system and can't access the Samba share, it might be your firewall blocking the connection. This has been the case with non-Windows Firewalls such as BitDefender. If you are using one of these firewalls you may have to make a rule to allow traffic. This link might help: https://www.bitdefender.com/consumer/support/answer/2397/
  12. Open the Guest Share folder and see if your text file is in the share.
  13. Open up the file, and try to edit and save the file. What error do you get?
  14. SPECIAL NOTE for Windows 10 Client PCs: If the computer your are using to try and connect to this share is running Windows 10 version 1709 or later Microsoft has disabled SMB guest share access You have a few different options for completing this:
    • Use an earlier version of Windows (remember you'll need to install OpenVPN and be connected to ITCnet) such as Windows 10 before version 1709, Windows 8, or Windows 7 to attempt to connect to the share.
    • Follow the instruction on the above Microsoft page to re-enable guest share access on your Windows 10 version 1709 or later system using the group policy editor (requires Windows 10 Professional or Enterprise)
    • Use the registry editor to set the key [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters] "AllowInsecureGuestAuth" to dword:1 (Note: editing your registry can cause your system not to boot and other unexpected behavior, so be careful and be sure of what you are doing)
    SPECIAL NOTE for Personal Windows PCs: If you are getting an error after hitting enter in the run dialog box, try either disabling your firewall or making a firewall exception for the IP address of your server.

Share Home Directories

Video Tutorial - Share Home Directories
Now we are going to setup Home Directory Sharing. By default this is enabled, but write access is not and no users are setup. First it must be noted that Samba requires separate user accounts from the system, just like MySQL. So first, we are going to add your user account.

  1. To do this, we are now going to use Webmin to configure the shares.
    Notice also what other shares are enabled in Samba by default when looking at the Webmin page for Samba.
  2. Webmin-samba-dashboard.png
    Click for Larger Image
  3. On the Webmin Samba configuration page, click Samba Users.
    Notice how none are currently defined.
  4. Go back and click Convert Users.
    This is the tool we will use to convert/copy the local Unix user accounts to Samba accounts.
  5. Leave the Unix users to convert option set to all except listed users and UID ranges with the option of -499.
  6. This will add all user accounts with a UID of 500 or more to Samba. Lower UID values are typically used on Debian systems as service accounts (like www-data) who should not have Samba permissions.
  7. On the bottom, select No password.
    We are doing this as we will define unique passwords for each user.
  8. Click Convert Users when ready.
  9. When you are done, go to the Samba Users page again.
    Notice how your user account is now listed.
  10. From here you can now add passwords to the different user accounts you added in the last step. Be sure to set the passwords for each user you intend to connect with.
  11. 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.
  12. On the Samba config page, under Shares, click the home share.
  13. Click Security and Access Control.
  14. Set the Writable option to Yes, and then click save.
  15. 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.
  16. At this point, we should be ready to test out our configuration.
  17. On your Local Computer, open up the run dialog box, and enter \\172.17.50.xx (Your IP you setup for the static address), and press enter.
    Notice how you do not see a home directory share because you are connected without any authentication.
  18. In the top URL window, add \<username> to the path, e.g. \\172.17.50.xx\user.
    You should now get a login popup.
  19. Login as your user, and you should be greeted with your home folder.
    NOTE: If your user is unable to login you may have forgotten to set a Samba password for the user as directed above. You need to set a password for each user within Samba.
    NOTE: On local systems running an operating system other than Windows follow whatever process you would normally use to connect to a Windows file share using the IP address of your VM as the server name.
  20. Test creating and deleting a file to verify write access is working.
  21. Try to access a home share of another user that was added to Samba.
    Notice how you do not have permissions.
  22. Try logging in with another user account to access a different home share.
    NOTE: To use another user account in a samba share, you may have to logout and then back in on your local machine.

Setup a Group Share

Video Tutorial - Setup a Group Share
Now we are going to setup a group folder share that will allow for all samba users to read and write to the folder.

  1. Go back to the Webmin Samba configuration panel.
    We are going to create a new share.
  2. Under shares, select the Create a new file share link. Use the following base configuration:
    Share Name: Share-Files
    Directory to share: /srv/Group-Share
    Automatically Create Directory: Yes
    Create with owner: root
    Create with permissions: 775
    Create with group: users
    Available: yes
    Browsable: yes
    Share Comment: group share folder
  3. Once the share is setup, click it to edit it.
  4. 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 as it would only allow the owner to have modification privileges for the files and directories they create. We need to modify this so that all users on the system have full access to files in this share.
  5. 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 all authenticated users permission to modify and edit files that may have been added by other users.
  6. Now we will need to enable write access to the folder.
  7. On the Edit file share page again, click Security and Access Control.
  8. Set the Writable option to Yes, and press save.
  9. At this point, you can test the share exactly the same way we did with the home folder share.
  10. Notice though how this share is set to browsable, so it shows up in the root share folder. Go ahead and create a file through your host computer. Then use PuTTY to look at the user and group assigned to the files you created.
    It is important to note that even if a user has read or write permission in Samba they must also have permission to read or write the file/directory on the underlying Linux filesystem. Many problems with making Samba work can be traced to permissions errors where a user does not have correct permission to work with a file or directory either by the Samba software or by the filesystem.
  11. Look at your smb.conf file and see what changes Webmin made in order to setup your group share.

Checking Your Work

  • Automatically check your results by running this command:
  • curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_07_test.py | python3

    Web App

    You can check your progress on any of the labs in the ITC-2480 course from a webapp from this link:
    webcheck.itc2480.campus.ihitc.net
    You must be logged into the campus VPN to use this application.