Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exit/save edit to sudoers file? Putty SSH

Tags:

sudoers

Been following instructions for editing sudoers file, made changes but the instructions say to exit using ctrl+x - this just gives me a capital X and a caret. Have tried ctrl:x ctrl+Q Esc.

Not using nano or any other gui (just putty terminal), the change I am trying to save is to set nano as default editor.

I just need to know which keys do I press and in which order?

Also as a side question are there any 'good' linux tutorial sites, I seem to trawl for hours trying to find the simplest answers? 'Good' as in explained well and without omitting vital info (like which gui you are using).

like image 636
Gonzalez Avatar asked Oct 04 '12 21:10

Gonzalez


People also ask

How do I get out of sudo visudo?

Upon finding an error, visudo will print a message stating the line number(s) where the error occurred and the user will receive the “What now?” prompt. At this point the user may enter 'e' to re-edit the sudoers file, 'x' to exit without saving the changes, or 'Q' to quit and save changes.

How do I exit sudoers?

If you run sudo su , that will open a shell as the superuser. Type exit or Ctrl - D to exit this shell.


2 Answers

To make changes to sudo from putty/bash:

  • Type visudo and press enter.
  • Navigate to the place you wish to edit using the up and down arrow keys.
  • Press insert to go into editing mode.
  • Make your changes - for example: user ALL=(ALL) ALL.
  • Note - it matters whether you use tabs or spaces when making changes.
  • Once your changes are done press esc to exit editing mode.
  • Now type :wq to save and press enter.
  • You should now be back at bash.
  • Now you can press ctrl + D to exit the session if you wish.
like image 177
Gonzalez Avatar answered Oct 04 '22 04:10

Gonzalez


Just open file by nano /file_name

Once done, press CTRL+O and then Enter to save. Then press CTRL+X to return.

Here CTRL+O : is CTRL and O for Orange Not 0 Zero

like image 28
Shiv Singh Avatar answered Oct 04 '22 03:10

Shiv Singh