gksudo 16.10

Ralf Mardorf silver.bullet at zoho.com
Sun Nov 6 12:21:19 UTC 2016

On Sun, 06 Nov 2016 23:01:03 +1100, Karl Auer wrote:
>On Sun, 2016-11-06 at 12:05 +0100, Ralf Mardorf wrote:
>> [root at archlinux ~]# sudo -u rocketmouse echo $HOME
>> /root  
>When you use a variable on the command line it is expanded before the
>command line is executed. So the above command is the equivalent of:
>   sudo -u rocketmouse echo "/root"
>> [root at archlinux ~]# sudo -u rocketmouse HOME=/home/rocketmouse echo
>> $HOME   
>Again, $HOME is expanded before the assignment is made, so that command
>is the equivalent of:
>   sudo -u rocketmouse HOME=/home/rocketmouse echo "/root"
>So you will need to rethink many of those tests...

When a user runs
  sudo HOME=/root appname
the /root directory is used.
The home directory of "username" also is used when running
  gksudo -u username app
so why isn't "echo $HOME" not equal to the used directory?

More information about the ubuntu-users mailing list