How to change default mount permissions? [SOLVED]

Questions about applications and software
Forum rules
Before you post please read how to get help
xerxes1986
Level 1
Level 1
Posts: 2
Joined: Mon Nov 19, 2012 4:10 pm

How to change default mount permissions? [SOLVED]

Postby xerxes1986 » Thu Jan 31, 2013 11:32 pm

Hi,

Before I installed linux mint, I had 2 ntfs partitions (windows C: and data D:), and I have installed linux mint over my old system partion (c:), but kept my data partition because it has about 500gb worth of movies on it.

I want to stream these movies via Plex (google it), but Plex cannot see the files inside the mounted data partition because the permissions are not correct. I have tried chmoding the folders and files, but that doesn't work because it is formatted in ntfs. After about 3 hours of googling I have deduced that this is because the file system isn't mounted with the correct permissions (I needed it mounted with 755, but it mounts as rwx for the user only). I also have found that the best course of action is to create a udev rule to change the way the drive is mounted when I click on it thru the file explorer (which, according to my google fu uses udisks in the background).

My question is: How do I create a udev rule such that my data partition is ALWAYS mounted as 755? Also, it would be nice if it auto-mounted on startup instead of me having to mount it by opening the folder each time.

Thanks a ton.
Last edited by xerxes1986 on Thu Feb 07, 2013 12:33 am, edited 1 time in total.

User avatar
nomko
Level 10
Level 10
Posts: 3030
Joined: Sat Feb 25, 2012 7:28 pm
Location: The Hague, The Netherlands

Re: How to change default mount permissions?

Postby nomko » Fri Feb 01, 2013 3:34 am

Can Pysdm help you with that? http://pysdm.sourceforge.net/

altair4
Level 17
Level 17
Posts: 7957
Joined: Tue Feb 03, 2009 10:27 am

Re: How to change default mount permissions?

Postby altair4 » Fri Feb 01, 2013 7:38 am

I also have found that the best course of action is to create a udev rule to change the way the drive is mounted when I click on it thru the file explorer (which, according to my google fu uses udisks in the background).

My question is: How do I create a udev rule such that my data partition is ALWAYS mounted as 755? Also, it would be nice if it auto-mounted on startup instead of me having to mount it by opening the folder each time.

Udev rule - no. Templates - yes.

Here is an ntfs template:

Code: Select all

UUID=DA9056C19056A3B3 /media/WinD ntfs defaults,nls=utf8,umask=022,uid=1000,windows_names 0 0

How to use it - this is an example:

Note: If you currently have the partition mounted unmount it.

[1] Create the mount point

Code: Select all

sudo mkdir /media/WinD

[2] Find the correct UUID for your partition:

Code: Select all

sudo blkid -c /dev/null

[3] Edit /etc/fstab as root:

Code: Select all

gksu gedit /etc/fstab

[4] Add the template above with the correct UUID and mountpoint for your system and save the file.

[5] Run the following command which will test for errors and if there are none mount the partition without requiring a reboot:

Code: Select all

sudo mount -a


Notes:
** The "windows_names" option prevents you from creating a file with a name Windows cannot interpret but is only relevant if you dual boot with Windows. Since you have no Windows OS you could remove it if you want.

** The umask parameter represents the permissions you want to remove from an NTFS partition which in it's raw state mounts to 777 when mounted by command and not through the existing udev rule. So a umask=022 does this:

777 - default permissions
022 - umask value
===
755 - Resulting permissions that you stated in your requirements

If you wanted to have full access set umask to 000: 777 - 000 = 777

I would not use PySDM, mountmanager, Disks, or any of the other utilities to do this. There is no intelligence in any of these to prevent the user from doing silly things, they don't have the current modern set of options available, and most are dangerous like ntfs-config. But of course that choice is yours.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

xerxes1986
Level 1
Level 1
Posts: 2
Joined: Mon Nov 19, 2012 4:10 pm

Re: How to change default mount permissions?

Postby xerxes1986 » Thu Feb 07, 2013 12:35 am

Worked like a charm! Thanks!


altair4 wrote:
I also have found that the best course of action is to create a udev rule to change the way the drive is mounted when I click on it thru the file explorer (which, according to my google fu uses udisks in the background).

My question is: How do I create a udev rule such that my data partition is ALWAYS mounted as 755? Also, it would be nice if it auto-mounted on startup instead of me having to mount it by opening the folder each time.

Udev rule - no. Templates - yes.

Here is an ntfs template:

Code: Select all

UUID=DA9056C19056A3B3 /media/WinD ntfs defaults,nls=utf8,umask=022,uid=1000,windows_names 0 0

How to use it - this is an example:

Note: If you currently have the partition mounted unmount it.

[1] Create the mount point

Code: Select all

sudo mkdir /media/WinD

[2] Find the correct UUID for your partition:

Code: Select all

sudo blkid -c /dev/null

[3] Edit /etc/fstab as root:

Code: Select all

gksu gedit /etc/fstab

[4] Add the template above with the correct UUID and mountpoint for your system and save the file.

[5] Run the following command which will test for errors and if there are none mount the partition without requiring a reboot:

Code: Select all

sudo mount -a


Notes:
** The "windows_names" option prevents you from creating a file with a name Windows cannot interpret but is only relevant if you dual boot with Windows. Since you have no Windows OS you could remove it if you want.

** The umask parameter represents the permissions you want to remove from an NTFS partition which in it's raw state mounts to 777 when mounted by command and not through the existing udev rule. So a umask=022 does this:

777 - default permissions
022 - umask value
===
755 - Resulting permissions that you stated in your requirements

If you wanted to have full access set umask to 000: 777 - 000 = 777

I would not use PySDM, mountmanager, Disks, or any of the other utilities to do this. There is no intelligence in any of these to prevent the user from doing silly things, they don't have the current modern set of options available, and most are dangerous like ntfs-config. But of course that choice is yours.


Return to “Software & Applications”

Who is online

Users browsing this forum: greerd, Yahoo [Bot] and 10 guests