File permissions on new external usb drive

Hi - I just installed a new exfat external usb drive on my headless ubuntu machine running plex server. After some trials and errors Plex can now access the media on the new drive. My problem is that I do not seem to have access to update the drive. The media files were copied using a windows box. But when I try to add anything to the drive on linux (through putty or via ftp) I get permission denied. I’ve tried several things but I cannot seem to get the permissions correct. I know this is not specifically a plex issue but I am hoping someone can help me a bit.
Thank you!
Jim

(HDDRIVE 3 is the drive with the issue)
drwxrwxrwx 1 root root 8192 Dec 27 15:45 hddrive1
drwxrwxrwx 6 root root 4096 Dec 14 14:10 hddrive2
drwxr-xr-x 7 root root 262144 Dec 31 08:58 hddrive3

specifically -

Thank you - unfortunately no success. I created a new directory and did all the permissions but I am still facing the same issue. Plex sees it and can load media to the library, but cannot do anything else. The only way for me to load media to the disk would be to connect it to my windows box and copy it. Can I assume the instructions for a an ext4 would be the same as exfat? Thanks again! Jim

drwxr-xr-x 7 root root 262144 Dec 31 10:42 hddrive3
plex@plex2:/disks$

Please show me

  1. The file permissions for the mount points – with the USB drives unmounted (important)

  2. /etc/fstab entries to perform the mounts.

  3. ls -la of the top directory of each drive after mounting.

Thank you - I really appreciate the help!

unmounted permissions
drwxr-xr-x 2 root root 4096 Oct 29 2020 hddrive1
drwxrwxrwx 6 root root 4096 Dec 14 14:10 hddrive2
drwxr-xr-x 2 plex plex 4096 Dec 31 10:38 hddrive3 (this is the new mounting point)
drwxr-xr-x 2 root root 4096 Dec 30 18:51 hddrive3 (this was the original mounting point - removed from fstab)

fstab -

UUID=384C1D8D4C1D4752 /media/hddrive1 auto nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=5163-7F01 /media/hddrive2 auto nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=619D-E596 /disks/hddrive3 auto nosuid,nodev,nofail,x-gvfs-show 0 0

ls -la on top directory:
drwxr-xr-x 5 root root 4096 Dec 30 18:51 .
drwxr-xr-x 21 root root 4096 Dec 31 10:38 …
drwxrwxrwx 1 root root 8192 Dec 27 15:45 hddrive1
drwxrwxrwx 6 root root 4096 Dec 14 14:10 hddrive2
drwxr-xr-x 2 root root 4096 Dec 30 18:51 hddrive3 (old directory - not currently mounted)

drwxr-xr-x 2 root root 4096 Dec 30 18:51 hddrive3 (new directory - mounted)

For

UUID=384C1D8D4C1D4752 /media/hddrive1 auto nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=5163-7F01 /media/hddrive2 auto nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=619D-E596 /disks/hddrive3 auto nosuid,nodev,nofail,x-gvfs-show 0 0

may i suggest:

UUID=384C1D8D4C1D4752 /disks/hddrive1 auto defaults,auto,nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=5163-7F01 /disks/hddrive2 auto defaults,auto,nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=619D-E596 /disks/hddrive3 auto defaults,auto,nosuid,nodev,nofail,x-gvfs-show 0 0
  1. You still had hddrive 1 & 2 in /media
  2. You didn’t have it start with default mount options (which includes permissions)
  3. automount wasn’t guaranteed (some distros behave differently)

As for the mount points (before and after)

Directory permissions are 755. Your username can own them. Plex only neeeds the ‘5’ permission so it can read & traverse the directories.

Thank you - still no success. hddrive2 is missing (not mounted for some reason?) and everything else is unchanged. This is the output from ls -la.

drwxrwxrwx 1 root root 8192 Dec 27 15:45 hddrive1
drwxr-xr-x 7 root root 262144 Dec 31 13:41 hddrive3

ok… time to get ugly

  1. Comment out the record in /etc/fstab for HDDRIVE2

  2. Unmount it

  3. Unplug it

  4. Wait 1 minute

  5. Plug it back in

  6. Gnome will mount it for you.

  7. Command line (Terminal window)

  8. df command – see what device it is /dev/sd??

  9. now let’s see what is happening with the partition

sudo blkid /dev/sd??    <-- subtitute the drive letter and partition you see from df
mount | grep sd??    <-- substitute here too

Show me that output please.

ok - linux says hddrive2.

plex@plex2:/media$ umount hddrive2
umount: /media/hddrive2: not mounted.

It looks like it is not being mounted automatically:

plex@plex2:/media$ df
Filesystem                         1K-blocks       Used  Available Use% Mounted on
udev                                 1911656          0    1911656   0% /dev
tmpfs                                 391328       2840     388488   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  205375464  107181096   87692224  56% /
tmpfs                                1956624          4    1956620   1% /dev/shm
tmpfs                                   5120          0       5120   0% /run/lock
tmpfs                                1956624          0    1956624   0% /sys/fs/cgroup
/dev/sda2                             999320     206624     723884  23% /boot
/dev/loop0                             56832      56832          0 100% /snap/core18/2246
/dev/loop1                             56832      56832          0 100% /snap/core18/2253
/dev/loop2                             63360      63360          0 100% /snap/core20/1242
/dev/loop3                             63488      63488          0 100% /snap/core20/1270
/dev/sdb2                         3906729984  916508672 2990221312  24% /disks/hddrive3
/dev/loop5                             68864      68864          0 100% /snap/lxd/21835
/dev/loop4                             68864      68864          0 100% /snap/lxd/21803
/dev/loop7                             44416      44416          0 100% /snap/snapd/14295
/dev/loop6                             43264      43264          0 100% /snap/snapd/14066
/dev/sdd1                         3906982908 2426846388 1480136520  63% /disks/hddrive1
tmpfs                                 391324          0     391324   0% /run/user/1000

I don’t see if listed here… but ir shows up in blkid:

plex@plex2:/media$ sudo blkid
/dev/sda2: UUID="8e345ba7-29bb-49e2-9e85-d4fcf79f2612" TYPE="ext4" PARTUUID="f5705197-21ef-4a6e-92c8-20b24d037b9                                       0"
/dev/sda3: UUID="PYLeIc-g7uV-zbDh-PjAy-Dbyh-RIwB-G5L3U1" TYPE="LVM2_member" PARTUUID="7a9e115c-55bd-4bab-8435-98                                       75a746cf1f"
/dev/sdc1: LABEL="My Passport" UUID="C0E63369E6335F3A" TYPE="ntfs" PARTUUID="5b6ac646-01"
/dev/sdd1: LABEL="Living Room" UUID="384C1D8D4C1D4752" TYPE="ntfs" PTTYPE="atari" PARTLABEL="My Passport" PARTUU                                       ID="f02f4d18-4d2c-43d9-b924-4d018d441421"
/dev/sdb1: LABEL_FATBOOT="EFI" LABEL="EFI" UUID="67E3-17ED" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUI                                       D="6ba6e9c3-b2d9-4df5-8cda-f54e585e9ebc"
/dev/sdb2: LABEL="One Touch" UUID="619D-E596" TYPE="exfat" PARTUUID="b6d54747-15a8-4a91-a7fd-8895a32611d8" 
/dev/mapper/ubuntu--vg-ubuntu--lv: UUID="53b14cec-0d37-40c5-8621-e70c50e6b3b6" TYPE="ext4"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/sda1: PARTUUID="4dff4deb-7f77-464b-923e-5ed8881aa7c9"

/dev/sdc1: LABEL="My Passport" UUID="C0E63369E6335F3A" TYPE="ntfs" PARTUUID="5b6ac646-01"

plex@plex2:/media$ mount | grep sdc1
plex@plex2:/media$ 

Hope that helps! Thanks again! Jim

There it is.

/dev/sdc1 = Passport drive, formatted as NTFS

try sudo mount /dev/sdc1 /mnt
See if it mounts there.

If it’s flagging as dirty then use ntfsfix

Odd because the drive was flagged as exfat on windows…admittedly I’m way out of my knowledge area here -

It did mount - tried to run ntfsfix but received this msg: plex@plex2:/media/hddrive2$

ntfsfix -d /dev/sdc1
Refusing to operate on read-write mounted device /dev/sdc1.

You can’ run fix while it’s mounted.

Windows is vastly different in that it unmouts the drive then runs the check then remounts it. Linux is literal

  1. sudo umount /mnt
  2. sudo ntfsfix /dev/sdc1
  3. sudo mount /dev/sdc1 /mnt

Excellent! Worked great. Where should I go from here? Thx!

now you can do

sudo umount /mnt
sudo blkid /dev/sdc1

This gives you the UUID (which should match what you commented out in /etc/fstab)

remove the comment marker

refer to the mount by the target directory name

sudo mount /disks/hddrive3

(if i remember correctly)

The differing behavior between the disks is due to the difference in the default umask between the two filesystems (NTFS and ExFAT) on Linux. For NTFS-3G, the default umask is 0000; for ExFAT it’s the umask of the current process (likely 0022).

These are mask values and are applied at file or directory creation time. For example, for a directory which would be created with 0777 permissions (read, write, execute for everyone) on a file system with a umask of 0022, the effective permissions would be 0755 (read, write, execute for the owner, read and execute for group members and others).

This corresponds with what you’re seeing above; your NTFS disks are mounted with effective permissions of 0777 (0777 - 0000) while your ExFAT disk is mounted with effective permissions of 0755 (0777 - 0022).

The easiest way to “fix” this if you want the behavior of your ExFAT disk to match that of the NTFS disks is to mount it with a umask of 0000. To do this, you’d add the umask option to your mount options. Something like:

UUID=619D-E596 /disks/hddrive3 auto nosuid,nodev,nofail,umask=0000,x-gvfs-show 0 0

A more nuanced approach than making the disk world-writeable would be to give ownership of the mount to a specific user and group, and then use that user and group to manage the content of the disk. You can set ownership with the uid and gid mount options. In combination with the umask option:

UUID=619D-E596 /disks/hddrive3 auto nosuid,nodev,nofail,uid=your_user,gid=your_user,umask=0002,x-gvfs-show 0 0

This would give ownership to your user and group and allow that user and group read, write, and execute permissions. Others could only read/execute.

But, again, the easy solution would be the first one and just make it world-writeable; your NTFS disks already are and it would certainly ease management from a Windows system.

Perfect! That worked beautifully! Thank you both for your help! Jim

No problem, glad you got it working!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.