Open Folder as Root - PCManFM

Technical issues/questions of an intermediate or advanced nature.
Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

Open Folder as Root - PCManFM

Post#1 by Testuser » 07 Apr 2022, 18:58

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

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3925
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

Open Folder as Root - PCManFM

Post#2 by ncmprhnsbl » 08 Apr 2022, 22:14

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..
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

Open Folder as Root - PCManFM

Post#3 by Testuser » 09 Apr 2022, 11:58

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

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3925
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

Open Folder as Root - PCManFM

Post#4 by ncmprhnsbl » 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..
Last edited by ncmprhnsbl on 10 Apr 2022, 01:29, edited 1 time in total.
Reason: fixed typo: pcmanfm-root-desktop> pcmanfm-root.desktop
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

Open Folder as Root - PCManFM

Post#5 by Testuser » 09 Apr 2022, 14:27

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:

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3925
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

Open Folder as Root - PCManFM

Post#6 by ncmprhnsbl » 10 Apr 2022, 01:26

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
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

Testuser
Samurai
Samurai
Posts: 137
Joined: 26 May 2021, 15:11
Distribution: Porteus-v5.0-64-LXDE

Open Folder as Root - PCManFM

Post#7 by Testuser » 10 Apr 2022, 05:38

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
:)

nanZor
Shogun
Shogun
Posts: 381
Joined: 09 Apr 2019, 03:27
Distribution: Porteus 5.01 x86-64 LXQT

Open Folder as Root - PCManFM

Post#8 by nanZor » 12 Jul 2022, 01:05

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..
That's a UNIX book - cool. -Garth

Post Reply