11

In the latest version of the PCManFM the option under Tools-Open Current Folder as Root has been removed. Is there a way to re-add the option? I know I can open PCManFM as Root via the Terminal but it was handy to open the specific Folder under the Tools option. Also is there a way to add the option as a Context Menu entry?

I didn't understand the Desktop file specification extension (DES-EMA).

I found this:

[Desktop Entry]
Name = Open as Root
Tooltip = Open the folder as root
Icon = terminal
Profiles = on_folder;

[X-Action-Profile on_folder]
Name = Open as Root
MimeTypes = inode/directory;
SelectionCount = 1
Exec = gksudo pcmanfm %s

I then name the file pcman_root.desktop and place the file into: ~/.local/share/file-manager/actions. Unfurtunately, I do not have the folder file-manager/actions under the ~/.local/share directory. Am I supposed to create that specific folder?

2
  • Not the answer, but it is recommended that one should not open a GUI file manager using root permissions. Such tasks should be done using terminal.Maybe PCManFM's developers removed the feature as they understood the threat.Just guessing. Apr 7, 2014 at 3:13
  • Thank you for your input. I believe you are correct in regards to removing the feature. However there must be a way to re-add the option in some form rather than utilizing the Terminal. Supposedly the file as outlined above will provide the option but however I don't have the 'file-manager/actions' folder under the ~.local/share location. Thank you again for your input.
    – user236378
    Apr 7, 2014 at 6:27

1 Answer 1

9

You are on the right track.

Create ~/.local/share/file-manager/actions.

In that folder, create root.desktop (not pcman_root.desktop or anything else).

Add this content:

[Desktop Entry]
Type=Action
Tooltip=Open Folder As Root
Name=Open Folder As Root
Profiles=profile-zero;
Icon=gtk-dialog-authentication

[X-Action-Profile profile-zero]
MimeTypes=inode/directory;
Exec=/usr/bin/gksu /usr/bin/pcmanfm %u
Name=Default profile

Save the file.

(Or download the script from here.)

Restart PCManFM (System Tools, Task Manager, terminate or kill pcmanfm, then start it again). Now, when you right-click on a folder, you should see the "Open as root" option in the context menu.

enter image description here

As others have stated, this feature can be dangerous which is why it is not there by default.

And this is what a developer associated with the PCManFM project has to say in response to a "request" for the feature to be restored:

Running pcmanfm as root means all the applications will be ran under root which is not safe you know (well, if you want to risk your system and walk on the blade then I can see the reason) and I never saw any reason to run editor/browser/wine/etc. under root (and you want exactly this, don't you?)

But anyway if you so much want to do this risky things then why you never read http://wiki.lxde.org/en/PCManFM#Run_as_root page? Yes, it was changed lately but it is still available, at your own risk.

3
  • Thank you very much for your input. Your advice is very good. No I didn't read the link (I didn't know about the link) but I will read it carefully. I didn't realize the feature was that dangerous to utilize. I have never had any problems at all utilizing the built-in feature. I will utilize "sudo gksudo pcmanfm" in the terminal to run pcmanfm as root if that is safer. That is, when I need to do so. Thank you again for your advice, instructions and genuine concern. I really appreciate it very much.
    – user236378
    Apr 21, 2014 at 4:42
  • i get an error when pressing that 'Open as root' option. It says /file no such file or directory
    – user47206
    Oct 10, 2014 at 14:21
  • i have found here a script that works. i will edit your answer accordingly
    – user47206
    Oct 10, 2014 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.