Results 1 to 9 of 9

Thread: Ubuntu multiple network folder share with permission to Windows 7

  1. #1
    Join Date
    Aug 2011
    Beans
    12

    Question Ubuntu multiple network folder share with permission to Windows 7

    Hi,

    I am trying to setup a network share between a Ubuntu 12.04 system (file server) 64bit ext4 and Windows 7 Pro 64bit machines.

    The folder and access levels for the folders on Ubuntu 12.04 file server should be setup as below.

    /home/User01/Downloads
    Read Access
    User01
    Write Access
    User01

    /media/HDD01/Audio
    Read Access
    User01
    Write Access
    User01

    /media/HDD01/RsyncBackup
    Read Access
    User01
    User02
    WriteAccess
    User01
    User02

    /media/HDD02/Movies
    Read Access

    User01
    User02
    Write Access
    User01

    Could you provide me what should be the chmod, chown, what value the folder should ie 777, etc for this to work successful while maintaining a reasonable level of security.

    No other users on the local network should be able to access the folders on the network with the User01 or User02 password.

    I am new to file permissions configuration on linux in general.

    I have some experience in setting up SAMBA users, SAMBA users without login access, configure the smb.conf file, configure the fstab file. I haven't been able to find a tutorial that about permission which is where I think my setup is not working. I would apprepiate an explanation on the steps on how to setup this, that way I know what each setup is actually doing to the file permissions etc.

    Do I need to increase my knownlodge in groups file permission in Linux to get this setup working.

    Also not sure if this post in the correct location, not sure if this is networking issue.

    regards
    Snooze101
    Last edited by snooze101; December 4th, 2013 at 08:18 PM.

  2. #2
    Join Date
    Dec 2009
    Beans
    5,708

    Re: Ubuntu multiple network folder share with permission to Windows 7

    The first one is easy since it will do that without any chown'ong or chmod'ing:
    Code:
    [Downloads]
    path = /home/User01/Downloads
    valid users = User01
    read only = No
    The next series can be complicated depending on how it's formatted ( NTFS ? ) and how it's being mounted. What is the output of the following command:
    Code:
    ls -al /media/HDD01

  3. #3
    Join Date
    Aug 2011
    Beans
    12

    Re: Ubuntu multiple network folder share with permission to Windows 7

    Thanks Morbius1, I have included the ls results below.

    I have updated the original post to indicate that the Audio and RsyncBackup are located on the 1st hard drive (formatted with Ext4) and Movies located on the 2nd hard drive (formatted with Ext4).

    /media/HDD01/Audio
    /media/HDD01/RsyncBackup

    /media/HDD02/Movies

    The output of the ls command for HDD01 is as below.
    total 216
    drwxr-xr-x 20 User01 User01 4096 Nov 10 15:44 .
    drwxr-xr-x 9 root root 4096 Dec 3 22:27 ..
    drwxrwxr-x 2 User01 User01 4096 Jul 20 12:49 AudioAudioBooks
    drwxrwxr-x 6 User01 User01 4096 Oct 20 22:45 AudioMusic
    drwx------ 43 User01 User01 4096 Sep 11 2012 AudioUnsorted
    drwxr-xr-- 688 User01 User01 32768 Aug 20 11:38 AudioUnsortedMusic
    drwxrwxr-x 6 User01 User01 4096 Oct 1 2012 AudioUnsortedMusicIncomplete
    drwx------ 18 User01 User01 4096 Aug 3 2012 AudioUnsortedPodcasts
    -rw-rw-r-- 1 User01 User01 82726 May 26 2013 AutorunDriveIcon256.ico
    -rwxrwxrwx 1 User01 User01 40 Jun 10 2010 Autorun.inf
    drwxrwxr-x 10 User01 User01 4096 Nov 15 18:38 Backup
    drwxr-xr-x 5 User01 User01 4096 Aug 20 2012 Career
    drwxr-xr-x 8 User01 User01 4096 Jul 21 2012 CDandDVDImages
    drwxrwxr-x 4 User01 User01 4096 Nov 10 13:55 DeleteReady
    drwx------ 4 User01 User01 4096 Mar 15 2010 Guitar
    drwx------ 2 User01 User01 16384 May 26 2013 lost+found
    drwx------ 7 User01 User01 4096 Oct 30 19:54 Software
    drwx------ 5 User01 User01 4096 May 26 2013 .Trash-1000
    drwx------ 36 User01 User01 12288 Jun 11 2010 UnsortedVideo
    drwx---r-- 24 User01 User01 4096 Feb 2 2013 VideoComdey
    drwx------ 66 User01 User01 4096 Aug 18 12:59 VideoDocumentary
    drwx------ 32 User01 User01 4096 Feb 3 2011 VideoMusic

    The output of the ls command for HDD02 is as below.
    total 168
    drwxr-xr-x 8 User01 User01 4096 May 26 2013 .
    drwxr-xr-x 9 root root 4096 Dec 3 22:27 ..
    -rw-rw-r-- 1 User01 User01 82726 May 26 2013 AutorunDriveIcon256.ico
    -rwxrwxrwx 1 User01 User01 40 Jun 10 2010 Autorun.inf
    drwx------ 2 User01 User01 16384 Jun 26 2012 lost+found
    drwx------ 5 User01 User01 4096 Jun 26 2012 .Trash-1000
    drwxrwxr-x 635 User01 User01 36864 Nov 19 06:31 VideoMovies
    drwxrwxr-x 5 User01 User01 4096 Aug 14 2012 VideoMoviesCAM
    drwxrwxr-x 102 User01 User01 4096 Jul 19 2012 VideoMoviesISO
    drwxrwxr-x 14 User01 User01 4096 Jul 19 2012 VideoMoviesISONotCopied

    regards
    Snooze101

  4. #4
    Join Date
    Dec 2009
    Beans
    5,708

    Re: Ubuntu multiple network folder share with permission to Windows 7

    If these are all ext4 then this gets simpler.

    [] /media/HDD01/Audio will look exactly like the example I gave for your Downloads folder:
    Code:
    [Audio]
    path = /media/HDD01/Audio
    read only = No
    valid users = User01
    You already own the folder with write access so there's nothing else to do here.

    [] /media/HDD02/Movies will be set to be read only but with the "write list" option:
    Code:
    [Movies]
    path = /media/HDD02/Movies
    valid users = User01, User02
    read only = Yes
    write list = User01
    By default this is a read only share but "write list" overrides this default for that one user so User01 can write and User02 can only read. The permission on all the HDD02 directories seem to be 775 with User01 as owner so you don't have to change anything of this either.

    [] This is the hard one because I don't know how you intend to use it:
    /media/HDD01/RsyncBackup
    Read Access
    User01
    User02
    WriteAccess
    User01
    User02
    Um ..... Let's try this for starters:
    Code:
    [RsyncBackup]
    path = /media/HDD01/RyncBackup
    read only = No
    valid users = User01, User02
    Then you need to change permissions on the target folder:
    Code:
    sudo chmod 0770 /media/HDD01/RsyncBackup
    Change ownership to include a common group like plugdev:
    Code:
    sudo chown :plugdev /media/HDD01/RsyncBackup
    And make sure both users are memebrs of the plugdev group:
    Code:
    sudo gpasswd -a User02 plugdev
    Note: With that configuration both User01 and User02 will be able to read and write to the share but one user will not be able to edit any of the others files which I would suspect is something you want for a Backup.

    I'm shutting down for the day so if you have any other question I will check in tomorrow - of course there is always the 2nd shift crowed here.

  5. #5
    Join Date
    Aug 2011
    Beans
    12

    Re: Ubuntu multiple network folder share with permission to Windows 7

    Thanks Morbius1 for your quick instructions and explanation, I'll try these settings and post an update if setup works.

    regards
    Snooze101

  6. #6
    Join Date
    Aug 2011
    Beans
    12

    Re: Ubuntu multiple network folder share with permission to Windows 7

    Hi Morbius1,

    Thanks for your assistance on this ubuntu question. Your instructions work for the setup of share folder between ubuntu to window 7 network folder.

    The only tweak required, was for the Rsync folder, probably did not explain it well. Rsync backupfolder will be used by user02 to backup files to, but when user01 should be able to have full access (ownership) to it. The code used is as below.

    Changing permission of the folder, change ownership to include a common group, make sure both users are memebrs, as you describe in previous post was followed and worked.

    Code:
    [RsyncBackup]
        path = /media/HDD01/Backup/Rsync/User02
        valid users = User01, User02
        read only = No
        force user = User01
    I am having issue with permission for some of the shared folder, if you or someone on the forum can provided assistance that would be appreciated.

    When user02 on Win7 is trying to read a shared folder, an error comes up as below.
    user01 can read (and not test but should be able to write) this folder fine.



    "
    Windows cannot access \\C01\VideoTVSeries\30 Rock\30 Rock Season1
    You do not have permission to access \\C01\VideoTVSeries\30 Rock\30 Rock Season1. Contact your network administrator to request access.
    "

    Within the /C01/VideoTVSeries/30 Rock folder, user02 can access 30 Rock Season06 720p folder and files within that folder fine, but cannot access 30 Rock Season01.

    total 1112
    drwx------ 3 hsiva hsiva 4096 Sep 8 09:26 30 Rock Season01
    drwx------ 3 hsiva hsiva 4096 Sep 8 09:26 30 Rock Season02
    drwxr-xr-x 3 hsiva hsiva 4096 Sep 8 09:26 30 Rock Season03
    drwx------ 3 hsiva hsiva 4096 Sep 8 09:26 30 Rock Season04
    drwxr-xr-x 3 hsiva hsiva 4096 Sep 8 09:26 30 Rock Season05
    drwxr-xr-x 23 hsiva hsiva 4096 Aug 20 2012 30 Rock Season06 720p
    -rw-r--r-- 1 hsiva hsiva 539180 Sep 8 09:26 fanart.jpg
    -rw-r--r-- 1 hsiva hsiva 49812 Sep 8 09:26 folder.jpg
    -rw-r--r-- 1 hsiva hsiva 68810 Sep 8 09:26 season01.tbn
    -rw-r--r-- 1 hsiva hsiva 73119 Sep 8 09:26 season02.tbn
    -rw-r--r-- 1 hsiva hsiva 76805 Sep 8 09:26 season03.tbn
    -rw-r--r-- 1 hsiva hsiva 52698 Sep 8 09:26 season04.tbn
    -rw-r--r-- 1 hsiva hsiva 71805 Sep 8 09:26 season05.tbn
    -rw-r--r-- 1 hsiva hsiva 69465 Sep 8 09:26 season06.tbn
    -rw-r--r-- 1 hsiva hsiva 88634 Sep 8 09:26 season-all.tbn
    -rw-r--r-- 1 hsiva hsiva 10672 Sep 8 09:26 tvshow.nfo
    What should I change the value of folders and files so both user01 and user02 can read files, but only user01 can edit (write to and delete) for this shared folder?

    Is it safe to change all the folders within this shared folder to have drwxr-xr-x?

    How do I change the value of all the files in the folder to have this value?


    Could someone also explain some these codes, I copied the from somewhere but could not remember where the explanation of it was.

    Code:
    [Downloads]
        comment = Downloads
        path = /home/User01/Downloads
        writeable = yes
    ;   browseable = yes
        valid users = User01
    What does browseable = yes do to that folder on the network?
    What does the ";" at the beginning of the line do?

    I have included the SAMBA file in the post attactments for review those setting up a similar setupUbuntuSAMBAShareQuestionWin.txtUbuntuSAMBAShareQuestionLin.txt.

    regards
    Snooze101

  7. #7
    Join Date
    Aug 2011
    Beans
    12

    Re: Ubuntu multiple network folder share with permission to Windows 7

    Hi,

    I found some information about the file permission issue above.

    The links below go through in some detail about file permission and ownership setup.
    https://help.ubuntu.com/community/FilePermissions
    http://www.computerhope.com/unix/uchmod.htm

    Now that I know how to change the file permission value, could some recommend what should be the
    a) permission for folders and files, that should be only be readable, writeable, excuteable by User01
    b) permission for folders and files, that should be readable, writeable, excuteable by both User01 and User02

    c) permission for folders and files, that should be only be readable, writeable by User01
    d) permission for folders and files, that should be readable, writeable by both User01 and User02

    e) What is the difference between have readable access and excuteable access.
    e) What is the difference between have readable access and excuteable access for folder and files when accessed over the network.

    In the example above, I know the "owner" is User01, the "group" (when using) is plugdev, but what is the "other" category?

    regards
    Snooze101

  8. #8
    Join Date
    Dec 2009
    Beans
    5,708

    Re: Ubuntu multiple network folder share with permission to Windows 7

    That's a lot of questions. Let's start off with some basics:

    *** There are two different mechanisms that control what a samba client user can do:
    (1) Linux Permissions
    (2) Samba Authorizations

    You can use one, or the other, or both depending on how you set up the share to accomplish the task. The only requirement is that the Linux permissions must be greater than or equal to the authorizations you set in Samba. If you set the Linux permissions on a shared folder to 777 allowing everyone access but use "valid users = morbius1" in your share definition only morbius1 will have access. If you set Linux permissions to 700 and allow everyone guest access in your share definition no one will have access. The two different mechanisms must cooperate.

    ***
    Could someone also explain some these codes, I copied the from somewhere but could not remember where the explanation of it was.

    [Downloads]
    comment = Downloads
    path = /home/User01/Downloads
    writeable = yes
    ; browseable = yes
    valid users = User01

    What does browseable = yes do to that folder on the network?
    What does the ";" at the beginning of the line do?
    "browseable" makes the share visible on the network. It's the default for all shares in samba so that's why it has a ";" in front of it.

    *** A note on the following HowTo: https://help.ubuntu.com/community/FilePermissions

    I've become convinced that there is no peer review at that site. From the HowTo:
    To change all the permissions of each file and folder under a specified directory at once, use sudo chmod with -R
    Code:
    user@host:/home/user$ sudo chmod 777 -R /path/to/someDirectory
    Don't ever do that. Doing so will make every single file executable to everyone. A better way:
    Code:
    sudo chmod -R a+rwX /path/to/someDirectory
    Note: That's a big X in rwX. With that command all folders will be set to 777 and all files will be set to 666 except those that were executable to begin with. Folders need to be set to be executable to be opened to see what's inside but only those files that you want to be executable should be made so.
    Last edited by Morbius1; December 15th, 2013 at 03:06 PM.

  9. #9
    Join Date
    Aug 2011
    Beans
    12

    Re: Ubuntu multiple network folder share with permission to Windows 7

    *** There are two different mechanisms that control what a samba client user can do:
    (1) Linux Permissions
    (2) Samba Authorizations

    You can use one, or the other, or both depending on how you set up the share to accomplish the task. The only requirement is that the Linux permissions must be greater than or equal to the authorizations you set in Samba. If you set the Linux permissions on a shared folder to 777 allowing everyone access but use "valid users = morbius1" in your share definition only morbius1 will have access. If you set Linux permissions to 700 and allow everyone guest access in your share definition no one will have access. The two different mechanisms must cooperate.

    ***
    That clears up how samba and linux permissions work, and how to configure Samba to share network folder with window users. Thanks againMorbius1 for your help with setting this Samba network share. This Samba shae is now working, and I will update this thread, and the first post with a summary of how I setup the Samba share.

    Regards
    Snooze101

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •