nautilus - How can I create new "gksu" command based on pkexec? - Ask Ubuntu
when google “gksu gedit” 1 of top entries (how run gedit , nautilus root) advises gksu
usage frowned upon:
gksu hasn't been updated since 2009 , is not recommendedany more. in fact, ubuntu no longer ships with gksu by default (though may installed many of you, because apps still depend on it) , may removed @ point.
a link askubuntu (why gksu no longer installed default?) suggests pkexec
should used instead doesn't provide clear , concise steps this.
how can use pkexec within new wrapper shell script called gsu
supports both gedit
, nautilus
?
i feel wrapper script called gsu
appropriate because "muscle memory" type gksu
time , don't want have type pkexec
instead.
additionally pesky gtk
warning messages disappear. terminal prompt right away instead of waiting editor or file manager end.
au duplicates: i've searched many q&a none asking (or offering how to) give complete solution gsu
wrapper script call pkexec
, install necessary policy kits , rid of pesky gtk warnings , terminal prompt right away... in 1 answer.
before can use pkexec
gedit
, nautilus
need copy polkit rules support them. automatically done in ubuntu 17.04 in mean time need wget
them.
nautilus policy kit
wget https://raw.githubusercontent.com/hotice/webupd8/master/org.gnome.nautilus.policy -o /tmp/org.gnome.nautilus.policy sudo cp /tmp/org.gnome.nautilus.policy /usr/share/polkit-1/actions/
gedit policy kit
wget https://raw.githubusercontent.com/hotice/webupd8/master/org.gnome.gedit.policy -o /tmp/org.gnome.gedit.policy sudo cp /tmp/org.gnome.gedit.policy /usr/share/polkit-1/actions/
"gsu" bash script replace "gksu"
creating bash script 1 of 2 ways call pxexec
using familiar term of gsu
. create file in 1 of paths:
#!/bin/bash # usage: gsu gedit file1 file2... # -or- gsu natuilus /dirname # & used spawn process , prompt asap # > /dev/null used send gtk warnings dumpster command=$1 # extract gedit or nautilus pkexec "$command" "${@:2}" &> /dev/null&
save file , mark executable chmod +x gsu
now instead of typing gksu
edit grub configuration can use:
gsu gedit /etc/default/grub
"gsu" alias of "pkexec" replace "gksu"
creating alias second option call pxexec
using familiar term of gsu
. open file ~/.bashrc
, search alias
. see this:
# more ls aliases alias ll='ls -alf' alias la='ls -a' alias l='ls -cf'
after last line add this:
alias gsu='pkexec'
save file , exit.
Comments
Post a Comment