Ubuntu: Permission issues after moving from folder from one partition to another



Question:

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 ?


Solution:1

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.


Solution:2

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »