visudo: sudoers file busy, try again later

Quick note on how to un-lock yourself from a failed visudo session.

If you've accidentally locked yourself out either via an accidental crtl-c or system restart and you were in the middle of editing /etc/sudoers via visudo there are two steps to take to restore it to a normal state (aka un-lock yourself)

I've done the following on an Ubuntu GNU/Linux system -- but I'm assuming it is fairly cross-platform.

1) rm /etc/sudoers.tmp -- this is the lockfile visudo creates

2) Double check permissions. If the /etc/sudoers file is not 440 (r--,r--,---) sudoers will barf. (Edit: Originally I had said to chmod u+x /etc/sudoers, but this was not correct, and could prevent you from sudoing)