Can't set, copy or change file mode

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Level 2
Level 2
Posts: 56
Joined: Wed Jun 04, 2014 6:15 am

Can't set, copy or change file mode

Post by fernandocabral »

I have a file set to -rwxr-xr-x. When I copied it, its mode became -rw-------. I noticed it and tried to change it back to its original setting. It did not work.
I deleted the destination file and copied it again using cp. Same thing. Then I copied again using grsync. Same thing. I sued do root and tried changing
it setting to what I needed. Nope, didn't work.

Conclusion: I have tried every tool I could find in my [limited] toolchest, but the file refuses to go with the permissions I need it to have.
What's more: it is the whole bunch of files: every file I copy to that disk has its permission turned to -rw------- if it is a regular file and to drwx------ if it is a directory.
Mystifies me.

This is an external drive (USB-connected). Perhaps there is some sort of setting to the disk itself that forces that particular file mode and impedes
any changes? Any help much appreciated (yes, original files, on the HD, have the permission I need. And I can modify them too)
Level 3
Level 3
Posts: 176
Joined: Fri Apr 22, 2011 5:19 am

Re: Can't set, copy or change file mode

Post by phill1978 »

I have this also on an external HDD ( internal non-mounted ext4 )
its stopping me access my steam games

right clicking on nemo and trying to change file access is ignored. I have tried everthing, it even effects every single drive and the home drive too. I have fresh installed twce.

mint 17.1
Level 20
Level 20
Posts: 10316
Joined: Tue Feb 03, 2009 10:27 am

Re: Can't set, copy or change file mode

Post by altair4 »

I would not recommend using the "permissions" option in mounting an ntfs partition. It allows changing the attributes of an ntfs partition at a file level which will just make a mess of things if you ever use this with Windows since it's not as simple as just adding an option to fstab. In fact if you follow the link above to it's source you will see that the original victim of this suggestion had a number of problems:
However, when I try to access files on the partition from Windows, the security settings are all messed up. On all the files (of those few I've examined) a new account called Account Unknown(long GUID) has been added to the list of users, and has full rights. Rigths for most other users are decreased so that I don't have rights to do stuff I expect. Notably "Everyone" does no longer seem to have right to "Traverse folder / execute".
I would suggest a couple of options instead for external devices:

[1] If you use this external device often then set this up in fstab so that it mounts with the kind of permissions you want:

*** With the device plugged in find the UUID number for that partition:

Code: Select all

sudo blkid -c /dev/null
*** Make a new directory:

Code: Select all

sudo mkdir /media/USBDrive
*** Edit fstab:

Code: Select all

gksu gedit /etc/fstab
*** Add this line to the end of /etc/fstab

Code: Select all

UUID=some-long-number /media/USBDrive auto defaults,noauto,user,exec,umask=000 0 0
Change "some-long-number" to the uuid number you found in the blkid command above.

*** Save fstab
*** Unmount the drive if it is still mounted then plug the device back in.

udisks2 should use the fstab entry to automount the partition to /media/USBDrive with permissions of rwxrwxrwx.

Note: You can change the permissions by altering the umask number:
umask=000 results in rwxrwxrwx
umask=022 results in rwxr-xr-x

[2] OR, another option which will work for any usb device:

*** Install bindfs:

Code: Select all

sudo apt-get install bindfs
*** Create a new directory called MyMedia:

Code: Select all

sudo mkdir /MyMedia
*** Then run this command to see how this will work:

Code: Select all

sudo bindfs -o perms=0777 /media /MyMedia
When you plug in a usb drive it will mount in two different places simultaneously:
/media/$USER/LABEL and if the device is ntfs it will have permissions of 700.
/MyMedia/$USER/LABEL with permissions of 777

To make that happen on every boot add the bindfs line without sudo above the "exit 0" line in /etc/rc.local:
#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.
bindfs -o perms=0777 /media /MyMedia
exit 0
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Post Reply

Return to “Software & Applications”