sudo ENV_KEEP not always preserving
        Posted  
        
            by 
                mafro
            
        on Super User
        
        See other posts from Super User
        
            or by mafro
        
        
        
        Published on 2014-06-10T01:43:42Z
        Indexed on 
            2014/06/10
            3:29 UTC
        
        
        Read the original article
        Hit count: 475
        
When I run sudo -s, my environment is preserved. However, when running a simple sudo <command> it appears not to be preserved.
The contents of my sudoers file:
mafro@ip-10-xx-xx-250:~ > sudo cat /etc/sudoers.d/mafro
Defaults env_reset
Defaults env_keep += "HOME"
mafro   ALL=(ALL)       NOPASSWD:ALL
Using sudo -s, the ll alias is available:
mafro@ip-10-xx-xx-250:~ > sudo -s
root@ip-10-xx-xx-250:~ > ll
total 8K
drwxrwxr-x  2 mafro dev 4.0K Jun  9 23:59 bin
drwxr-xr-x 20 mafro dev 4.0K Jun  9 23:59 dotfiles
Using straight sudo, it is not:
mafro@ip-10-xx-xx-250:~ > sudo ll
sudo: ll: command not found
What is happening here?
© Super User or respective owner