Bug 903

Summary: Since 1.8.28, sudo -E does not preserve aliases anymore
Product: Sudo Reporter: Guillaume Pavese <guillaume.pavese>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED INVALID    
Severity: normal CC: guillaume.pavese
Priority: low    
Version: 1.8.28   
Hardware: PC   
OS: Linux   
Attachments: Diff between sudoers file included in sudo-1.8.27-3.fc31 and sudo-1.8.28-1.fc31

Description Guillaume Pavese 2019-10-24 20:39:46 MDT
On Fedora 31 and preceding, I used to be able to call aliases defined in my .bashrc by using 'sudo -E'
Since update to sudo 1.8.28, 'sudo -E' seems to not preserve aliases from the calling user : "command not found"
Comment 1 Todd C. Miller 2019-10-24 21:45:53 MDT
Do you know what version of sudo you were running before?  I don't think that bash can preserve aliases between shells, though it can export functions into the environment so that sub-shells pick them up.
Comment 2 Guillaume Pavese 2019-10-25 03:29:42 MDT
I went from working sudo-1.8.27-3.fc31 to sudo-1.8.28-1.fc31
Comment 3 Todd C. Miller 2019-10-25 08:08:59 MDT
If you comment out the following line in sudoers sudo should behave the way you expect:

Defaults    always_set_home

In sudo 1.8.28 that setting will prevent HOME from being preserved which is why your .bashrc is not being read.
Comment 4 Todd C. Miller 2019-10-25 08:18:49 MDT
Created attachment 532 [details]
Diff between sudoers file included in sudo-1.8.27-3.fc31 and sudo-1.8.28-1.fc31

This is not due to any change in sudo itself, it is due to the addition of the always_set_home setting in the default sudoers file shipped by fedora.

I've attached a diff of the two sudoers files installed by fedora.  This is not the default sudoers that ships with sudo, it is a file maintained by the fedora project.
Comment 5 Todd C. Miller 2019-10-25 08:19:24 MDT
This is not due to a sudo bug, it is a change in fedora's sudoers configuration.
Comment 6 Guillaume Pavese 2019-10-26 02:21:18 MDT
Thanks, I confirm that this was the problem