2

Flags/arguments to sudo on my system aren't working.

peter@Sirius:~$ sudo -h
env: -h: No such file or directory
peter@Sirius:~$ sudo -u postgres
env: -u: No such file or directory

However, executables in sudo's path work fine. My problem is not being removed from the admin group, or having a corrupted /etc/sudoers file. Reinstalling sudo did not fix it, either -- https://askubuntu.com/a/46459/42720

Recently upgraded to 12.04; no other problems with the upgrade.

Any ideas? Thanks

1 Answers1

1

The problem probably is that the sudo you are running is probably different from the system's sudo.

This is (probably) a user configuration.

FIRST: Check if using /usr/bin/sudo works ok, to test that hipotesis.

IF IT DOES: Then either you are using another binary, or an alias

USING ANOTHER BINARY: Users can make different versions of system binaries to use (usually, they are just scripts). To check for that possibility, run which sudo. This will tell you the location of the sudo you are running. IF it says /usr/bin/sudo, then we exclude this possibility. If something else, that is probably the problem

USING AN ALIAS: an alias is a lightweight way to personalize commands. Instead of writing a binary, you make a small alteration, such as adding an option. This is done in configuration scripts for BASH, the program that reads the commands. To check for that, type alias and see if sudo appears on the list. If it does, then this is probably the problem. Use find ~/ -maxdepth 1 -size -20k -exec grep -H 'alias sudo.*' {} \; to find the file that is setting up the alias (Some common guesses would be: ~/.bashrc ; ~/.bash_profile ; ~/.bash_login and ~/.profile ). If you cant find the file, use find ~/ -size -20k -exec grep -H 'alias sudo.*' {} \; instead, to look at all of your user's files. (this will take a long time)

josinalvo
  • 6,947
  • 5
  • 37
  • 51
  • Yes, this is what I ended up doing. It was an alias. With the -20k argument it was actually very fast, even though my home directory is large. Thanks – Peter Becich Sep 07 '12 at 01:40