I am using ubuntu.

I moved all my C programs/coded which was in a folder from one partition to another, after that all my files have -rw------- the owner has just the read and write permission, even though I used chmod 777 on all my files the permission remains the same -rw-------. I also tried chown. I tried both the commands as superuser.

Due to this permission change I can't run any of my executable. Even when I compile and generate the executable it still has the same -rw------- permission.

How can i change the permissions now? How to solve this issue ?

  • Is the destination folder on an NTFS partition? – jobin Mar 6 '14 at 17:59
  • @Jobin: Its a NTFS partition, i actually moved my folder from home directory to another partions – Manu Mar 6 '14 at 18:07

It's the partition you need to change, not the actual files and folders.

You need to first make sure the directory where you mount the partition has the correct permissions, using the normal methods that you seem familiar with.

Next, how are you mounting the partition? If you are using /etc/fstab, you need to set options for that partition.

If it's ext3 or ext4, you can use defaults,user_xattr.

NTFS is more complicated, and I don't actually have one to check, but it's something like: defaults,dmask=027,fmask=137,umask=007 and sometimes you need to set the owner and group IDs (something like uid=1000,gid=1000 added to the list. But there are a lot of variations, depending on your needs and tastes. Like, do you want to be the owner, or do you want to be in a group that has certain permissions? Best to look up the mount command or fstab to learn more.

| improve this answer | |

You need to mount your NTFS partition as follows:

sudo mkdir /media/$USER/device_label
sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0000 /dev/device /media/$USER/device_label

change /dev/device to the NTFS partition device, eg. /dev/sda2 or whatever you have.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.