#sudoedit

Balakrishnan Balasubramanianbalki@balki.me
2025-01-22

Shell alias to view files without permission:

alias sudoview="SUDO_EDITOR='vim -c \"w! /tmp/sv\" -c \"n /tmp/sv\" ' sudoedit "

sudoedit is great to edit root owned files as regular user. But sometimes I just want to inspect the file in editor without accidentally editing it.
#vim #shell-alias #sudo #sudoedit

𝘋𝘪𝘳𝘬dirk@gts.0x7be.net
2024-09-23

[tldr]: TIL: sudoedit

I never ever was a fan of sudo because I like having my accounts properly and strictly separated. If I want to do root stuff, I become root using su -l. (And in general I will continue handling it like this in the future.)

Since my distribution’s package build system has it as hard dependency, I have sudo installed. It’s configured to never cache anything and always only ask for the root password, with no further “real” configuration. I am the only use on the system, so I don’t care about running tasks as different user (and if so, it’s the root account).

Defaults rootpw
Defaults timestamp_timeout=0
dirk ALL=(ALL) ALL

… this allows the package creation process to run properly. At a specific point I enter my root password and that’s fine. Under normal circumstances I just use su -l.

But since I recently had to configure a lot of files outside my home directory I always had the problem of a fully unconfigured editor. No proper syntax highlighting, my key combinations, etc. all not present (I prefer leaving root as unconfigured as possible).

Then I found sudoedit.

It runs in my normal environment, with all my configuration but allows me to edit files outside my $HOME. I can just replace nvim /etc/foo.bar with sudoedit /etc/foo.bar and enter the root password and then edit the file as if it was a file in my environment.

It sometimes worth leaving your comfort zone to explore new things.

//tagged: #JustLinuxThings #TIL #commandline #sudo #sudoedit #changes

2024-06-20

SuEdit — A Neovim plugin to easily edit root files

https://github.com/Grafcube/suedit.nvim

I made a small plugin that other people might find handy. It checks if the file open in the current buffer has write access and if not, prompts for sudo (or any other command at your choice) and copies the file.

No longer do you need to care about forgetting to use sudoedit or anything else, just edit the files you want to edit! This could change the world!!1!

But in all seriousness, this is my first neovim plugin and I barely spent an hour on it but it's simple and it gets the job done. It scratches a minor itch and maybe you'll also find it useful.

@neovim@programming.dev #neovim #opensource #foss #plugin #lua #sudoedit

2023-01-20

Serious privilege escalation bug was discovered in #sudoedit. Make sure to upgrade #Sudo to v1.9.12.p2 ASAP or revoke access to sudoedit until Sudo is patched for your #Linux distribution.

CVE-2023-22809: Sudoedit can edit arbitrary files
seclists.org/oss-sec/2023/q1/4

#security #cve

2023-01-20

CVE-2023-22809: Sudoedit can edit arbitrary files
seclists.org/oss-sec/2023/q1/4

Nasty #sudoedit privilege escalation bug. You'll want to update sudoedit to 1.9.12.p2 or revoke access to sudoedit while the update is available for your distribution.

#sudo #security #cve

Eth[̲̅a]n H[̲̅a]nsen :donor:farewell_ladmin@infosec.exchange
2023-01-19

Granted this requires a specific and as far as I can tell non standard config but "Sudoedit can edit arbitrary files" is a heck of a thing to read :toot:​

seclists.org/oss-sec/2023/q1/4
synacktiv.com/sites/default/fi
sudo.ws/security/advisories/su

#CVE_2023_22809 #sudo #sudoedit

2022-12-07

@Tanath @nixCraft You're right. I wanted to relativize "the only right way." A smiley like 😆 might have been better suited.

If y'all don't know #sudoedit, you should read up about it. It probably is the most *secure* way to edit files with root rights (and using #sudo anyway).

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst