0

I tried to mount an ext4 partition by double clicking it.

After that in its properties I found that permissions were only to root.

I tried to create a new folder in it but that option was not allowed so what I did was starting terminal from /media/username/ and then

sudo chmod 777 "partition name" 

After that permissions now still exclusive to root but I can do whatever I couldn't do before.

My question is, was that operation incorrect? What is the best approach to solve such a problem?

3

You mean, root is still the owner. To make yourself the owner, when logged in as yourself, run:

sudo chown -R $USER: /media/$USER/"partition name"

-R for recursively, so all the contents are yours too

Then fix the permissions because 777 is not a good choice since anyone can write here now; this gives write permission only to the owner:

sudo chmod 755 /media/$USER/"partition name"

Please note, it's fine to change ownership and permissions on mount points like this, but NOT advisable to do so on devices like /dev/sda1

  • many thanks to you my friend it worked perfectly!! thank you – Nour Alhadi Mahmoud Aug 12 '16 at 1:45
  • great, glad you got it sorted @NourAlhadiMahmoud :) – Zanna Aug 12 '16 at 18:14
2

By using the command chmod you simply changed permission of the files, not ownership.

To change ownership type in terminal

sudo su
chown "Your user name":"Your group name" -R "partition name"

Also remember to do this only under /media/.../your desired file directory as taking system ownership is dangerous and not at all recommended.

Also chmod 777 is a dangerous command.

Try something like chmod 755 -R /media/.../your desired file

Here -R means recursively changing permissions to all child files.

NEVER EVER try this at / or even /media level as it has potential to break your system.

chmod 777 is dangerous because

1st digit sets permission for root user
2nd digit sets permission for users in current group
3rd digit sets permission for all other users

4 means read
2 means write
1 means execute

Thus 4 + 2 + 1 = 7 meaning all three permissions

Thus you are effectively allowing any user to alter all your files

Hope this helps

  • Oh I didn't see you answer as I was writing on mobile... but 755 is not a good choice for all child files... OP didn't do recursive 777 anyway – Zanna Aug 10 '16 at 23:41

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.