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

I'm running rsync from a php script using backtick operators. It's running as an apache user.

In /etc/sudoers, I've set

#Defaults requiretty
Cmnd_Alias REPORTS = /usr/bin/rsync

In the error log, I'm getting these errors

sudo: can't stat /var/run/sudo: Permission denied
sudo: no tty present and no askpass program specified

Also, not that the rsync path is correct, and so is the rsync command in php. I can run the command as root, also if I add NOPASSWD to another user, i can sudo and run the same command.

share|improve this question
up vote 5 down vote accepted

This is likely because sudo requires a TTY session to run. You can force sudo to assume/use a TTY by passing in the -t arguments, i.e.:

sudo -tt /usr/bin/rsync
share|improve this answer
Where is this -t thing documented? I can't get it to work. – Tobu May 9 '11 at 18:18
-t is option related to SELinux – mmv-ru Dec 8 '11 at 10:45

Disable SELINUX(/etc/selinux/config SELINUX=disabled and reboot).

share|improve this answer

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.