{"id":131,"date":"2023-12-19T09:53:51","date_gmt":"2023-12-19T09:53:51","guid":{"rendered":"http:\/\/192.168.8.136\/wordpress\/?p=131"},"modified":"2024-01-09T16:24:04","modified_gmt":"2024-01-09T16:24:04","slug":"rpi-nas-part-10-examples-of-share-permissions","status":"publish","type":"post","link":"https:\/\/mpr-projects.com\/index.php\/2023\/12\/19\/rpi-nas-part-10-examples-of-share-permissions\/","title":{"rendered":"RPi NAS: Part 10 Examples of Share Permissions"},"content":{"rendered":"\n<p>We&#8217;ve installed Greyhole and we know how to mount Samba shares on our system. In the video of the 8th post we only created one share to which everybody has access. In this post we&#8217;ll look at a few ways of restricting access to Samba shares for different users.<\/p>\n\n\n<p>This post is part of a series about building a Network-Attached Storage (NAS) with redundancy using a Raspberry Pi (RPi). See <a href=\"https:\/\/mpr-projects.com\/index.php\/2023\/11\/13\/building-a-raspberry-pi-nas-with-data-redundancy-part-1-overview\/#RPi_NAS_Post_List\" data-type=\"post\" data-id=\"8\">here<\/a> for a list of all posts in this series.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" style=\"margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--30)\"\/>\n\n\n\n<p>A little preface: I&#8217;m writing this post from the perspective of a Linux user. My home network consists mostly of Linux computers but there is also one Mac and one Windows computer who should be able to access the NAS. Their access is limited to reading from it so I&#8217;m not going to spend much time on Windows- or Mac-specific setups (although we will cover everything a simple home NAS should require).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Linux Permissions<\/h2>\n\n\n\n<p>For our discussion about mounting shares it&#8217;s useful to know a little bit about permissions under Linux.<\/p>\n\n\n\n<p>By default, files and folders under Linux have permissions for three kinds of users: the owner, the owning group and everybody else. For each kind of user permissions can be any combination of <em>read<\/em>, <em>write<\/em> and <em>execute<\/em><sup data-fn=\"888c3619-1a77-4914-9cad-098278991fe2\" class=\"fn\"><a href=\"#888c3619-1a77-4914-9cad-098278991fe2\" id=\"888c3619-1a77-4914-9cad-098278991fe2-link\">1<\/a><\/sup>. For example, when you run <code>ls -l<\/code> you may see permissions like &#8216;-rwxr-x&#8212;&#8216;. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The first entry &#8216;-&#8216; indicates that we&#8217;re looking at a file (for directories the first entry would be &#8216;d&#8217; instead of &#8216;-&#8216;, but there are also other options).<\/li>\n\n\n\n<li>The next three &#8216;rwx&#8217; indicate that<em> the owner <\/em>has read, write and execute permissions.<\/li>\n\n\n\n<li>The next three &#8216;r-x&#8217; indicate read and execute permissions for <em>the owning group<\/em>.<\/li>\n\n\n\n<li>The last three &#8216;&#8212;&#8216; indicate that <em>other users<\/em> have no permissions.<\/li>\n<\/ul>\n\n\n\n<p>Permissions can also be written in octal form where a 4 corresponds to <em>read<\/em>, 2 to <em>write<\/em> and 1 to <em>execute<\/em> permissions. So &#8216;rwx&#8217; of the owner would be 4+2+1=7. The entire set of permissions rwxr-x&#8212; is then 760.<\/p>\n\n\n\n<p>While the meaning of read, write and execute is quite obvious for files, it may not be as clear for directories. In short, <em>execute<\/em> permissions for a directory allow you to traverse the directory but it gives you no other rights for the directory. For example, consider the file path <em>\/A\/B<\/em> (folder A lives in root, folder B lives in folder A). If you only have execute permissions for A but full permissions for B then you can traverse A to get to B (e.g. with <code>cd \/A\/B<\/code>) but you cannot list the contents of A (so no <code>ls \/A<\/code>) and you cannot change any of the other files or folders in A. <\/p>\n\n\n\n<p>While the permissions discussed above are useful they don&#8217;t allow for very fine-grained control. More granular permissions can be managed with Access Control Lists (ACLs). They allow you to set custom permissions for individual users and groups. See <a href=\"https:\/\/www.redhat.com\/sysadmin\/linux-access-control-lists\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> for more information.<\/p>\n\n\n\n<p>On our RPi files are saved using Linux permissions (because our operating system Raspberry Pi OS is a flavour of Linux). But Samba has to deal with Windows, Mac and Linux clients, which use different types of permission setups. Thus, Samba has to translate between Linux permissions and the native permissions of the client<sup data-fn=\"e576a9a2-dcef-48d6-a569-78070992c6e3\" class=\"fn\"><a href=\"#e576a9a2-dcef-48d6-a569-78070992c6e3\" id=\"e576a9a2-dcef-48d6-a569-78070992c6e3-link\">2<\/a><\/sup>. To achieve that Samba sometimes uses ACLs to store the desired permissions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Samba and Windows, Mac and Linux Clients<\/h2>\n\n\n\n<p>Samba was originally created for Windows. So even though we run Samba on a Linux server, it was originally intended to service Windows clients. Thus, a Windows computer connecting to the Samba server should correctly see file ownership and permissions.<\/p>\n\n\n\n<p>Macs are not originally supported but there is an extension called <em>fruit<\/em> which should allow for better compatibility between Samba and Macs. See <a href=\"https:\/\/www.samba.org\/samba\/docs\/current\/man-html\/vfs_fruit.8.html\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> for more information.<\/p>\n\n\n\n<p>By default Linux file permissions are not supported so a Linux computer connecting to the Samba server will not see file ownership and permissions correctly.<\/p>\n\n\n\n<p>In the original Samba version, SMB1, this was addressed with an extension to the protocol called <em>Unix Extensions<\/em>, which correctly transmitted file ownership and permissions to Linux clients. SMB1 was not very secure though, so Samba versions 2 and 3 were subsequently published and SMB1 was deprecated. <em>Unix Extensions<\/em>, however, are only available for SMB1. A set of extensions called <a href=\"https:\/\/wiki.samba.org\/index.php\/SMB3-Linux\" target=\"_blank\" rel=\"noreferrer noopener\">SMB3 POSIX Extensions<\/a> is intended to make SMB3 better compatible with Linux (and other UNIX variants) but these have not yet been published (as of December 2023 when I&#8217;m writing this).<\/p>\n\n\n\n<p>So Linux&#8217;s permissions system is not readily supported by Samba. Moreover, the way Greyhole is implemented requires <em>Unix Extensions<\/em> to be turned off. What that means is that we can&#8217;t rely on Linux permissions to control file access on our NAS (at least not when we&#8217;re using Linux as our main OS). Instead we&#8217;ll have to rely on Samba&#8217;s built in access control mechanisms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Samba Access Control Mechanism<\/h2>\n\n\n\n<p>Now let&#8217;s get to restricting access to shares. There are quite a few options we can play with. For a full list have a look at the <a href=\"https:\/\/www.samba.org\/samba\/docs\/current\/man-html\/smb.conf.5.html\" target=\"_blank\" rel=\"noreferrer noopener\">man pages of <em>smb.conf<\/em><\/a>. One option that&#8217;s quite important is the option <em>read only<\/em>. As the name suggests, it only allows users to read from a share but not to write to it. By default the option is enabled, so nobody can write to a share. How do we activate or deactivate <em>read only<\/em> or some other option?<\/p>\n\n\n\n<p>There&#8217;s a configuration file for Samba which is normally placed under <em>\/etc\/samba\/smb.conf<\/em>. That file has multiple sections that start with square brackets, for example [global]. Each of the [&#8230;] sections defines a share, with the exception of [global] which contains global settings and default values that apply to all shares in the configuration file. So one of the sections may be [Photography] and all options underneath it only apply to that share. The share-specific options overwrite any conflicting options in [global]. For example, a Samba share used by Greyhole could be defined as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"814\" height=\"272\" src=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_1-1.png\" alt=\"\" class=\"wp-image-886\" srcset=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_1-1.png 814w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_1-1-300x100.png 300w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_1-1-768x257.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/figure>\n\n\n\n<p><em>path<\/em> indicates where the share should be saved. The values shown above for <em>vfs objects<\/em>, <em>dfree command<\/em>, <em>wide links<\/em> and <em>follow symlinks<\/em> are required by Greyhole<sup data-fn=\"c41cac66-5143-488c-8300-2de68c3c04ba\" class=\"fn\"><a href=\"#c41cac66-5143-488c-8300-2de68c3c04ba\" id=\"c41cac66-5143-488c-8300-2de68c3c04ba-link\">3<\/a><\/sup>. Finally, there&#8217;s the option <em>read only<\/em> we discussed above. Setting it to <em>No<\/em> makes the share fully accessible to all users.<\/p>\n\n\n\n<p>Most of the remaining access control options can be split into two categories: user- (and group-)based controls and file (and directory) permissions-based controls. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">User- and Group-Based Controls<\/h3>\n\n\n\n<p>This set of controls allows us to restrict or permit share access of certain users. We&#8217;ll have a look at the following options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>write list <\/li>\n\n\n\n<li>read list<\/li>\n\n\n\n<li>valid users<\/li>\n\n\n\n<li>invalid users<\/li>\n<\/ul>\n\n\n\n<p>Let&#8217;s start with <em>write list<\/em>. This option gives the specified users read-write access to a share, even if the share is marked <em>read only = Yes<\/em>. So if we go back to the [Photography] example the settings below will allow user <em>mpr<\/em> to write data to it and everybody else to only read data from it (remember, by default a share is read only).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"858\" height=\"296\" src=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_5.png\" alt=\"\" class=\"wp-image-887\" srcset=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_5.png 858w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_5-300x103.png 300w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_5-768x265.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><\/figure>\n\n\n\n<p>Any users specified in <em>read list<\/em> will only get read access to a share (even if <em>read only = No<\/em>). <\/p>\n\n\n\n<p>Option <em>valid users<\/em> allows you to specify which users should be able to access the share. If a user is not on the list then they won&#8217;t be able to access it (e.g. mounting it will fail). Option <em>invalid users<\/em> is similar but specifies which user should not be able to access the share.<\/p>\n\n\n\n<p>There are a few additional options that I&#8217;ve chosen to ignore here. One is <em>guest ok<\/em> which allows users without a Samba username and password to log in as a guest. Also, options <em>force user<\/em> and <em>force group<\/em> can be quite useful (but maybe not so much in a simple home NAS). See the link to the man pages above for details.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">File and Directory Permission-Based Controls<\/h3>\n\n\n\n<p>These options allow for more fine-grained control over the permissions with which files are created. However, if you&#8217;re not careful it&#8217;s quite easy to mess up access to your share. Also, without <em>Unix Extensions<\/em> not all settings work as expected. So I&#8217;ll only discuss a very basic usage of these options. We&#8217;ll look at<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>create mask<\/li>\n\n\n\n<li>force create mode<\/li>\n\n\n\n<li>directory mask<\/li>\n\n\n\n<li>force directory mode<\/li>\n<\/ul>\n\n\n\n<p>Let&#8217;s start with option <em>create mask<\/em>. This option allows you to influence the permissions given to a newly created <em>file<\/em>. For example, you could set <em>create mask = 664<\/em><sup data-fn=\"b969776d-85b7-4ffb-96f4-60744dc8d5b9\" class=\"fn\"><a href=\"#b969776d-85b7-4ffb-96f4-60744dc8d5b9\" id=\"b969776d-85b7-4ffb-96f4-60744dc8d5b9-link\">4<\/a><\/sup>. On Windows (and on Linux with Unix Extensions) these permissions represent a maximum. Say you want to create a file with permissions 770<sup data-fn=\"202e8937-4099-4c33-9916-79bc6ec85795\" class=\"fn\"><a href=\"#202e8937-4099-4c33-9916-79bc6ec85795\" id=\"202e8937-4099-4c33-9916-79bc6ec85795-link\">5<\/a><\/sup>, the actual permissions of the file will be 660. On Linux without Unix Extensions this doesn&#8217;t seem to work so well. In my tests <em>create mask<\/em> determined the actual permissions of the file. So if you try to create (or copy) a file with permissions 770 it will still end up having permissions 664.<\/p>\n\n\n\n<p>So while this option is not as useful for Linux as it is for Windows, it&#8217;s still nice to have. By default files are created with permissions 744. I use 644 for most of my shares because on a NAS used for storing data there&#8217;s really no need to make all files executable (in fact no files need to be executable on the share).<\/p>\n\n\n\n<p>While <em>create mask<\/em> let&#8217;s you define maximum permissions, <em>force create mode<\/em> allows you to set a minimum. For example, if you set <em>force create mode = 775<\/em>, a file you want to create with 754 permissions will end up having 775. Again, on Linux without Unix Extensions this doesn&#8217;t work. Your final permissions will be the higher of <em>create mask<\/em> and <em>force create mode<\/em>. For example, <em>create mask = 664<\/em> and <em>force create mode = 744<\/em> will result in 764.<\/p>\n\n\n\n<p>Options <em>directory mask<\/em> and <em>force directory mode<\/em> work in the same way as <em>create mask<\/em> and <em>force create mode<\/em>. The only difference is that they determine the permissions of folders or directories instead of files. I use <em>directory mask = 755<\/em> for most of my shares.<\/p>\n\n\n\n<p>An example of a share that I&#8217;m using in my setup is shown below. Note, the 0 before 664 and 755 refers to the special and sticky permissions that we ignored earlier (and now ;-).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"491\" src=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_6-1024x491.png\" alt=\"\" class=\"wp-image-898\" srcset=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_6-1024x491.png 1024w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_6-300x144.png 300w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_6-768x368.png 768w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_6.png 1034w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Changing File Permissions<\/h2>\n\n\n\n<p>After copying data onto the NAS you may want to change file and directory permissions. On Windows you can change file permissions like you would on your PC. The new file permissions will be saved in ACLs on the RPi. I didn&#8217;t find a way to change permissions on a Linux client (without Unix Extensions).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Mounting Shares with <em>uid=username<\/em><\/h2>\n\n\n\n<p>Before we finish, let&#8217;s review something we only mentioned briefly in the previous post. In the previous post we used the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mount -t cifs \/\/192.168.50.210\/Photography \/mount\/point\/Photography -o uid=mpr,user=mpr<\/code><\/pre>\n\n\n\n<p>to mount shares under Linux. Option <em>user<\/em> refers to your Samba username on the Raspberry Pi. At first glance it&#8217;s not so clear what option <em>uid<\/em> is for. Let&#8217;s try to mount a share (to which everybody should have full access) without option <em>uid<\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mount -t cifs \/\/192.168.50.210\/Scratch \/mount\/point\/Scratch -o user=mpr<\/code><\/pre>\n\n\n\n<p>Now let&#8217;s look at the ownership of the mount points for each of the shares. Share <em>Photography<\/em> is mounted with <em>uid=mpr<\/em> and share <em>Scratch<\/em> is mounted without <em>uid=mpr<\/em>.  The other shares are not mounted.<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69f25d37bbc5d&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69f25d37bbc5d\" class=\"wp-block-image size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"310\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_2-1024x310.png\" alt=\"\" class=\"wp-image-877\" srcset=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_2-1024x310.png 1024w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_2-300x91.png 300w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_2-768x233.png 768w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_2.png 1360w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p>The directory <em>Scratch<\/em> is owned by <em>root<\/em> and if we want to create a file in Scratch then we&#8217;ll get a <em>Permission denied<\/em> error, even though we should have full access. That&#8217;s because without Linux Extensions information on ownership and permissions is not transmitted correctly.<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69f25d37bc0b2&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69f25d37bc0b2\" class=\"wp-block-image size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"102\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_3-1024x102.png\" alt=\"\" class=\"wp-image-876\" srcset=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_3-1024x102.png 1024w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_3-300x30.png 300w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_3-768x77.png 768w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_3.png 1520w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p>Let&#8217;s unmount the Share and remount it with option <em>uid=mpr<\/em>. This time we do have proper access.<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69f25d37bc43f&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69f25d37bc43f\" class=\"wp-block-image size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"255\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_4-1024x255.png\" alt=\"\" class=\"wp-image-878\" srcset=\"https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_4-1024x255.png 1024w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_4-300x75.png 300w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_4-768x191.png 768w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_4-1536x382.png 1536w, https:\/\/mpr-projects.com\/wp-content\/uploads\/2023\/12\/Share_Permissions_4-2048x510.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p>One last point. In the <code>ls -l<\/code> commands above the group of the owner is <em>root<\/em> for Photography and Scratch. That&#8217;s because we haven&#8217;t set the mount option <em>gid=groupOfUser<\/em>. We could set it but there&#8217;s no real benefit from doing so.<\/p>\n\n\n\n<p>So that&#8217;s it. Hopefully this post contains all the information you need to start configuring your Samba shares. There are more options available than I&#8217;ve covered here but now you should know enough to find and apply them yourself.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Footnotes:<\/p>\n\n\n<ol class=\"wp-block-footnotes\"><li id=\"888c3619-1a77-4914-9cad-098278991fe2\">There are also <em>special<\/em> and <em>sticky<\/em> permissions but we&#8217;ll ignore them in this post. For more information on them have a look <a href=\"https:\/\/www.redhat.com\/sysadmin\/suid-sgid-sticky-bit\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>. <a href=\"#888c3619-1a77-4914-9cad-098278991fe2-link\" aria-label=\"Jump to footnote reference 1\">\u21a9\ufe0e<\/a><\/li><li id=\"e576a9a2-dcef-48d6-a569-78070992c6e3\">You can influence how this translation works by configuring some Samba options. <a href=\"#e576a9a2-dcef-48d6-a569-78070992c6e3-link\" aria-label=\"Jump to footnote reference 2\">\u21a9\ufe0e<\/a><\/li><li id=\"c41cac66-5143-488c-8300-2de68c3c04ba\"><em>vfs objects<\/em> allow you to extend or modify how Samba works. There is a list of available modules <a href=\"https:\/\/wiki.samba.org\/index.php\/Virtual_File_System_Modules\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> but we won&#8217;t look at it in more detail in this post. For more information on the other options see the <a href=\"https:\/\/www.samba.org\/samba\/docs\/current\/man-html\/smb.conf.5.html\">man pages<\/a> of smb.conf. <a href=\"#c41cac66-5143-488c-8300-2de68c3c04ba-link\" aria-label=\"Jump to footnote reference 3\">\u21a9\ufe0e<\/a><\/li><li id=\"b969776d-85b7-4ffb-96f4-60744dc8d5b9\">664 = read and write permissions for owner and group, only read permissions for others. <a href=\"#b969776d-85b7-4ffb-96f4-60744dc8d5b9-link\" aria-label=\"Jump to footnote reference 4\">\u21a9\ufe0e<\/a><\/li><li id=\"202e8937-4099-4c33-9916-79bc6ec85795\">Windows doesn&#8217;t use Linux file permissions so Windows&#8217; permissions are translated into Linux permissions. How this translation happens can be influenced by options like <em>map archive, map hidden, etc<\/em>. When I say &#8216;&#8230; you want to create a file with permissions 770&#8230;&#8217; on Windows then I mean a file whose permissions map to 770 on Linux. <a href=\"#202e8937-4099-4c33-9916-79bc6ec85795-link\" aria-label=\"Jump to footnote reference 5\">\u21a9\ufe0e<\/a><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve installed Greyhole and we know how to mount Samba shares on our system. In the video of the 8th post we only created one share to which everybody has access. In this post we&#8217;ll look at a few ways of restricting access to Samba shares for different users. A little preface: I&#8217;m writing this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"wp-custom-template-single-with-sidebar-1","format":"standard","meta":{"_eb_attr":"","footnotes":"[{\"content\":\"There are also <em>special<\/em> and <em>sticky<\/em> permissions but we'll ignore them in this post. For more information on them have a look <a href=\\\"https:\/\/www.redhat.com\/sysadmin\/suid-sgid-sticky-bit\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">here<\/a>.\",\"id\":\"888c3619-1a77-4914-9cad-098278991fe2\"},{\"content\":\"You can influence how this translation works by configuring some Samba options.\",\"id\":\"e576a9a2-dcef-48d6-a569-78070992c6e3\"},{\"content\":\"<em>vfs objects<\/em> allow you to extend or modify how Samba works. There is a list of available modules <a href=\\\"https:\/\/wiki.samba.org\/index.php\/Virtual_File_System_Modules\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">here<\/a> but we won't look at it in more detail in this post. For more information on the other options see the <a href=\\\"https:\/\/www.samba.org\/samba\/docs\/current\/man-html\/smb.conf.5.html\\\">man pages<\/a> of smb.conf.\",\"id\":\"c41cac66-5143-488c-8300-2de68c3c04ba\"},{\"content\":\"664 = read and write permissions for owner and group, only read permissions for others.\",\"id\":\"b969776d-85b7-4ffb-96f4-60744dc8d5b9\"},{\"content\":\"Windows doesn't use Linux file permissions so Windows' permissions are translated into Linux permissions. How this translation happens can be influenced by options like <em>map archive, map hidden, etc<\/em>. When I say '... you want to create a file with permissions 770...' on Windows then I mean a file whose permissions map to 770 on Linux.\",\"id\":\"202e8937-4099-4c33-9916-79bc6ec85795\"}]"},"categories":[3,10],"tags":[9,7,4,5],"class_list":["post-131","post","type-post","status-publish","format-standard","hentry","category-linux","category-projects","tag-data-safety","tag-greyhole","tag-linux","tag-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/posts\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":25,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":1238,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/posts\/131\/revisions\/1238"}],"wp:attachment":[{"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/categories?post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/tags?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}