You are not logged in.
nano will inspect the name of the binary to determine the restricted mode (ie. eg. symlinking it to /usr/bin/superrestrictednano would still execute regular nano) - that's a common code pattern.
Can you mount eg. an ext4 usb key and copy /mnt/bin/nano, /mnt/bin/rnano and try that as visudo editor (to the the btrfs partition out of the equation as much as possible)?
https://wiki.archlinux.org/title/Btrfs#btrfs_check - do NOT casually use "--repair", we just want to know whether there're some detectable problems.
Online
copied them to /boot (FAT 32); this time even /boot/nano isn't found. it's like the only possible valid value is /usr/bin/nano
running /boot/rnano works as expected (restricted)
Offline
***grummelbrummelgrummelbrummelgrummelbrummelgrummelbrummel***
echo $SUDO_EDITOR $VISUAL $EDITOROnline
$SUDO_EDITOR is undefined
$VISUAL $EDITOR are set to nano
Offline
VISUAL=rnano EDITOR=rnano visudo?
Online
$ VISUAL=rnano EDITOR=rnano visudo
visudo: no editor found (editor path = /usr/bin/rnano)VISUAL and EDITOR are ignored due to !env_editor. if I remove the line, then EDITOR / VISUAL is respected as long as I don't pass it rnano
Last edited by Cvlc (2021-09-28 14:23:59)
Offline
Supposedly. There must be *some* bug in sudo's editor filtering, so we're using the BGF ;-)
Last edited by seth (2021-09-28 14:24:33)
Online
Just reproduced my whole setup in a VM, and visudo with rnano works as expected.
Insults still don't work though, so that confirms that it's unrelated.
This is crazy !
[edit]
well actually, not my whole setup, I didn't install Gnome in the VM. the rest is mostly the same
Last edited by Cvlc (2021-09-28 15:44:25)
Offline
OK I think it has something to do with the environment variables.
because
# EDITOR=/usr/bin/rnano visudoworks together with
env_reset,editor=/usr/bin/rnano, !env_editorin sudoers file.
For some reason, rnano has to be set with EDITOR= to the same value it is configured with editor= in the sudoers file, otherwise it conflicts....
[EDIT]
And YES, removing EDITOR=nano / VISUAL = nano from /etc/environment solves it......!!!
so I guess it's a bug ?
(btw I had set them to nano following Nano#Replacing_vi_with_nano )
Last edited by Cvlc (2021-09-28 16:12:58)
Offline
# EDITOR=/usr/bin/rnano visudoHere's btw. the difference, I ran "sudo visudo" all the time…
% sudo -i
# echo $EDITOR
vim
# LC_ALL=C visudo
visudo: no editor found (editor path = /usr/bin/rvim)
# EDITOR= visudo # works
# SUDO_EDITOR=rvim visudo # works as wellplugins/sudoers/editor.c starts find_editor(.) by testing $SUDO_EDITOR, $VISUAL and $EDITOR and that seems to skew the resolution.
Setting EDITOR to a bogus value ("gnarf") doesn't work either, so hitting ENOENT doesn't help here.
For more I'd have to compile sudo and debug it, but it certainly seems like a bug in sudo to not resolve a collision between def_editor and env_editor in favor of the former.
Online
Alright then, should I file a bug ?
For my use case I'll just set EDITOR to rnano and that should work, but still not satisfactory.
Offline
Online
haha just found it was about to post back ![]()
thanks for doing it and for taking the time for such a stupid issue ![]()
Offline