I'm running a terminal application via "su" in this fashion:

su -c "/path/to/app --args" username

This is done from a root context, and 'username' is a less privileged user in the system. The application has signal handlers for CTRL-C and CTRL-Z (SIGINT and SIGTSTP, respectively). One odd problem I've come across is that CTRL-Z does not appear to propagate to the application when run via 'su' in this fashion. If I remove the 'username' from the end of the command above, then it works fine. Only when there is a user switch using su does this signal not work.

Is there a way to allow TSTP to propagate through to a program being executed as a different user?

Tested using CentOS 6.4; GNU Coreutils 8.4

  • 1
    Seems to me that a better solution might be to use sudo instead of su. – mdpc Dec 1 '14 at 22:40
  • 'sudo -u username /path/to/app --args' does indeed work. IMO this answers the question, so please submit and I will accept it. – KyleL Dec 2 '14 at 15:10

Using 'sudo' instead of 'su' solved the problem, as suggested by mdpc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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