When managing a Linux system, there are times when you may need to modify the /etc/sudoers
file to adjust user privileges. However, editing this file incorrectly can lock you out of your administrative privileges or cause serious system issues.
The safest way to edit the /etc/sudoers
file is by using the visudo
command, which prevents syntax errors and file corruption.
By default, visudo
uses the system’s default text editor (often Vim), but you can change this to an editor you prefer. Below, we’ll show you how to safely change the visudo
editor on Ubuntu and Debian.