Line numbers in /etc/sudoers file ?
Hi,
How to get the Line numbers in /etc/sudoers file ? sudo: >>> /usr/local/etc/sudoers: syntax error near line 39 <<< sudo: >>> /usr/local/etc/sudoers: syntax error near line 55 <<< sudo: >>> /usr/local/etc/sudoers: syntax error near line 57 <<< sudo: parse error in /usr/local/etc/sudoers near line 39 How to find the Line numbers 39,55,57 in /etc/sudoers file ? Is their any command to display the line numbers in /etc/sudoers file ? Please help me in knowing that command. Regards, Aparna. |
well that's nothign to do with sudo, just the text editor you decide to use. Under vi (and so for visudo) just type ":39" in command mode.
|
You can use the 'nl' utility to number the lines:
Code:
nl -nln /usr/local/etc/sudoers Code:
nl -ba -nln /usr/local/etc/sudoers You can pass it through grep: Code:
nl -nln /usr/local/etc/sudoers | grep -E "(^39|^55|^57)" Hope it helps. |
Just for completeness: You wouldn't have problems with syntax errors in the sudoers file if you would edit in the recommended way using visudo.
|
Quote:
(Well, technically, that's assuming "Defaults editor" is set to nvi(1) or vim(1). If not, then use cat(1) with -n option to see line numbers.) |
All times are GMT -5. The time now is 12:56 PM. |