2009/10/1 Arthur D. <spinal...@mail.ru>

>  I'm using a 4 years old system, and if I change that line, log out and
>> in again, it changes the env variable and everything works (that means
>> the behavior is probably caused by your configuration). If visudo is
>> still using that configuration, maybe that's because some
>> configuration file has precedence over environment variables. In that
>> case, you gotta find that file and change it.
>>
>> Not an easy task, anyway... I just did an "grep -r /bin/nano" in /etc.
>> LOL, I know there's a better way, I'm just too lazy to look for it...
>>
>
> Man, running "sudo visudo" and just running "visudo" is not the same.
> Be careful. Nano is hardcoded in sudo's ebuild.
>
>

OK, for the Nth time on this thread - it is all about *YOUR* configuration
*IN YOUR SUDOERS FILE* - *by default*, sudo DOES NOT preserve the
environmental variables of the current user - it *DOES NOT* replace them
with variables from your profile, as *IT IS NOT RUNNING THE COMMAND IN AN
INTERACTIVE SHELL LOGIN* - if you want that behaviour, try using "sudo -i".

To see *VERY EXPLICITLY* what you have been told *OVER AND OVER* on this
thread, do the following:

sudo env
sudo -i env


and look at the difference. Unless *YOU* configure sudo the *NOT* reset
environmental variables, it is configured *BY DEFAULT* to blank out all but
a very few - once again, *THIS INCLUDES THE EDITOR VARIABLE*.

Once again, to fix the issue, do one of the 3 following procedures:

1 - Make all users preserve env variables when using sudo (least secure):

sudo -i visudo   #This will start a visudo session *with vim*, since you are
using the -i option, which causes sudo to execute the command from an
interactive shell (which will read all env variables as you have configured)
comment out the line that reads:

Defaults        env_reset

save, quit, and now your problem is solved.

2 - Make only users in the "wheel" group preserve env variables when using
sudo (more secure):

sudo -i visudo
uncomment out the line that reads:

#Defaults:%wheel        !env_reset

save, quit
if your user is not already in the "wheel" group, add it into it:

gpasswd -a <username> wheel

then log out and log back in, and now your problem is solved.


3 - Make only the "EDITOR" env variable preserved when using sudo (even more
secure):

sudo -i visudo
add the following line:

Defaults     env_delete-=EDITOR

save, quit


Now, there are *NUMEROUS* other ways that *YOU* can fix *YOUR CONFIG* to
solve *YOUR PROBLEM* - *HOWEVER*, continually ignoring the numerous fixes
that other users have replied to you with, and being hostile towards both
devs *and* the user community ("Proof?" WTF is your problem? You come here
asking for help, and then ignore the help you're given, and accuse a *very*
long-time user and *very* respected member of the community of *lying* to
you when he is trying to help you? Get your attitude fixed - seriously).

I hope that helps get your problem (and your hostility) resolved.

-James


> --
> Best regards, Spinal
>
>

Reply via email to