Skip to main content
like stickers but better
Source Link

Many have had similar issues with wanting to run GUI with su privileges. More recently I have looked into the lingering open terminal window. After searching this is what worked for me.

  • my usage is invoking GUI with SU from the term and/or a shell script from ~/bin using aliases.

GUI privilege escalation of "su" or "sudo" is not recommended and should never be done with out knowledge of the risks of what your doing.


  • pkexec can be obtained by the following:

     sudo apt install policykit-1 

  • Edit the bottom of this file to where it looks likes this:

     sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy 
  • yours should look like this:

     <action id="org.freedesktop.policykit.lockdown"> <description>Configure lock down for an action</description> <message>Authentication is required to configure lock down policy</message> <defaults> <allow_any>auth_admin</allow_any> <allow_inactive>auth_admin</allow_inactive> <allow_active>auth_admin</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pklalockdown</annotate> </action> 

  • After that try:

     pkexec gedit 

Adding a custom bin path to terminal:

  • The Standard is to store users shell programs in

     /home/$USER/bin 

or

 ~/bin 

*These are the same location the first is the full path to file the second is short hand for

 /home/$USER/bin 
  • To add your user /bin to your $USER $PATH simply

     mkdir /home/$USER/bin 
  • terminal will now recognise your shell scripts or programs located in

     ~/bin 

Example:

 $/path/to/file.sh 

Becomes:

 $file.sh 

ADD this to .bashrc

export PATH=$PATH:$HOME/bin

Where "$HOME/bin" is the directory I assume you want to add. This change is only temporary (it works only in the current session of the shell) to make it permanent add the previous line to your .bashrc file located in your home directory.

  • I prefer this method of privilege escalation for gui apps because i can just pkexec in a shell script to run multiple programs and have the option to save credentials temporarily.

  • you then can try and add an alias to ~/.bash_aliases:

     echo 'alias gedit="pkexec gedit"' >> ~/.bash_aliases 

#PKEXEC #SU #GUI #GKsu #POLKIT #policykit/PKEXEC /SU /GUI /GKsu /POLKIT /policykit-1

Many have had similar issues with wanting to run GUI with su privileges. More recently I have looked into the lingering open terminal window. After searching this is what worked for me.

  • my usage is invoking GUI with SU from the term and/or a shell script from ~/bin using aliases.

GUI privilege escalation of "su" or "sudo" is not recommended and should never be done with out knowledge of the risks of what your doing.


  • pkexec can be obtained by the following:

     sudo apt install policykit-1 

  • Edit the bottom of this file to where it looks likes this:

     sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy 
  • yours should look like this:

     <action id="org.freedesktop.policykit.lockdown"> <description>Configure lock down for an action</description> <message>Authentication is required to configure lock down policy</message> <defaults> <allow_any>auth_admin</allow_any> <allow_inactive>auth_admin</allow_inactive> <allow_active>auth_admin</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pklalockdown</annotate> </action> 

  • After that try:

     pkexec gedit 

Adding a custom bin path to terminal:

  • The Standard is to store users shell programs in

     /home/$USER/bin 

or

 ~/bin 

*These are the same location the first is the full path to file the second is short hand for

 /home/$USER/bin 
  • To add your user /bin to your $USER $PATH simply

     mkdir /home/$USER/bin 
  • terminal will now recognise your shell scripts or programs located in

     ~/bin 

Example:

 $/path/to/file.sh 

Becomes:

 $file.sh 

ADD this to .bashrc

export PATH=$PATH:$HOME/bin

Where "$HOME/bin" is the directory I assume you want to add. This change is only temporary (it works only in the current session of the shell) to make it permanent add the previous line to your .bashrc file located in your home directory.

  • I prefer this method of privilege escalation for gui apps because i can just pkexec in a shell script to run multiple programs and have the option to save credentials temporarily.

  • you then can try and add an alias to ~/.bash_aliases:

     echo 'alias gedit="pkexec gedit"' >> ~/.bash_aliases 

#PKEXEC #SU #GUI #GKsu #POLKIT #policykit-1

