Why does no file manager ask for higher permission if needed? [closed]

I just answered another beginners question about "Cannot write.......check permissions".

Of course I know how to use chown/chmod; I'm working with command line anyway. But the average consumer does not.

So what should I tell people without any GNU/Linux-experience?

Work as root? I know for example Nemo has functionality "open as root". But just no! I do not think it is a good idea for an average user. It's far to dangerous. Then the user creates file in root-file-manager and wonders why he cannot delete or modify this file. And so on.

Tell him to learn how to use chown/chmod? And here we are - nerd-only-linux where everything is so complicated. That's the way we do things; but it's no good option for the average consumer.

Why doesn't the file-manager help?

I hate to say this, but look how Windows handles this. Default are user-permission. And if the file-manager needs more - it just asks the user.

This can't be hard to implement. If an operation fails with permission exception - try executing with gksudo.

And yes: I'm really inexperienced with the whole Open-Source-World.

My questions:

  1. Are there any reasons this isn't done this way
  2. Did anyone implement something like that?
  3. Is this something you report as a bug (Ubuntu or e.g. Gnome)?
  4. Is this something I just could try to implement myself?

Solution 1:

  1. Are there any reasons this isn't done this way

There aren't any specifically. I can name a few supposed reasons, but they'd be mostly speculation.

  1. Did anyone implement something like that?

Not quite. There is nautilus-admin extension which will allow you to open a directory in a new window with root-level privileges, and then you can change file/directory permissions as you wish from the right-click menu-> Properties->Permissions.

  1. Is this something you report as a bug (Ubuntu or e.g. Gnome)?

Bug report ? No. Feature request ? Potentially, yes. You can submit this as feature request to Nautilus ( the filemanager ) team on Launchpad, but I suspect with 90 % certainty they'll point you in the nautilus-admin extension I mentioned above.

Install it with sudo apt-get install nautilus-admin.

  1. Is this something I just could try to implement myself?

Yes, if your file manager allows adding scripts to it. The default file manager for Ubuntu (Nautilus) does allow adding scripts to it, so you could do something like this:

#!/bin/bash
# adds read permissions for file for all users
zenity --password | sudo -S -p ""  chmod +r  "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" || zenity --error --text "Command failed"

Place that into ~/.local/share/nautilus/scripts, make executable with chmod, and then it will be accessible via right clicking on file. Of course that's a minimal example just to show the point. If you want a full blown app that allows more complex features like selecting which permissions to alter, well, that might require extra commands and probably a language like Python with more powerful GUI toolkits.

But just no! I do not think it is a good idea for an average user. It's far to dangerous. Then the user creates file in root-file-manager and wonders why he cannot delete or modify this file. And so on.

Well...It's not a computer problem - it's user problem. We can't fix the user not willing to learn how to properly operate their computer and not taking responsibility for their actions.

Users have to realize that the separation of ownership in files exists for a reason. You can't have both power to change permissions on file and not expect security implications with that