open as root?

The dedicated forum for PCMan File Manager - http://wiki.lxde.org/en/PCManFM
miks
Posts: 9
Joined: Tue Sep 29, 2009 1:02 pm

open as root?

Post by miks »

How do I set up a menu entry to open pcmanfm as root?
Neal
Posts: 19
Joined: Wed Aug 12, 2009 9:34 am

Re: open as root?

Post by Neal »

Open /usr/share/applications/pcmanfm.desktop as root. Edit it to change this line:
Exec=pcmanfm %F --no-desktop
so that it reads like this:
Exec=gksu -l /usr/bin/pcmanfm &
Save the file as pcmanfm superuser mode or your name of choice.
:!: :!: Use "Save As" not "Save" or your entry for PCManFM will be lost. :!: :!:
miks
Posts: 9
Joined: Tue Sep 29, 2009 1:02 pm

Re: open as root?

Post by miks »

Thanks Neal. I have done as you say and also changed "name" to "Root File Manager" before saving the file as pcmanfm-root, and it now shows in the menu as Root File Manager. Excellent so far! When I launch it, I get the window asking for my root password, which is accepted, but pcmanfm does not appear, although HTOP shows that it is running. This is on a vanilla install of Debian Lenny. Any ideas?

EDIT: I get the same result from the root terminal.
Neal
Posts: 19
Joined: Wed Aug 12, 2009 9:34 am

Re: open as root?

Post by Neal »

Try this:
Open leafpad or other text editor and copy the following into it -->

Code: Select all

#!/bin/sh

#-------------------------------------------------------
# Start program

export launchasroot='
<window title="Root Launcher" icon="/usr/share/icons/gnome/32x32/apps/file-manager.png" window-position="2"> 
<vbox> 
  <notebook label="Launch as Root ">
  <vbox>
  <frame>
				<hbox>
				     <button>
						<input file>"/usr/share/icons/file_tools_section.png"</input>
						<action>gksu -l /usr/bin/pcmanfm &</action>
					</button>
					<text use-markup="true" width-chars="17">
						<label>"File Manager Superuser Mode"</label>
					</text>
				</hbox>	
  </vbox>
</window>
'

gtkdialog --program=launchasroot
unset launchasroot

You can change the icons to others, if you choose. Save the file as launchasroot. There should be no need for an extension, but if there is, use .sh. Copy the file to /usr/bin (Or wherever the programs for debian are installed by default) and set its permissions. --> right click on the file, choose Properties and click on the Permissions tab. Enter into Owner and Group fields root. Then set Owner to read write and execute, Group to read and execute and Others to read and execute (this is optional).

Next create a .desktop file for this script.
[Desktop Entry]
Name=Launch as Root
Exec=/usr/bin/launchasroot
Comment=Root Launcher
Icon=file-manager.png
Terminal=false
Type=Application
StartupNotify=true
Categories=Settings;GTK;X-MandrivaLinux-System-Configuration; (change this to match )
OnlyShowIn=LXDE;
Set its permissions. You should now have a menu entry for this launcher.
You will need to install gtkdialog, if you do not have it already.
miks
Posts: 9
Joined: Tue Sep 29, 2009 1:02 pm

Re: open as root?

Post by miks »

OK, thanks Neal, I will try that but just one question, I do not know what to put in this line:

Code: Select all

Categories=Settings;GTK;X-MandrivaLinux-System-Configuration; (change this to match )
Neal
Posts: 19
Joined: Wed Aug 12, 2009 9:34 am

Re: open as root?

Post by Neal »

You're welcome. Look at your file for pcmanfm. What is on that line? Copy it over.
FreelY
Posts: 11
Joined: Tue Oct 06, 2009 11:31 pm
Location: ҒЯ

Re: open as root?

Post by FreelY »

Hi Neal

Thank you but it doesn't work for me, I have the same answer: File doesn't exist

1-Install "gtkdialog"
2- In /usr/bin create a file "launchasroot" (tested with launchasroot.sh) with your script, and set permissions for Owner and Group
3- In /home/freely create a .desktop file with the second script, edit "Categories=" for my computer and set permissions for Owner and Group

Any idea?
Image
Neal
Posts: 19
Joined: Wed Aug 12, 2009 9:34 am

Re: open as root?

Post by Neal »

FreelY wrote:Hi Neal

3- In /home/freely create a .desktop file with the second script, edit "Categories=" for my computer and set permissions for Owner and Group

Any idea?
This is your problem. The .desktop file should not be in your /home directory. It should be in /usr/share/applications with your other .desktop files. Be sure to check its permissions - right click > properties > permissions tab. Compare to other .desktop files to be sure they're set correctly.
FreelY
Posts: 11
Joined: Tue Oct 06, 2009 11:31 pm
Location: ҒЯ

Re: open as root?

Post by FreelY »

Again the same answer

But now that's good! with "Exec=gksu /usr/bin/pcmanfm" and not "Exec=gksu -l /usr/bin/pcmanfm & " in my file pcmanfm_root.desktop

thanks ;)
Image
miks
Posts: 9
Joined: Tue Sep 29, 2009 1:02 pm

Re: open as root?

Post by miks »

Neal wrote:Try this:
Open leafpad or other text editor and copy the following into it -->

Code: Select all

#!/bin/sh

#-------------------------------------------------------
# Start program

export launchasroot='
<window title="Root Launcher" icon="/usr/share/icons/gnome/32x32/apps/file-manager.png" window-position="2"> 
<vbox> 
  <notebook label="Launch as Root ">
  <vbox>
  <frame>
				<hbox>
				     <button>
						<input file>"/usr/share/icons/file_tools_section.png"</input>
						<action>gksu -l /usr/bin/pcmanfm &</action>
					</button>
					<text use-markup="true" width-chars="17">
						<label>"File Manager Superuser Mode"</label>
					</text>
				</hbox>	
  </vbox>
</window>
'

gtkdialog --program=launchasroot
unset launchasroot

You can change the icons to others, if you choose. Save the file as launchasroot. There should be no need for an extension, but if there is, use .sh. Copy the file to /usr/bin (Or wherever the programs for debian are installed by default) and set its permissions. --> right click on the file, choose Properties and click on the Permissions tab. Enter into Owner and Group fields root. Then set Owner to read write and execute, Group to read and execute and Others to read and execute (this is optional).

Next create a .desktop file for this script.
[Desktop Entry]
Name=Launch as Root
Exec=/usr/bin/launchasroot
Comment=Root Launcher
Icon=file-manager.png
Terminal=false
Type=Application
StartupNotify=true
Categories=Settings;GTK;X-MandrivaLinux-System-Configuration; (change this to match )
OnlyShowIn=LXDE;
Set its permissions. You should now have a menu entry for this launcher.
You will need to install gtkdialog, if you do not have it already.
Hi Neal, not got this working yet. The program does not execute. In terminal, I get:

Code: Select all

mike@acer-7520:~$ launchasroot

** ERROR **: gtkdialog: Error in line 16, near token '</vbox>': syntax error

aborting...
/usr/bin/launchasroot: line 25:  3500 Aborted                 gtkdialog --program=launchasroot
Also, I do not get a menu entry.
Locked