cancel
Showing results for 
Search instead for 
Did you mean: 
TudorRaduta
Community Manager
Community Manager
  • 176 Views

My biggest sudo mistake (and how to avoid it)

A tiny typo that broke `sudo` for everyone...

Hey everyone,

Time for our weekly "problem & a polish" where we share a mistake that taught us something valuable. This week's story is a scary one I think many of us have experienced while learning.

The Problem: I needed to give a new user permission to restart a service. I opened /etc/sudoers directly with a text editor, added my line, and saved it. A minute later, I tried to run a `sudo` command and got an error. It turned out **`sudo` was now broken for everyone** because of a tiny syntax mistake I had made.

It was a heart-stopping moment and a painful reminder of a critical best practice.

The Polish: ALWAYS use the visudo command to edit the sudoers file. It's not just an editor; it's a safety net. It runs a syntax check before saving, preventing you from ever saving a broken file that could lock you (and everyone else) out.

Time to share:

  1. What's another "safety command" like visudo that has saved you from a big mistake? (e.g., `systemctl --dry-run`)
  2. Tell us about a time a small typo caused a big problem during your RHCSA practice!

Let's hear your stories in the comments!

5 Replies
Chetan_Tiwary_
Community Manager
Community Manager
  • 134 Views

Two things immediately come to my mind that were a saviour during my RHCSA preparation :

1. mount -a after editing fstab and before rebooting my server - saved me big time!!!

2. One typo - in #touch /.autorelable instead of  #touch /.autorelabel     almost cost me my RHCSA exam - that was a lucky save but it did cost a lot of time to catch it during the exam. 

TudorRaduta
Community Manager
Community Manager
  • 98 Views

@Chetan_Tiwary_ appreciate you bringing this up as it’s the kind of insight that makes the community stronger.

The mount -a reminder is a solid one and it’s exactly the kind of check that can save you from an unbootable system when working with fstab.

And the .autorelabel story… that’s a stressful catch under exam pressure. A good reminder of how a small typo in a critical file can have a big impact.

Besides sudoers, fstab, and .autorelabel, are there other files where a tiny mistake has tripped you up?

Chetan_Tiwary_
Community Manager
Community Manager
  • 65 Views

in fstab itself, if you are using the UUID then you need to careful about the correct UUID.

Then when using the firewalld-cmd command - you should not forget to run the same with --reload. 

While modifying the network connections using nmcli - you should not forget to do a connection refresh ( up/down ).

 

0 Kudos
Chetan_Tiwary_
Community Manager
Community Manager
  • 62 Views

1. Also, if you are editing any file in Linux using vim, make sure you have edited correctly and then save and exit with   :wq! 

if you feel that the file has been messed up and you want to quit editing without accidentally commiting any unwanted changes - do it with   :q!

 

2. if you are using copy paste while editing yml files in vim mode - please be careful of extra space / indentation that can come in. 

 

3. Never forget to run restorecon after changing the SELinux file context using semanage fcontext command.

0 Kudos
TudorRaduta
Community Manager
Community Manager
  • 26 Views

These are exactly the kind of “secret recipe” tips that make all the difference: the small details that separate smooth success from hours of troubleshooting. Thanks for sharing these gems @Chetan_Tiwary_ !

0 Kudos
Join the discussion
You must log in to join this conversation.