Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #190696 > unrolled thread
| Started by | John Ratliff <john@bluemarble.net> |
|---|---|
| First post | 2018-01-05 21:10 +0100 |
| Last post | 2018-01-06 04:40 +0100 |
| Articles | 10 — 6 participants |
Back to article view | Back to linux.debian.user
vipw and vigr default editor John Ratliff <john@bluemarble.net> - 2018-01-05 21:10 +0100
Re: vipw and vigr default editor Greg Wooledge <wooledg@eeg.ccf.org> - 2018-01-05 21:20 +0100
Re: vipw and vigr default editor Ulf Volmer <u.volmer@u-v.de> - 2018-01-05 21:40 +0100
Re: vipw and vigr default editor Greg Wooledge <wooledg@eeg.ccf.org> - 2018-01-05 21:50 +0100
Re: vipw and vigr default editor Brian <ad44@cityscape.co.uk> - 2018-01-05 21:50 +0100
Re: vipw and vigr default editor Roberto C. Sánchez <roberto@debian.org> - 2018-01-05 21:50 +0100
Re: vipw and vigr default editor Ulf Volmer <u.volmer@u-v.de> - 2018-01-05 22:00 +0100
Re: vipw and vigr default editor Roberto C. Sánchez <roberto@debian.org> - 2018-01-05 21:30 +0100
Re: vipw and vigr default editor John Ratliff <john@bluemarble.net> - 2018-01-05 23:10 +0100
Re: vipw and vigr default editor Charles Kroeger <ckrogrr@frankensteinface.com> - 2018-01-06 04:40 +0100
| From | John Ratliff <john@bluemarble.net> |
|---|---|
| Date | 2018-01-05 21:10 +0100 |
| Subject | vipw and vigr default editor |
| Message-ID | <v4Gts-8kd-7@gated-at.bofh.it> |
When I run sudo vipw or sudo vigr, it uses nano as the default editor. I've already used update-alternatives to select vim as my default editor, but this doesn't seem to work for vipw/vigr. I have to do sudo EDITOR=vim vipw How can I make vim the default editor for vipw/vigr. Or how can I set the EDITOR variable when I use sudo automatically? Thanks. --John
[toc] | [next] | [standalone]
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Date | 2018-01-05 21:20 +0100 |
| Message-ID | <v4GD8-8nv-1@gated-at.bofh.it> |
| In reply to | #190696 |
On Fri, Jan 05, 2018 at 03:00:43PM -0500, John Ratliff wrote: > I have to do > > sudo EDITOR=vim vipw > > How can I make vim the default editor for vipw/vigr. Or how can I set the > EDITOR variable when I use sudo automatically? By default, sudo strips all the useful variables out of your environment. If you want it to *keep* your environment, you need to change the /etc/sudoers file (with "sudo EDITOR=whatever visudo"). One way to do it is: Defaults env_reset Defaults:greg !env_reset ... where "greg" is the username who is trusted to set environment vars.
[toc] | [prev] | [next] | [standalone]
| From | Ulf Volmer <u.volmer@u-v.de> |
|---|---|
| Date | 2018-01-05 21:40 +0100 |
| Message-ID | <v4GWt-8tz-1@gated-at.bofh.it> |
| In reply to | #190697 |
On 05.01.2018 21:15, Greg Wooledge wrote: > On Fri, Jan 05, 2018 at 03:00:43PM -0500, John Ratliff wrote: >> sudo EDITOR=vim vipw > Defaults env_reset > Defaults:greg !env_reset That basically keeps the *whole* environment, what is usually a security issue. Better solution is to keep only needed and proved environment variables using Defaults env_keep += "EDITOR" best regards, Ulf
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Date | 2018-01-05 21:50 +0100 |
| Message-ID | <v4H69-59-1@gated-at.bofh.it> |
| In reply to | #190700 |
On Fri, Jan 05, 2018 at 09:37:16PM +0100, Ulf Volmer wrote: > On 05.01.2018 21:15, Greg Wooledge wrote: > > On Fri, Jan 05, 2018 at 03:00:43PM -0500, John Ratliff wrote: > > >> sudo EDITOR=vim vipw > > > Defaults env_reset > > Defaults:greg !env_reset > > That basically keeps the *whole* environment, what is usually a security > issue. Better solution is to keep only needed and proved environment > variables using > > Defaults env_keep += "EDITOR" It all depends on how much trust this "greg" person. I hear they can be very sneaky.
[toc] | [prev] | [next] | [standalone]
| From | Brian <ad44@cityscape.co.uk> |
|---|---|
| Date | 2018-01-05 21:50 +0100 |
| Message-ID | <v4H69-59-3@gated-at.bofh.it> |
| In reply to | #190700 |
On Fri 05 Jan 2018 at 21:37:16 +0100, Ulf Volmer wrote: > On 05.01.2018 21:15, Greg Wooledge wrote: > > On Fri, Jan 05, 2018 at 03:00:43PM -0500, John Ratliff wrote: > > >> sudo EDITOR=vim vipw > > > Defaults env_reset > > Defaults:greg !env_reset > > That basically keeps the *whole* environment, what is usually a security > issue. Better solution is to keep only needed and proved environment > variables using > > Defaults env_keep += "EDITOR" This is all very incredibly useful. Roberto C. Sánchez has the answer though. -- Brian.
[toc] | [prev] | [next] | [standalone]
| From | Roberto C. Sánchez <roberto@debian.org> |
|---|---|
| Date | 2018-01-05 21:50 +0100 |
| Message-ID | <v4H69-59-7@gated-at.bofh.it> |
| In reply to | #190700 |
On Fri, Jan 05, 2018 at 09:37:16PM +0100, Ulf Volmer wrote: > > That basically keeps the *whole* environment, what is usually a security > issue. Better solution is to keep only needed and proved environment > variables using > > Defaults env_keep += "EDITOR" > Allowing the EDITOR variable through is a gigantic security issue. Its value gets passed as a command to the shell: roberto@debian:~$ sudo EDITOR='echo "I have the power!"' vipw I have the power! /etc/passwd.edit vipw: /etc/passwd is unchanged There is essentially no functional difference between allowing only the EDITOR variable and any arbitrary environment variable. Allowing EDITOR (or PAGER, or any other thing that sets the name of a command to execute) through to sudo provides an effective route to bypass any sudo restrictions. Regards, -Roberto -- Roberto C. Sánchez
[toc] | [prev] | [next] | [standalone]
| From | Ulf Volmer <u.volmer@u-v.de> |
|---|---|
| Date | 2018-01-05 22:00 +0100 |
| Message-ID | <v4HfP-8Y-3@gated-at.bofh.it> |
| In reply to | #190703 |
On 05.01.2018 21:46, Roberto C. Sánchez wrote: > There is essentially no functional difference between allowing only the > EDITOR variable and any arbitrary environment variable. Allowing EDITOR > (or PAGER, or any other thing that sets the name of a command to > execute) through to sudo provides an effective route to bypass any sudo > restrictions. OK. Thanks for correction. best regards, Ulf
[toc] | [prev] | [next] | [standalone]
| From | Roberto C. Sánchez <roberto@debian.org> |
|---|---|
| Date | 2018-01-05 21:30 +0100 |
| Message-ID | <v4GMO-8qH-7@gated-at.bofh.it> |
| In reply to | #190696 |
On Fri, Jan 05, 2018 at 03:00:43PM -0500, John Ratliff wrote: > When I run > > sudo vipw or sudo vigr, it uses nano as the default editor. I've already > used update-alternatives to select vim as my default editor, but this > doesn't seem to work for vipw/vigr. > > I have to do > > sudo EDITOR=vim vipw > > How can I make vim the default editor for vipw/vigr. Or how can I set the > EDITOR variable when I use sudo automatically? > Try 'sudo select-editor' Regards, -Roberto -- Roberto C. Sánchez
[toc] | [prev] | [next] | [standalone]
| From | John Ratliff <john@bluemarble.net> |
|---|---|
| Date | 2018-01-05 23:10 +0100 |
| Message-ID | <v4Ilz-13H-7@gated-at.bofh.it> |
| In reply to | #190698 |
On 1/5/2018 3:25 PM, Roberto C. Sánchez wrote: > On Fri, Jan 05, 2018 at 03:00:43PM -0500, John Ratliff wrote: >> When I run >> >> sudo vipw or sudo vigr, it uses nano as the default editor. I've already >> used update-alternatives to select vim as my default editor, but this >> doesn't seem to work for vipw/vigr. >> >> I have to do >> >> sudo EDITOR=vim vipw >> >> How can I make vim the default editor for vipw/vigr. Or how can I set the >> EDITOR variable when I use sudo automatically? >> > Try 'sudo select-editor' > > Regards, > > -Roberto > Thanks. This was the solution. --John
[toc] | [prev] | [next] | [standalone]
| From | Charles Kroeger <ckrogrr@frankensteinface.com> |
|---|---|
| Date | 2018-01-06 04:40 +0100 |
| Message-ID | <v4NuV-4g5-1@gated-at.bofh.it> |
| In reply to | #190696 |
if you're in a hurry in this situation try: apt-get remove --purge nano problem solved? -- CK
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web