Many have had similar issues with wanting to run GUI with su privileges. More recently I have looked into the lingering open terminal window. After searching this is what worked for me.

  • my usage is invoking GUI with SU from the term and/or a shell script from ~/bin using aliases.

GUI privilege escalation of "su" or "sudo" is not recommended and should never be done with out knowledge of the risks of what your doing.


  • pkexec can be obtained by the following:

     sudo apt install policykit-1 

  • Edit the bottom of this file to where it looks likes this:

     sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy 
  • yours should look like this:

     <action id="org.freedesktop.policykit.lockdown"> <description>Configure lock down for an action</description> <message>Authentication is required to configure lock down policy</message> <defaults> <allow_any>auth_admin</allow_any> <allow_inactive>auth_admin</allow_inactive> <allow_active>auth_admin</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pklalockdown</annotate> </action> 

  • After that try:

     pkexec gedit 

Adding a custom bin path to terminal:

  • The Standard is to store users shell programs in

     /home/$USER/bin 

or

 ~/bin 

*These are the same location the first is the full path to file the second is short hand for

 /home/$USER/bin 
  • To add your user /bin to your $USER $PATH simply

     mkdir /home/$USER/bin 
  • terminal will now recognise your shell scripts or programs located in

     ~/bin 

Example:

 $/path/to/file.sh 

Becomes:

 $file.sh 

ADD this to .bashrc

export PATH=$PATH:$HOME/bin

Where "$HOME/bin" is the directory I assume you want to add. This change is only temporary (it works only in the current session of the shell) to make it permanent add the previous line to your .bashrc file located in your home directory.

  • I prefer this method of privilege escalation for gui apps because i can just pkexec in a shell script to run multiple programs and have the option to save credentials temporarily.

  • you then can try and add an alias to ~/.bash_aliases:

     echo 'alias gedit="pkexec gedit"' >> ~/.bash_aliases 

/PKEXEC /SU /GUI /GKsu /POLKIT /policykit-1

added 47 characters in body
Source Link

Many have had similar issues with wanting to run GUI with su privileges. More recently I have looked into the lingering open terminal window. After searching this is what worked for me.

  • my usage is invoking GUI with SU from the term and/or a shell script from ~/bin using aliases.

GUI privilege escalation of "su" or "sudo" is not recommended and should never be done with out knowledge of the risks of what your doing.


  • pkexec can be obtained by the following:

     sudo apt install policykit-1 

  • Edit the bottom of this file to where it looks likes this:

     sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy 
  • yours should look like this:

     <action id="org.freedesktop.policykit.lockdown"> <description>Configure lock down for an action</description> <message>Authentication is required to configure lock down policy</message> <defaults> <allow_any>auth_admin</allow_any> <allow_inactive>auth_admin</allow_inactive> <allow_active>auth_admin</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pklalockdown</annotate> </action> 

  • After that try:

     pkexec gedit 

Adding a custom bin path to terminal:

  • The Standard is to store users shell programs in

     /home/$USER/bin 

or

 ~/bin 

*These are the same location the first is the full path to file the second is short hand for

 /home/$USER/bin 
  • To add your user /bin to your $USER $PATH simply

     mkdir /home/$USER/bin 
  • terminal will now recognise your shell scripts or programs located in

     ~/bin 

Example:

 $/path/to/file.sh 

Becomes:

 $file.sh 

ADD this to .bashrc

export PATH=$PATH:$HOME/bin

Where "$HOME/bin" is the directory I assume you want to add. This change is only temporary (it works only in the current session of the shell) to make it permanent add the previous line to your .bashrc file located in your home directory.

  • I prefer this method of privilege escalation for gui apps because i can just pkexec in a shell script to run multiple programs and have the option to save credentials temporarily.

  • you then can try and add an alias to ~/.bash_aliases:

     echo 'alias gedit="pkexec gedit"' >> ~/.bash_aliases 

#PKEXEC #SU #GUI #GKsu #POLKIT #policykit-1

Many have had similar issues with wanting to run GUI with su privileges. More recently I have looked into the lingering open terminal window. After searching this is what worked for me.

  • my usage is invoking GUI with SU from the term and/or a shell script from ~/bin using aliases.

