open as root?
Posted: Sun Oct 25, 2009 4:04 pm
How do I set up a menu entry to open pcmanfm as root?
so that it reads like this:Exec=pcmanfm %F --no-desktop
Save the file as pcmanfm superuser mode or your name of choice.Exec=gksu -l /usr/bin/pcmanfm &
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
Set its permissions. You should now have a menu entry for this launcher.[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;
Code: Select all
Categories=Settings;GTK;X-MandrivaLinux-System-Configuration; (change this to match )
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 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?
Hi Neal, not got this working yet. The program does not execute. In terminal, I get:Neal wrote:Try this:
Open leafpad or other text editor and copy the following into it -->
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).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
Next create a .desktop file for this script.Set its permissions. You should now have a menu entry for this launcher.[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;
You will need to install gtkdialog, if you do not have it already.
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