Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Any idea why the following doesn't work? It hangs with no output.

desktop$ ssh myserver "sudo ausearch -k my_key"

However, the following works. It outputs the auditing history of this key from auditd.

desktop$ ssh myserver
myserver$ sudo ausearch -k my_key

The following also works. (Meaning, sudo is not currently set to require a password.)

desktop$ ssh myserver "sudo ls"
share|improve this question
up vote 2 down vote accepted

Since you logon as a normal user you might not have /sbin in your $PATH, which means that ausearch might not be found. To try this, specific /sbin/ausearch manually in your command line. For some commands you also require ssh to aquire a tty, you accomplish this with the -t flag, so to try this out, type:

ssh -t myserver "sudo /sbin/ausearch -k my_key"

To fully emulate a logged in session you can also call sudo with the -i flag, and then you can probably omit the /sbin (since it worked in your logged in session), as this:

ssh -t myserver "sudo -i ausearch -k my_key"
share|improve this answer
Thank you sir. The -t flag made it work. – richardkmiller Jan 9 '12 at 19:23

Your Answer


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.