GUI privilege escalation of "su" or "sudo" is not recommended and should never be done with out knowledge of the risks of what your doing.


  • pkexec can be obtained by the following:

     sudo apt install policykit-1 

  • Edit the bottom of this file to where it looks likes this:

     sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy 
  • yours should look like this:

     <action id="org.freedesktop.policykit.lockdown"> <description>Configure lock down for an action</description> <message>Authentication is required to configure lock down policy</message> <defaults> <allow_any>auth_admin</allow_any> <allow_inactive>auth_admin</allow_inactive> <allow_active>auth_admin</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pklalockdown</annotate> </action> 

  • After that try:

     pkexec gedit 

Adding a custom bin path to terminal:

  • The Standard is to store users shell programs in

     /home/$USER/bin 

or

 ~/bin 

*These are the same location the first is the full path to file the second is short hand for

 /home/$USER/bin 
  • To add your user /bin to your $USER $PATH simply

     mkdir /home/$USER/bin 
  • terminal will now recognise your shell scripts or programs located in

     ~/bin 

Example:

 $/path/to/file.sh 

Becomes:

 $file.sh 

ADD this to .bashrc

export PATH=$PATH:$HOME/bin

Where "$HOME/bin" is the directory I assume you want to add. This change is only temporary (it works only in the current session of the shell) to make it permanent add the previous line to your .bashrc file located in your home directory.

  • I prefer this method of privilege escalation for gui apps because i can just pkexec in a shell script to run multiple programs and have the option to save credentials temporarily.

  • you then can try and add an alias to ~/.bash_aliases:

     echo 'alias gedit="pkexec gedit"' >> ~/.bash_aliases 

Many have had similar issues with wanting to run GUI with su privileges. More recently I have looked into the lingering open terminal window. After searching this is what worked for me.

  • my usage is invoking GUI with SU from the term and/or a shell script from ~/bin using aliases.

GUI privilege escalation of "su" or "sudo" is not recommended and should never be done with out knowledge of the risks of what your doing.


  • pkexec can be obtained by the following:

     sudo apt install policykit-1 

  • Edit the bottom of this file to where it looks likes this:

     sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy 
  • yours should look like this:

     <action id="org.freedesktop.policykit.lockdown"> <description>Configure lock down for an action</description> <message>Authentication is required to configure lock down policy</message> <defaults> <allow_any>auth_admin</allow_any> <allow_inactive>auth_admin</allow_inactive> <allow_active>auth_admin</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pklalockdown</annotate> </action> 

  • After that try:

     pkexec gedit 

Adding a custom bin path to terminal:

  • The Standard is to store users shell programs in

     /home/$USER/bin 

or

 ~/bin 

*These are the same location the first is the full path to file the second is short hand for

 /home/$USER/bin 
  • To add your user /bin to your $USER $PATH simply

     mkdir /home/$USER/bin 
  • terminal will now recognise your shell scripts or programs located in

     ~/bin 

Example:

 $/path/to/file.sh 

Becomes:

 $file.sh 

ADD this to .bashrc

export PATH=$PATH:$HOME/bin

Where "$HOME/bin" is the directory I assume you want to add. This change is only temporary (it works only in the current session of the shell) to make it permanent add the previous line to your .bashrc file located in your home directory.

  • I prefer this method of privilege escalation for gui apps because i can just pkexec in a shell script to run multiple programs and have the option to save credentials temporarily.

  • you then can try and add an alias to ~/.bash_aliases:

     echo 'alias gedit="pkexec gedit"' >> ~/.bash_aliases 

#PKEXEC #SU #GUI #GKsu #POLKIT #policykit-1

typos and formating added explanation good practices
Source Link

Many have had similar issues with wanting to run GUI with su privileges. More recently I have looked into the lingering open terminal window. After searching this is what worked for me.

  • my usage is invoking GUI with SU from the term and/or a shell script from ~/bin using aliases.

