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

On Ubuntu 13.04 running in EC2, all commands through sudo work fine except ls. Here are some example commands to illustrate the issue:

ubuntu at host in ~
$ sudo ls
sudo: command: command not found

ubuntu at host in ~
 1 $ sudo which ls
/bin/ls

ubuntu at host in ~
$ sudo /bin/ls
bin  dotfiles  init  npm  tmp

ubuntu at host in ~
$ sudo pwd
/home/ubuntu

ubuntu at host in ~
$ sudo which pwd
/bin/pwd

ubuntu at host in ~
$ echo wtf
wtf

My dotfiles are here https://github.com/mike-spainhower/dotfiles

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Line 40 of your .aliases is aliasing ls to a command called 'command'. Your system can't find this program named 'command'.

You can tell from your first sample error: the first instance of the word 'command' is the system naming the program it failed to find.

share|improve this answer
    
Derp. Thank you for finding that. I guess the question for me now is why access to command is not allowed via sudo. It works as root and there is no indication in visudo nor /etc/sudoers.d that it's disallowed (ALL is used for commands) –  Mike S Oct 7 '13 at 15:40
    
command is a bash built-in, not a program per se. You can see the same behavior with sudo cd. In general, sudo against built-ins usually doesn't accomplish what you think it would. –  Joshua Miller Oct 7 '13 at 22:55
add comment

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.