Page 1 of 1

Open Folder as Root - PCManFM

Posted: 07 Apr 2022, 18:58
by Testuser
Hi Team,

Since PCManFM does not have open folder as root by default.

Created a desktop file with below content in path - /home/guest/.local/share/file-manager/actions

This prompted for root pass and will open folder as Root.

Don't know if this has any security issues (helps me a lot - Read on internet like this was removed due to seucurity issues - don't know what is that)


[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=/opt/porteus-scripts/xorg/psu /usr/bin/pcmanfm %u
Name=Default profile

Open Folder as Root - PCManFM

Posted: 08 Apr 2022, 22:14
by ncmprhnsbl
thanks, :) will be included in the next release, with one small difference:

Code: Select all

Exec=/opt/porteus-scripts/xorg/psu dbus-run-session /usr/bin/pcmanfm %u
for there seems to be an advantage in having a dbus connection..

Open Folder as Root - PCManFM

Posted: 09 Apr 2022, 11:58
by Testuser
Ohh dbus advantages I didn't know yet. Let me check out. :)

By the way ncmprhnsbl one more thing "open as root" is still coming for all file types as well in context menu even though i put "inode/directory" in Mimetypes.

dont know why :o

Open Folder as Root - PCManFM

Posted: 09 Apr 2022, 13:34
by ncmprhnsbl
ok.. had another look at this.. not sure how to fix that with the pcmanfm actions approach.. but:
there's the existing ~/.local/share/applications/pcmanfm-root.desktop file
all that needs to be done is run: update-desktop-database ~/.local/share/applications/
which will create: ~/.local/share/applications/mimeinfo.cache with contents:

Code: Select all

[MIME Cache]
inode/directory=pcmanfm-root.desktop
(you can just create that manually with same effect)
anyway, this will get the root filemanager entry to appear in the right-click menu for directories .. just a little higher up..

Open Folder as Root - PCManFM

Posted: 09 Apr 2022, 14:27
by Testuser
ncmprhnsbl wrote:
09 Apr 2022, 13:34
ok.. had another look at this.. not sure how to fix that with the pcmanfm actions approach.. but:
there's the existing ~/.local/share/applications/pcmanfm-root.desktop file
all that needs to be done is run: update-desktop-database ~/.local/share/applications/
which will create: ~/.local/share/applications/mimeinfo.cache with contents:

Code: Select all

[MIME Cache]
inode/directory=pcmanfm-root-desktop
(you can just create that manually with same effect)
anyway, this will get the root filemanager entry to appear in the right-click menu for directories .. just a little higher up..
This is working. Great findings @ncmprhnsbl

Also it would be grateful if you could tell me the advantage in having a dbus connection :) I couldn't find it :Search:

Open Folder as Root - PCManFM

Posted: 10 Apr 2022, 01:26
by ncmprhnsbl
Testuser wrote:
09 Apr 2022, 14:27
Also it would be grateful if you could tell me the advantage in having a dbus connection :) I couldn't find it
it's mainly so that the mounted devices shown in the side panel of the root instance don't show extra 'nonesense' entries like 'pts', 'dev' etc..
and also in eg. in an editor spawned from the root instance of pcmanfm, these extra entries will appear in the 'save as' or 'open' dialogs..

..also, i fixed a typo in my previous post: pcmanfm-root-desktop should have been pcmanfm-root.desktop

Open Folder as Root - PCManFM

Posted: 10 Apr 2022, 05:38
by Testuser
Hi ncmprhnsbl,

Thanks much for letting me know. :beer:

Testuser wrote:
09 Apr 2022, 11:58

By the way ncmprhnsbl one more thing "open as root" is still coming for all file types as well in context menu even though i put "inode/directory" in Mimetypes.
Found why the above is happening. With the action entry in context menu we can open folder and any file as root, the settings is for file-manager and thus it is showing for all files and folder in PcManFM.

So changed the entry like this.

Tooltip=Open as Root
Name=Open as Root
:)

Open Folder as Root - PCManFM

Posted: 12 Jul 2022, 01:05
by nanZor
Huh, I'll have to check this out, since when I need a root version of pcmanfm I just lazy it up either in the root terminal, or sudo to it

sudo pcmanfm

A couple warnings about GTK pixelbufs show up, but I can still operate. I do the same with engrampa archive manager firing it up from a root terminal and need to extract to a location that as guest, won't let me do..

Your examples show a longer-term solution however..