GUI privilege escalation of "su" or "sudo" is not recommended and should never be done with out knowledge of the risks of what your doing.


  • pkexec can be obtained by the following:

     sudo apt install policykit-1 
  •  

  • Edit the bottom of this file to where it looks likes this: sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy

     sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy 
  • yours should look like this:

     <action id="org.freedesktop.policykit.lockdown"> <description>Configure lock down for an action</description> <message>Authentication is required to configure lock down policy</message> <defaults> <allow_any>auth_admin</allow_any> <allow_inactive>auth_admin</allow_inactive> <allow_active>auth_admin</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pklalockdown</annotate> </action> 
  •  

  • After that try:

     pkexec gedit 

Adding a custom bin path to terminal:

  • The Standard is to store users shell programs in

     /home/$USER/bin 

or

 ~/bin 

*These are the same location the first is the full path to file the second is short hand for

 /home/$USER/bin 
  • To add your user /bin to your $USER $PATH simply

     mkdir /home/$USER/bin 
  • terminal will now recognise your shell scripts or programs located in

     ~/bin 

Example:

 $/path/to/file.sh 

Becomes:

 $file.sh 

ADD this to .bashrc

export PATH=$PATH:$HOME/bin

Where "$HOME/bin" is the directory I assume you want to add. This change is only temporary (it works only in the current session of the shell) to make it permanent add the previous line to your .bashrc file located in your home directory.

  • I prefer this method of privilege escalation for gui apps because i can just pkexec in a shell script to run multiple programs and have the option to save credentials temporarily.

  • you then can try and add an alias to ~/.bash_aliases:

     echo 'alias gedit="pkexec gedit"' >> ~/.bash_aliases 
  • pkexec can be obtained by the following:

     sudo apt install policykit-1 
  • Edit the bottom of this file to where it looks likes this: sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy

  • yours should look like this:

     <action id="org.freedesktop.policykit.lockdown"> <description>Configure lock down for an action</description> <message>Authentication is required to configure lock down policy</message> <defaults> <allow_any>auth_admin</allow_any> <allow_inactive>auth_admin</allow_inactive> <allow_active>auth_admin</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pklalockdown</annotate> </action> 
  • After that try:

     pkexec gedit 
  • you then can try and add an alias to ~/.bash_aliases:

     echo 'alias gedit="pkexec gedit"' >> ~/.bash_aliases 

Many have had similar issues with wanting to run GUI with su privileges. More recently I have looked into the lingering open terminal window. After searching this is what worked for me.

  • my usage is invoking GUI with SU from the term and/or a shell script from ~/bin using aliases.

GUI privilege escalation of "su" or "sudo" is not recommended and should never be done with out knowledge of the risks of what your doing.


  • pkexec can be obtained by the following:

     sudo apt install policykit-1 
  •  

  • Edit the bottom of this file to where it looks likes this:

     sudo nano /usr/share/polkit-1/actions/org.freedesktop.policykit.policy 
  • yours should look like this:

     <action id="org.freedesktop.policykit.lockdown"> <description>Configure lock down for an action</description> <message>Authentication is required to configure lock down policy</message> <defaults> <allow_any>auth_admin</allow_any> <allow_inactive>auth_admin</allow_inactive> <allow_active>auth_admin</allow_active> </defaults> <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pklalockdown</annotate> </action> 
  •  

  • After that try:

     pkexec gedit 

Adding a custom bin path to terminal:

  • The Standard is to store users shell programs in

     /home/$USER/bin 

or

 ~/bin 

*These are the same location the first is the full path to file the second is short hand for

 /home/$USER/bin 
  • To add your user /bin to your $USER $PATH simply

     mkdir /home/$USER/bin 
  • terminal will now recognise your shell scripts or programs located in

     ~/bin 

Example:

 $/path/to/file.sh 

Becomes:

 $file.sh 

ADD this to .bashrc

export PATH=$PATH:$HOME/bin

Where "$HOME/bin" is the directory I assume you want to add. This change is only temporary (it works only in the current session of the shell) to make it permanent add the previous line to your .bashrc file located in your home directory.

  • I prefer this method of privilege escalation for gui apps because i can just pkexec in a shell script to run multiple programs and have the option to save credentials temporarily.

  • you then can try and add an alias to ~/.bash_aliases:

     echo 'alias gedit="pkexec gedit"' >> ~/.bash_aliases 
Source Link
Loading