Page 4 of 5 FirstFirst ... 2345 LastLast
Results 31 to 40 of 45

Thread: Take ownership of a drive

  1. #31
    Join Date
    Jul 2008
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Take ownership of a drive

    Quote Originally Posted by Morbius1 View Post
    I hope no one minds my usual interjection of comic relief but what further complicates this discussion is the unfortunate choice of /media/tim/moutpoint for the mountpoint location.

    Look at the permissions of /media/tim ( remember this is Ubuntu 13.04 ) - and don't do it with a "ls -dl /media/tim" you will get the wrong answer, do it this way:
    Code:
    getfacl -t /media/tim
    Only "tim" has access to that directory meaning only "tim" will have access to anything beyond it - doesn't matter what permissions are on the mount point itself.

    Irrelevant side note at this point
    : this line in fstab did exactly what you told it to do:

    umask, fmask, dmask represent permissions that you want removed from the mounted partition - not the permissions you want it to have. A newborn ntfs partition has all permissions set to 777 for both files and folders so what you told it to do is mount with folder permissions of:

    777 - 775 = 002

    You will have a directory that has no permissions at all for user and group and this odd write permissions for others which is what you ended up with.
    I saw the error with dmask and fmask and corrected it in my first directive. The OP is aware via PM.

  2. #32
    Join Date
    Dec 2009
    Beans
    5,375

    Re: Take ownership of a drive

    Quote Originally Posted by redmk2 View Post
    I saw the error with dmask and fmask and corrected it in my first directive. The OP is aware via PM.
    I did not see that until this very minute - a thousand apologies.

  3. #33
    squakie is offline Chocolate-Covered Ubuntu Beans
    Join Date
    Oct 2012
    Beans
    2,238
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Take ownership of a drive

    Quote Originally Posted by redmk2 View Post
    ....You (as root) can make mount points where ever you want in the file system. You can provide any owner to the mount point as long as you also provide at least read and execute (r-X) to the users "others" on the mount point. That way the all users will have access to that directory (mount point). On the other hand, if you don't specify the owner (UID/GID) and the explicit umask (fmask and dmask) when mounting an NTFS partition you may not have ownership and permissions as you expect them to be and you can't change them on the fly with chmod and chown.
    Just my opinion: between this and using /media for a mount point - which to me is not the wisest of ideas, you're over complicating a simple task, and not one most newbies will follow. if you look at my post I mentioned using chmod and chown of the mount point, in what ever permissions you want. Not on the fly - on a permanent mount point/folder. Once done, it's done. No need to complicate with the expanded fstab entry. I do this with all of my NTFS external drives, and a NTFS partition on an internal drive should be no different, and it works fine, thank you. I suggested a completely different mount point because then you can mount to a folder name that is more descriptive - the suggestion I gave was only an example.

    I also may have missed it, so I'm just putting this out there in case it's not there, but best to mount by uuid if a separate disk. I do this with external USB drives so that another device doesn't come along - such as a USB flash, or a second (or whatever) internal drive installed - as this messes with the /dev/xxxx names. Again, just didn't see if that was mentioned.

  4. #34
    Join Date
    Jul 2009
    Beans
    471

    Re: Take ownership of a drive

    Thanks for the assistance everyone. So let me give you more details on what i want to do. There is a program called Plex. Its streams movies from your pc to multiple devices. I installed the app and have read that in order for Plex to se my movie drives, it needs certain permissions. I have been reading up on this for the past few days. I found these two threads and posted in them.
    http://ubuntuforums.org/showthread.php?t=2159071
    http://ubuntuforums.org/showthread.php?t=2087341

    I tried to follow the directions in the threads, but have had no success. So, here is what i have in fstab, and here is a look at my drives.
    Code:
    tim@tim:/media/tim$ ls -l
    total 484
    drwx------ 2 root root 4096 Aug 16 22:18 Buffalo 1.5tb
    drwx------ 1 tim tim 28672 Aug 31 01:33 Buffalo 1.5tb1
    drwx------ 2 root root 4096 May 6 16:52 Buffalo 3.0
    drwx------ 2 root root 4096 Aug 16 22:18 Buffalo 3.01
    drwx------ 1 tim tim 430080 Aug 31 11:00 Buffalo 3.02
    drwxrwxr-x 1 tim tim 8192 May 26 16:54 Home
    drwx------ 2 root root 4096 May 31 19:49 Iomega 3.0
    drwxrwxrwx 2 tim tim 4096 Apr 27 13:04 Media
    drwxrwxrwx 5 tim plugdev 4096 Aug 31 12:12 Movies
    drwxrwxrwx 1 root root 4096 May 25 19:55 WD
    In the above, i only want the drives Movies and Home to be visible in Plex.

    Code:
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    # / was on /dev/sdd1 during installation
    UUID=caf7e20c-a0ed-46aa-a264-a7611c34a711 /               ext4    errors=remount-ro 0       1
    # swap was on /dev/sdd5 during installation
    UUID=b0eae91a-301f-4f28-b770-1dd2705f75df none            swap    sw              0       0
    /dev/sr1        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
    /dev/sdc1 /media/tim/WD ntfs defaults 0 0
    ## /dev/sda1 /media/tim/Home ntfs defaults 0 0
    UUID="F2ACF216ACF1D557" /media/tim/Home ntfs rw,uid=1000,gid=1000,fmask=002,dmask=002       0      0
    Code:
    tim@tim:~$ sudo fdisk -l
    
    
    Disk /dev/sda: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x19ad14d7
    
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048   976769023   488383488    7  HPFS/NTFS/exFAT
    
    
    Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/sdb doesn't contain a valid partition table
    
    
    Disk /dev/sdc: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0009f891
    
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1   *        2048   976773119   488385536    7  HPFS/NTFS/exFAT
    
    
    Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
    255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xd8f3c04b
    
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdd1   *        2048  1953521663   976759808    7  HPFS/NTFS/exFAT
    
    
    Disk /dev/sde: 128.0 GB, 128035676160 bytes
    255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00051a0e
    
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sde1   *        2048   224921599   112459776   83  Linux
    /dev/sde2       224923646   250068991    12572673    5  Extended
    /dev/sde5       224923648   250068991    12572672   82  Linux swap / Solaris
    
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdf'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    
    
    Disk /dev/sdf: 750.2 GB, 750156374016 bytes
    255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdf1               1  1465149167   732574583+  ee  GPT
    
    
    Disk /dev/sdg: 1499.7 GB, 1499651727360 bytes
    255 heads, 63 sectors/track, 182322 cylinders, total 2929007280 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00078baf
    
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdg1              63  2929002929  1464501433+   7  HPFS/NTFS/exFAT
    
    
    Disk /dev/sdm: 640.1 GB, 640135028736 bytes
    255 heads, 63 sectors/track, 77825 cylinders, total 1250263728 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000eaa56
    
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdm1              63  1250258624   625129281    7  HPFS/NTFS/exFAT
    
    
    Disk /dev/sdn: 1499.6 GB, 1499598946304 bytes
    255 heads, 63 sectors/track, 182315 cylinders, total 2928904192 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00096e74
    
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdn1            2048  2928904191  1464451072    7  HPFS/NTFS/exFAT
    PC Specs: Asus P6X58D Premium - Intel Core i7 930 - XFX Radeon 5750 HD Video Card - 12gb DDR3 Corsair XMS3 - (internal)750gb WD 6.0gbps - 1tb WD Green Caviar - NZXT Tempest Case - Dell 24" 1080p HD Monitor - Dell Stereo Soundbar.

  5. #35
    squakie is offline Chocolate-Covered Ubuntu Beans
    Join Date
    Oct 2012
    Beans
    2,238
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Take ownership of a drive

    Again, you only need to do this once - it can't hurt to try, right?

    - create a new folder wherever you want - I choose something in /home because then I don't have to worry about anyone having permissions into another folder I don't want:

    sudo mkdir /home/mymedia

    - now just change the permissions to what ever you want - if you don't mind anyone on your PC (usually I don't care since I'm the only one that uses it), you can just set to read/write for everyone:

    sudo chown <your userid here> /home/mymedia

    sudo chmod 777 /home/mymedia

    the above would make you owner of the /home/mymedia folder, and give everyone read/write/execute priviledges to it - you can adjust this as you see fit

    - be sure the ntfs-3g "things" are all installed

    You now have a permanent mount point (the /home/mymedia folder) that you own and that everyone has full access to. You only need to this once -that's it. In the future, if you need to adjust ownership or permissions you can do so.

    Now we need to know the unique univeral name for the partition or external device your media files are on:

    sudo blkid

    I tried to keep this sample simple, so I only have one NTFS partition mounted:

    dave@dwezbox1:~$ sudo blkid
    [sudo] password for dave:
    /dev/sda1: UUID="04fcfb33-42ed-40ab-8588-2d80e628700f" TYPE="ext4"
    /dev/sda5: UUID="b7f5fe57-8dcd-4da8-8926-b206707ec970" TYPE="swap"
    /dev/sr0: LABEL="SARARI_RIVER_SIMON_SECRET_JUNG^_" TYPE="udf"
    /dev/sdb1: LABEL="xbmc-shares" UUID="3B426B086C5EFD27" TYPE="ntfs"
    dave@dwezbox1:~$

    As you can hopefully see, in this case /dev/sdb1 is an NTFS file system.

    Now, highlight, right click and click copy for the portion of that line starting at UUID= and to the end of the line.


    - Now we need to tell the system that whenever that UUID is found we want to mount it to the permanent mount point we created - in this case /home/mymedia. We do this by modifying the file system table, fstab:

    sudo cp fstab fstab-save (it's wise to create a backup of your original fstab, but don't overwrite it later!)

    gksudo gedit fstab

    - remove any of the entries you previously made to try to get this to work
    - go to the end of the file
    - right-click and click paste
    this will copy in the uuid and file system type from what was copied from the blkid output

    - now modify that line, adding what is new and removing the quotes. With my example it would be as follows, but you'll need to be sure to use your UUID and your mount point (/home/mymedia):

    UUID=3B426B086C5EFD27 /home/shares TYPE=ntfs defaults 0 0

    Save the file and exit, then reboot.

    You should now be able to:

    ls -al /home/mymedia

    and see your media files, their ownership and their permissions. What's at the folder level is what should matter: /home/mymedia. If the program you are using needs other access, it should be covered by the 777 permissions (everyone read/write/execute), but you can modify them as need via the command line "chmod". Similarly, if the ownership needs to change, you can do that via the command line "chown".

    Remember, you only need create the mount point (/home/mymedia) ONCE. You need only set the permissions ONCE. You (should) only need to change fstab ONCE. From then on everything should work. The beauty with this is that you are setting permissions and ownership from the command line, not in an fstab entry you may need to change (and reboot). You can modify those permissions and ownership anytime you want.

    I won't promise this will solve your problem - I need to go follow the links you posted to see what all they say.

    But, as I said - it can't hurt to try!

    All we've done is create a permanent mount point ONCE, with permissions explicitly declared ONCE, mounted the file system to that mount point.
    Last edited by squakie; August 31st, 2013 at 11:59 PM. Reason: fat-fingered a few things

  6. #36
    squakie is offline Chocolate-Covered Ubuntu Beans
    Join Date
    Oct 2012
    Beans
    2,238
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Take ownership of a drive

    Also, be sure to follow this advice that was in one of the above threads, The commands you would type in a terminal window are shown in the post:


    • January 16th, 2013 #8
      jualin
      Dark Roasted Ubuntu


      Join DateJul 2007Beans1,062DistroUbuntu Development Release


      Re: Plex media Server cannot find media
      ...As others have mentioned in other forums the problem is that the "plex" user doesn't belong to the "plugdev" group which is the only group that has access to the mounted devices.



      All you need to do is to add plex to that group by using gpasswd
      Code:
      sudo gpasswd -a plex plugdev
      To check that the "plex" user belongs to that group we can issue the following command:
      Code:
      groups plex
      Which should display something like: plex: plex plugdev

      Restart your computer and try to access the mounted media with Plex Media Manager. If for some reason that doesn't work then you might need to add plex to your own user group. Some may consider this a bit risky since plex would be able to do almost anything that your user (in my case "jualin") can do.
      Either way, we use gpasswd again:
      Paraphras: "The terminal command line is:"

      sudo gpasswd -a plex yourUS

      >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

      From me: it appears (I've never used it - I use xbmc) that when plex installs it create a user "plex". It also appears you need to add that user to the plugdev group as shown. The command for doing this is shown, but I'll repeat it here:

      sudo adduser plex plugdev


      The permissions we gave the mount point (/home/mymedia) *should* work, but in case plex for some reason expects to own that mount point, just change the ownership with something like this:

      sudo chown plex /home/mymedia

      - text removed here -

      As I mentioned, I use xbmc, and all of my ntfs partitions are mounted to various folders as I have described in my post prior to this, and I never have a problem with permissions.

      I'm also not sure if adding the user plex to the plugdev group is really needed in your case, since I believe that is only needed if you are using an external device such as a USB disk drive, but it won't hurt.

      Also, your output shows plugdev as the group the mount point belongs to. If that is really needed (you'll just have to try and see what happens), just do the following:

      sudo chgrp plugdev /home/mymedia

    Last edited by squakie; September 1st, 2013 at 12:27 AM.

  7. #37
    Join Date
    Dec 2009
    Beans
    5,375

    Re: Take ownership of a drive

    Quote Originally Posted by squakie View Post
    Just my opinion: between this and using /media for a mount point - which to me is not the wisest of ideas, you're over complicating a simple task, and not one most newbies will follow. if you look at my post I mentioned using chmod and chown of the mount point, in what ever permissions you want. Not on the fly - on a permanent mount point/folder. Once done, it's done. No need to complicate with the expanded fstab entry. I do this with all of my NTFS external drives, and a NTFS partition on an internal drive should be no different, and it works fine, thank you. I suggested a completely different mount point because then you can mount to a folder name that is more descriptive - the suggestion I gave was only an example.

    I also may have missed it, so I'm just putting this out there in case it's not there, but best to mount by uuid if a separate disk. I do this with external USB drives so that another device doesn't come along - such as a USB flash, or a second (or whatever) internal drive installed - as this messes with the /dev/xxxx names. Again, just didn't see if that was mentioned.
    I stopped reading your post as soon as I saw the line highlighted above. Changing permissions of a mountpoint before the partition is mounted has no affect on the permissions of the partition after it's mounted. That's true if the partition being mounted is NTFS or EXT4. For EXT4 partitions you change the permissions after it's mounted but for NTFS you have to specify permissions in the fstab expression as it is mounted - even if all you do is specify the "defaults" option..

    You don't have to take my word for it: Unmount the ntfs partition and change permissions of the mount point ot 700 then remount the partition with a "sudo mount -a". Since you specified only defaults in fstab it will mount with permissions of 777.

  8. #38
    Join Date
    Jul 2008
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Take ownership of a drive

    Quote Originally Posted by Morbius1 View Post
    I stopped reading your post as soon as I saw the line highlighted above. Changing permissions of a mountpoint before the partition is mounted has no affect on the permissions of the partition after it's mounted. That's true if the partition being mounted is NTFS or EXT4. For EXT4 partitions you change the permissions after it's mounted but for NTFS you have to specify permissions in the fstab expression as it is mounted - even if all you do is specify the "defaults" option..

    You don't have to take my word for it: Unmount the ntfs partition and change permissions of the mount point ot 700 then remount the partition with a "sudo mount -a". Since you specified only defaults in fstab it will mount with permissions of 777.
    +1

  9. #39
    squakie is offline Chocolate-Covered Ubuntu Beans
    Join Date
    Oct 2012
    Beans
    2,238
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Take ownership of a drive

    So be it - all I know is that this all works for me. If the partition is getting mounted with all permissions for everyone, it would still accomplish what I put in my post. However, since everyone wants to shoot down everything I say here, even though THEIR solution didn't work, so be it. You tell the user to add user plex to the plugdev group and see how it works - that is of course if you want to actually TRUST that something I posted IS correct. If you don't, and plex isn't member of that group, and if permissions aren't set correctly (you did read the 2 links the OP posted, right), and you still get it to work - congradulations, you've discovered the key to a mystery for many people. Hopefully you'll word it and provide answers in a way they can understand.

    As fo me - I'm out of here (yeah I hear you saying "thank God"). Lotsa luck.

  10. #40
    Join Date
    Dec 2009
    Beans
    5,375

    Re: Take ownership of a drive

    Movies has read/write access to everyone and Home has at least read access by everyone. So far so good:
    drwxrwxrwx 5 tim plugdev 4096 Aug 31 12:12 Movies
    drwxrwxr-x 1 tim tim 8192 May 26 16:54 Home
    Me thinks it's not the partition or their permissions but where they are mounted that's the problem:
    /media/tim/Movies
    /media/tim/Home
    Would you mind posting the output of the following command:
    Code:
    getfacl -t /media/tim
    We need to verify that the output looks something like this:
    getfacl: Removing leading '/' from absolute path names
    # file: media/tim
    USER root rwx
    user tim r-x
    GROUP root ---
    mask r-x
    other ---
    If it does look like the above then that's the problem. Access to an object in Linux is done through the path to that object and /media/tim is preventing everyone except root and "tim" from getting to whatever is beyond it. /media/tim is a system generated folder and is new since the LTS version of Ubuntu. If this were a Samba question there is a way around this problem but if this plex thing is a local process then I would suggest changing your mount point so that it's not under /media/tim:

    Unmount the Movies and Home partitions:
    Code:
    sudo umount /media/tim/Movies
    sudo umount /media/tim/Home
    Create new mountpoints one level up from where they are now:
    Code:
    sudo mkdir /media/Movies
    sudo mkdir /media/Home
    Change your fstab entries to reflect this new mount point then run the following command to mount these partitions to their new home:
    Code:
    sudo mount -a
    If you have further difficulties of any sort please post the output of the following command so we can make specific recommendations to the fstab entries:
    Code:
    sudo blkid -c /dev/null
    Last edited by Morbius1; September 1st, 2013 at 03:05 PM.

Page 4 of 5 FirstFirst ... 2345 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
  •