Add Open Folder as Root to PCMan File Manager's context menu

Solution 1:

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.