Page 1 of 5 123 ... LastLast
Results 1 to 10 of 45

Thread: Force file permissions inside a directory

  1. #1
    Join Date
    Jun 2011
    Beans
    23
    Distro
    Ubuntu

    Force file permissions inside a directory

    Here's my situation:
    I have an Ubuntu Server (12.04) that I'm running as an FTP and Samba file server. I have 5+ users adding/using files on the server. There are certain folders that I want everyone to use/see everything inside of. These are kind of "public" folders.
    Problem:
    File permissions are set client side during a transfer, not server side. So, by default, the files placed in these "public" folders are only accessible to the owner.
    Solution:
    I want to make it so that these permissions are set by the server. That is, any files place inside of these "public" folders will automatically be given rwx permissions for everyone, regardless of what options were set by the FTP client.

    Is there any way to do what I've described above? Thanks!

  2. #2
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Force file permissions inside a directory

    Quote Originally Posted by AbsenteeSurgeon View Post
    Here's my situation:
    I have an Ubuntu Server (12.04) that I'm running as an FTP and Samba file server. I have 5+ users adding/using files on the server. There are certain folders that I want everyone to use/see everything inside of. These are kind of "public" folders.
    By everyone , do you mean just these 5 users or to you mean any user logged in to the Samba server (other)?
    Problem:
    File permissions are set client side during a transfer, not server side. So, by default, the files placed in these "public" folders are only accessible to the owner.
    I don't believe that the permissions are set at the client side. The permissions are set at the Samba server side, by the OS utimatly.
    Solution:
    I want to make it so that these permissions are set by the server. That is, any files place inside of these "public" folders will automatically be given rwx permissions for everyone, regardless of what options were set by the FTP client.

    Is there any way to do what I've described above? Thanks!
    Sure there is. Once again; do you mean rw permissions for the 5 users or do you really mean everyone (e.g. others). The term others in Linux means everyone. There are either user, group or other entities.
    -BAB1

  3. #3
    Join Date
    Jun 2011
    Beans
    23
    Distro
    Ubuntu

    Re: Force file permissions inside a directory

    Sorry for not being specific enough. By "everyone", I mean the "others" entity in Linux. By permissions being set client side, I meant for files being transferred over FTP. And I'm not necessarily talking just about Samba permissions, but also about the file permissions on the Ubuntu server itself.

  4. #4
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Force file permissions inside a directory

    Quote Originally Posted by AbsenteeSurgeon View Post
    Sorry for not being specific enough. By "everyone", I mean the "others" entity in Linux.
    I don't think you want to do that. The only way I know to do that using the rwx permissions is by altering the other settings with umask . It would be far better to put all mortal (regular) users in a group that would allow rw use.
    By permissions being set client side, I meant for files being transferred over FTP. And I'm not necessarily talking just about Samba permissions, but also about the file permissions on the Ubuntu server itself.
    If I understand correctly; you want to have a directory(s) and subdirectories that would allow access to those files for all mortal users.

    You can provide an entire branch of any portion of file system that all users in the group would have access to, As I said before the best way is to add all those users to a group and allow that group access to the files. The root folder of this would look something like this from the terminal
    Code:
    drwxrwsr-x 3 root users 4.0K 2011-04-11 20:58 files
    If this is what you want then we can do that. I am being picky and trying to get you to think about hierarchy in the file system. The proper way to have multiple user file access is by controlling the group entity permissions.
    -BAB1

  5. #5
    Join Date
    Jun 2011
    Beans
    23
    Distro
    Ubuntu

    Re: Force file permissions inside a directory

    I agree with you that it's a good idea to change to group permissions instead of "others" permissions, thanks for the suggestion.

    The root folder is set up with permissions "drwxrwxrwx". The problem is that when users upload files over FTP, the files they upload have their own permissions, namely "drwx------".

    I know how to change this on the server, and I know how to change permissions when uploading files myself. However, it would be super convenient if all of the file permissions inside of this root folder were automatically changed to "drwxrw----".

  6. #6
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Force file permissions inside a directory

    Quote Originally Posted by AbsenteeSurgeon View Post
    I agree with you that it's a good idea to change to group permissions instead of "others" permissions, thanks for the suggestion.

    The root folder is set up with permissions "drwxrwxrwx". The problem is that when users upload files over FTP, the files they upload have their own permissions, namely "drwx------".
    Can you post the terminal output of this so I can see it?

    I know how to change this on the server, and I know how to change permissions when uploading files myself. However, it would be super convenient if all of the file permissions inside of this root folder were automatically changed to "drwxrw----".
    The automatically wish is doable with the sgid bit set on the permissions. But first let's get specific now. how many users are there and how many are going to be in the group we create (use)? What is the directory structure you are going to use? In a general way what are you using this for; web root or ...?

    Once I have a better understanding, I can give you the specific commands to use to achieve this goal.
    Last edited by bab1; May 15th, 2012 at 08:40 PM.
    -BAB1

  7. #7
    Join Date
    Jun 2011
    Beans
    23
    Distro
    Ubuntu

    Re: Force file permissions inside a directory

    Using stock FTP client options, here's what uploaded files look like:

    Code:
    -rw------- 1 {username} users 147756752 May 15 10:38 {filename}
    There will be a total of 8 users in the "users" group. This is being used as a file exchange/storage server for all eight of us. There are two hard drives that are the main communal storage drives, called them "Black 1" and "Black 2". They are both mounted to "/media/". All of this file exchanging will be happening over FTP, rarely will anyone be logged into the machine.

    I'm also planning on sharing these files over Samba, but that's a secondary concern of mine. I imagine that once these permissions are sorted out, everything relating to Samba will fall right into place.

  8. #8
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Force file permissions inside a directory

    Quote Originally Posted by AbsenteeSurgeon View Post
    Using stock FTP client options, here's what uploaded files look like:

    Code:
    -rw------- 1 {username} users 147756752 May 15 10:38 {filename}
    There will be a total of 8 users in the "users" group. This is being used as a file exchange/storage server for all eight of us. There are two hard drives that are the main communal storage drives, called them "Black 1" and "Black 2". They are both mounted to "/media/". All of this file exchanging will be happening over FTP, rarely will anyone be logged into the machine.

    I'm also planning on sharing these files over Samba, but that's a secondary concern of mine. I imagine that once these permissions are sorted out, everything relating to Samba will fall right into place.
    Creeping up to the answer...

    What is the output of this
    Code:
    umount
    Post the output of
    Code:
    ls -alt /media/
    I assume that each drive will have one partition (using the entire drive)

    As you say we can deal with Samba later.
    -BAB1

  9. #9
    Join Date
    Jun 2011
    Beans
    23
    Distro
    Ubuntu

    Re: Force file permissions inside a directory

    Quote Originally Posted by bab1 View Post
    What is the output of this
    Code:
    umount
    .
    Code:
    Usage: umount -h | -V 
           umount -a [-d] [-f] [-r] [-n] [-v] [-t vfstypes] [-O opts] 
           umount [-d] [-f] [-r] [-n] [-v] special | node...
    Quote Originally Posted by bab1 View Post
    Post the output of
    Code:
    ls -alt /media/
    I assume that each drive will have one partition (using the entire drive)
    Code:
    drwxr-xr-x  6 root  root 4096 May 15 15:14 . 
    drwxr-xrwx  7 scott root 4096 May 15 10:58 1TB Black 2 
    drwxr-x--- 20 scott root 4096 May 14 22:42 2TB Green 
    drwxr-xrwx  6 scott root 4096 May 14 22:42 1TB Black 1 
    drwxr-xr-x 23 root  root 4096 May 14 19:02 .. 
    drwxr-xr-x  2 root  root 4096 May 14 17:34 cdrom
    Each hard drive indeed has one partition covering the entire drive. The 2TB Green drive is one that I plan to private to myself and not to include in the sharing.

  10. #10
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Force file permissions inside a directory

    Sorry there. I was distracted when I asked. I really wanted the output of
    Code:
    umask
    Here is what I get
    Code:
     umask
    0002
    -BAB1

Page 1 of 5 123 ... LastLast

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
  •