Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Question is;

I just setup AWS EC2 micro instance = Ubuntu 11.04 32bit - (ami-e9d81980) All is running well. Added new user successfully and now want to give root access to new-user. So I did;

$ sudo visudo
new-user    ALL=(ALL) ALL

Problem is when I ESC:wq I get [ Unknown Command ] - Scratching my head. Any help would be appreciated. Thank you.

share|improve this question

migrated from stackoverflow.com Jan 16 '12 at 3:56

This question came from our site for professional and enthusiast programmers.

3  
If you type :help to what you think is vi, do you get the usual vim help page? Or do you get some other pile of nonsense? I wonder if some horrible editor like nano or worse is being used in place of vim. Check ls -l /usr/bin/editor /etc/alternatives/editor to see what program is likely spawned by visudo. –  sarnold Jan 16 '12 at 3:53
    
Thank you Charles. Will check there. –  mrmoe Jan 16 '12 at 3:54
    
+1: That [ Unknown Command ] sounds exactly like nano. Try Ctrl-X to exit and save your changes. –  fission Jan 16 '12 at 3:58
    
Just wanted to add that sudo visudo is a dangerous pattern because if you change the sudoers file such that you no longer have permission to run sudo visudo you can lock yourself out of your own system. Use sudo -s or sudo bash first and then run visudo as the root user. Test your changes before logging out of the root user. –  Ladadadada Feb 29 '12 at 10:27

2 Answers 2

Your best bet in Ubuntu is to switch your editor in alternatives:

sudo update-alternatives --config editor

and select one of the vim options.

share|improve this answer

This is sounds like you have no vim editor as default in your machine, inorder to use the vim as editor.

Execute below command, to make vim as editor

# export EDITOR=vim

And now try to edit the file visudo /etc/sudoers (Ubuntu) and save by executing the vim commands ESC !wq

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.