1

I have read a lot of articles on how to work around the lack of gksudo in the latest *buntu releases. Unfortunately, they've been tailored to applications I don't use like gedit, mousepad, nautilus, etc.

To make up for the lack, I created some aliases and launchers (shown below) for pcmanfm and leafpad that have worked great so far, but I'd like to have a sanity check to make sure they are safe to use.

Also, I don't really understand DISPLAY and XAUTHORITY. I just know that they are environmental variables that need to be included. Do they refer back to specific files that I can look at?

Following are the aliases and launchers:

This is used with pcmanfm or leafpad:

alias gksudo2='sudo -H pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY'

This opens the hosts file for editing:

alias hosts2='sudo -H pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY leafpad /etc/hosts'

This is for opening pcmanfm as root:

[Desktop Entry]
Name=pcmanfm-rootpk
Type=Application
Icon=/home/user/Pictures/PNG Alphabetical Icons/128/p_orange.png
Exec=sudo -H "pkexec env DISPLAY\=\$DISPLAY XAUTHORITY\=\$XAUTHORITY" pcmanfm %U 
StartupNotify=true
Terminal=true
NoDisplay=false
Categories=Utility</code>

This is used for editing the hosts file:

[Desktop Entry]
Keywords=hosts file
Name=HostsFileLauncher-rootpk
Comment=hosts
Exec=sudo -H leafpad /etc/hosts pkexec env "DISPLAY\=\$DISPLAY" "XAUTHORITY\=\$XAUTHORITY" 
Icon=/home/user/Pictures/PNG Alphabetical Icons/128/h_orange.png
Terminal=true
NoDisplay=false
Type=Application
MimeType=text/plain
Categories=Utility</code> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.