This is a static archive of the old Zorin Forum.

The information below may be outdated. Visit the new Zorin Forum here ›

If you have registered on the old forum, you will need to create an account on the new forum.

[SOLVED] Way to Force Change File Permissions on NTFS Drive

zaster379

Sun Aug 17, 2014 7:07:55 pm

I have shortcuts to 2 text files on my dektop that I want to open up in Gedit. The files themselves are on a volume that is formatted ntfs. When I left-click on the shortcuts, I get asked, every time, whether I want to display the file or execute it. Right clicking on the files, and viewing permissions, the box where you can label the file as executable is checked. The owner is root. At first, I went into the terminal, changed to root access, and used chmod to make the files so that everyone could change them. However, doing that still doesn't let me change the permissions in Files to remove that check so that executing the file isn't an option any longer.

After looking through a lot of material on Google, I found one that said that the NTFS file system doesn't have any way to designate whether a file is executable or not so Linux was written to just assume that every file on an NTFS partition can be executable.

Does anyone know of any way around this? Maybe there's some way during the mounting of the drive where the files are?

zaster379

Wed Aug 20, 2014 8:42:50 pm

Ok, after much digging around I found an answer.

First, it wasn't that the files were in an ntfs partition that was making all the files rwx. The partition that had the txt files on them I set to mount on startup using the Disks program. It appears that by doing that, it set the permissions for all files to rwx on mounting. Also, doing that sets the ownership of all files to root. I found this out because I looked at other txt files on other ntfs partitions that were not mounted at startup. Those txt files did not have the Execute checkbox (Properties) checked. Also, the ownership was not root. However, as soon as I set the same drive to mount on startup, the ownership was changed to root and all files were then rwx. I found out that those mount settings override any changes set by chmod or chown. If you use them, they appear to work in the terminal but if you check the attributes afterwards they didn't really change. I needed to change the make sure I had ownership at mounting and that the file and directory permissions were set the way I wanted during the mount at startup.

I read that the file fstab contains the mounting options. I found tutorials for editing that file through the terminal but there's an easier way. The prgram Disks that comes with Zorin let's you do it in an easier way. When you open up Disks it will show all your drives, and all the partitions on the drive. When you highlight the partition you want (to select it), there is a button with a gear on it underneath it. If your mouse hovers over that button it will say "More Actions." Left-click on the button to get the pop up menu and in it select "Edit Mount Options". The Mount Option form pops up.

Since I had already set the partition I was working with to mount on startup, Automatic Mount Options was already set to OFF and the Mount at startup option was already checked.

There is an unlabeled section of the form that contains, by default, the commands "nosuid,nodev,nofail,x-gvfs-show" These are additional commands that are added to the fstab file. You can use this section in the form to add the additional commands we want; by adding another comma followed by the additional commands.

Again, I wanted to remove the root access to the partition and change that to me for both the user and group (I'm the only one who uses the computer). In the terminal, the command id -u will produce the user id number which was 1000.

Adding the line uid=1000,gid=1000 sets that for both the user and group access.

My problem was that I didn't want these txt files to be seen as executable. As this volume was shared with Windows, there were no files on it that I would execute within Zorin. I did want to be able to read, write and execute from the directories though. It was just the files that I wanted to set to read and write only.

Adding the lines dmask=027,fmask=137 did that.

When finished, the whole line looked like this:

nosuid,nodev,nofail,x-gvfs-show,uid=1000,gid=1000,dmask=027,fmask=137

After saving it (it will require authentication) and restarting, everything worked perfect. The shortcut to the text file on my desktop now no longer prompts me whether I want to execute or display the file.