1 |
2009/10/1 Arthur D. <spinal.by@××××.ru> |
2 |
|
3 |
> I'm using a 4 years old system, and if I change that line, log out and |
4 |
>> in again, it changes the env variable and everything works (that means |
5 |
>> the behavior is probably caused by your configuration). If visudo is |
6 |
>> still using that configuration, maybe that's because some |
7 |
>> configuration file has precedence over environment variables. In that |
8 |
>> case, you gotta find that file and change it. |
9 |
>> |
10 |
>> Not an easy task, anyway... I just did an "grep -r /bin/nano" in /etc. |
11 |
>> LOL, I know there's a better way, I'm just too lazy to look for it... |
12 |
>> |
13 |
> |
14 |
> Man, running "sudo visudo" and just running "visudo" is not the same. |
15 |
> Be careful. Nano is hardcoded in sudo's ebuild. |
16 |
> |
17 |
> |
18 |
|
19 |
OK, for the Nth time on this thread - it is all about *YOUR* configuration |
20 |
*IN YOUR SUDOERS FILE* - *by default*, sudo DOES NOT preserve the |
21 |
environmental variables of the current user - it *DOES NOT* replace them |
22 |
with variables from your profile, as *IT IS NOT RUNNING THE COMMAND IN AN |
23 |
INTERACTIVE SHELL LOGIN* - if you want that behaviour, try using "sudo -i". |
24 |
|
25 |
To see *VERY EXPLICITLY* what you have been told *OVER AND OVER* on this |
26 |
thread, do the following: |
27 |
|
28 |
sudo env |
29 |
sudo -i env |
30 |
|
31 |
|
32 |
and look at the difference. Unless *YOU* configure sudo the *NOT* reset |
33 |
environmental variables, it is configured *BY DEFAULT* to blank out all but |
34 |
a very few - once again, *THIS INCLUDES THE EDITOR VARIABLE*. |
35 |
|
36 |
Once again, to fix the issue, do one of the 3 following procedures: |
37 |
|
38 |
1 - Make all users preserve env variables when using sudo (least secure): |
39 |
|
40 |
sudo -i visudo #This will start a visudo session *with vim*, since you are |
41 |
using the -i option, which causes sudo to execute the command from an |
42 |
interactive shell (which will read all env variables as you have configured) |
43 |
comment out the line that reads: |
44 |
|
45 |
Defaults env_reset |
46 |
|
47 |
save, quit, and now your problem is solved. |
48 |
|
49 |
2 - Make only users in the "wheel" group preserve env variables when using |
50 |
sudo (more secure): |
51 |
|
52 |
sudo -i visudo |
53 |
uncomment out the line that reads: |
54 |
|
55 |
#Defaults:%wheel !env_reset |
56 |
|
57 |
save, quit |
58 |
if your user is not already in the "wheel" group, add it into it: |
59 |
|
60 |
gpasswd -a <username> wheel |
61 |
|
62 |
then log out and log back in, and now your problem is solved. |
63 |
|
64 |
|
65 |
3 - Make only the "EDITOR" env variable preserved when using sudo (even more |
66 |
secure): |
67 |
|
68 |
sudo -i visudo |
69 |
add the following line: |
70 |
|
71 |
Defaults env_delete-=EDITOR |
72 |
|
73 |
save, quit |
74 |
|
75 |
|
76 |
Now, there are *NUMEROUS* other ways that *YOU* can fix *YOUR CONFIG* to |
77 |
solve *YOUR PROBLEM* - *HOWEVER*, continually ignoring the numerous fixes |
78 |
that other users have replied to you with, and being hostile towards both |
79 |
devs *and* the user community ("Proof?" WTF is your problem? You come here |
80 |
asking for help, and then ignore the help you're given, and accuse a *very* |
81 |
long-time user and *very* respected member of the community of *lying* to |
82 |
you when he is trying to help you? Get your attitude fixed - seriously). |
83 |
|
84 |
I hope that helps get your problem (and your hostility) resolved. |
85 |
|
86 |
-James |
87 |
|
88 |
|
89 |
> -- |
90 |
> Best regards, Spinal |
91 |
> |
92 |
> |