I’m trying to update my grub boot order back to booting the first option instead of the second, so I run sudo nano /etc/default/grub, but it brings up this, which is not the file I want to edit.
I’m on fedora 38

I’m trying to update my grub boot order back to booting the first option instead of the second, so I run sudo nano /etc/default/grub, but it brings up this, which is not the file I want to edit.
I’m on fedora 38

For improved security during file edits that require root access, it’s highly advised to use
sudoedit(orsudo -e). This method is considered the standard practice to avoid the security pitfalls associated with directly invoking editors withsudo. To ensure the use ofnanowithsudoedit, simply set theVISUALenvironment variable withexport VISUAL=nanobefore runningsudoedit. Alternatively, for a one-off command:VISUAL=nano sudoedit /path/to/file.Please note that while
sudoeditis a safer starting point, it’s not the only method available. Alternatives such asdoas,doasedit, or leveragingpolkitwithpkexeccan offer even more controlled and secure ways to manage file editing with elevated privileges. However, it’s perfectly acceptable to stick withsudoedit, as it’s a commonly trusted tool.Be aware that direct usage of
sudo nanoor other editors is strongly discouraged. It bypasses important security mechanisms and can lead to inadvertent system-wide risks.EDIT: changed
VISUAL=nano sudoedittoVISUAL=nano sudoedit /path/to/file.On shared systems with untrusted users, you’re right. On your own system when you already have full admin rights,
sudo nanois fine and doesn’t have any security implications that I’m aware of.