A hard disk can have various partitions on it. Partition refers to the logical divisions of a physical disk that makes it easy to organize and share the data. You can edit or manipulate these partitions for various purposes.
For example, it is useful while sharing files on a network you can share the data of a partition without worrying about the data of other partitions. Similarly, You can install multiple operating systems on a single physical drive, by dividing it into multiple partitions or drive.
In this article, we will discuss to set read, write, and execute permission on a partition in Linux.
Set permissions on a partition
We will use the command-line interface to display and set the required permissions on a partition, so it would be good to have an understanding of file ownership and permissions in Linux.
Now follow the steps below to set the read or write permission on a partition –
Identify the partition
Execute the following command to display the list the partitions along with some other useful information such as UUID, type of partition, etc –
Now identify the NTFS partition that you want to mount and change the permission. As given in this image we are going mount
Mount the NTFS partition to Linux filesystem
Ubuntu or Linux Mint can natively access the NTFS partitions. However, you may not able to modify the permissions. So first you need to mount the partition to Linux filesystem.
Create a mount point and use the following command to mount a partition to this mount point –
sudo mount /dev/sdx -t ntfs-3g -o permissions Mount_point
For example –
To mount the
/media/lalit/ we will use –
sudo mount /dev/sda4 -t ntfs-3g -o permissions /media/lalit/
Now you will be able to edit the permissions of files and folders.
OR if you want to permanently mount the partition then edit the
/etc/fstab file. To edit it first open this file by using –
sudo nano /etc/fstab
And then add the following line at the end of this file –
UUID=UUID_of_the_partition Mount_point ntfs-3g permissions 0 1
For example –
UUID=0C82D72E82D71B52 /media/lalit/ ntfs-3g permissions 0 1
Save this file in nano editor by pressing
ctrl+s and then exit from the editor by using
ctrl+x. Next time when you on your system, at the time of booting this partition will be mounted automatically.
Change the permission
Now you can use the chown and chmod commands to change the ownership and permission of the mounted partition.
To give write and execute permission to everyone use the following command in your terminal –
sudo chmod ugo+wx /mount_point
For example –
sudo chmod ugo+wx /media/lalit/
You can follow file ownership and permission and accordingly modify the permission of the partition.
Ok, that’s all for now. I hope you are now able to grant the required permissions on a partition or disk. If you still have a query then write us in the comments below.