How to set permissions so that I can read and write to another partition?
Solution 1
What I would do is the following:
Assuming you have both partitions mounted with the names part1 and part2, you will be the only one using them and you want total free control over them, I would do this:
sudo chmod 777 /media/part1
- This would give all permissions (Read, Write, Execute) to you within the part1 partition.
sudo chmod 777 /media/part2
- This would give all permissions (Read, Write, Execute) to you within the part2 partition.
The permissions (in this case 777) are as follow:
7 - Full (Read, Write & Execute)
6 - read and write
5 - read and execute
4 - read only
3 - write and execute
2 - write only
1 - execute only
0 - none
The first 7 (Starting from the Left) is for the owner, the 2nd is for the group where the owner resides. The last 7 is for other groups. Basically like this you can copy anything you want in the partitions and if you ever need to take the HDD out and connect it to another computer with Ubuntu you will not have any problems with permissions. At least in my case it saves me time because I tend to have 1 or 2 hard drives that hold movies, music and similar stuff and I move them around from PC to PC.
Just to add, if you do not know where the partitions are mounted, you can always open Disk Utility and in the information about the hard drive it will tell you where it is mounted. Remember that you need to apply this to the partition AFTER it has been mounted.
Solution 2
Instead of changing all file permissions, like Luis Alvarado suggested, it would be better to change the file owner - thus keeping the executable bit on any binary and script files that previously had it.
So, assuming your partition is mounted as /media/something and your username is johndoe, you can run
sudo chown -R johndoe:johndoe /media/something
to change the owner and owning group of /media/something (and all files and directories it contains, hence the -R for 'recursive') to johndoe.
This way, all files will retain their permissions, but since you will be the owner of /media/something, you will be able to write to it and change any file permissions, in case you ever need to.
Solution 3
Change permission
sudo chmod -R a+rwx /path/of/folder
Solution 4
I had the same problem and solved it by running nautilus as root, right click on the partition, properties, and changed the permissions (or owner if necessary).
If nautilus is not installed:
sudo apt-get nautilus
Related videos on Youtube
hassan dusti
Updated on September 18, 2022Comments
-
hassan dusti over 1 year
I m using Ubuntu 12.04 and i have to partitions part1 and part2, both are ext4. I want to transfer media files to and from them freely through programs.
-
hassan dusti almost 12 yearsSo what should be the output from the command "sudo mount /a"? My output was "mount: can't find /a in /etc/fstab or /etc/mtab".
-
Deepak Verma almost 12 yearsI'm sorry, I don't know how I did that, but I meant "-a", not "/a". It just means to mount everything in fstab, and is a good way to test for errors. I'll correct my post.
-
Deepak Verma almost 12 yearsI always avoid a mode like 777, mainly because it is often hard to read due to the terminal colors that alert you to it being world writable. If he's the only user, then using 755 accomplish the same thing and be easier to read with normal colors
-
Luis Alvarado almost 12 yearsI agree with you on that. Specially folders.
-
n.st over 10 yearsWhy even change the permissions when you can just
chown
it to the current user? -
Luis Alvarado over 10 yearsHi n.st the reason is that in all cases I have tried, doing a chown did not actually give the needed permissions. It did change the owner to the current one but the files and folders still had wrong permissions and so the user could not write to the unit.
-
Fabby almost 5 yearsThat is exactly the same as what the accepted answer does too, just using different syntax than you.
777
is the same asrwx
. -
Quidam about 4 yearsAlternatively chmod +rwx could replace the chmod 777.
-
Quidam about 4 years@MartyFried Change your terminal color. It could be dangerous to not be able to read fully.
-
Deepak Verma about 4 years@Quidam: It's also dangerous to set files to R/W for the world. Changing terminal colors is not very easy, since there are many different terminal programs that might be used, both locally and remote. I just use chown, and it always works.
-
Deepak Verma about 4 yearsRE: chown. You need to chown for the directory before mounting, then do it for the folder and files in that directory after mounting to have it work correctly.