Home Forums HAast (High Availability for Asterisk) Configuration & Optimization sudo error issuing ssh command from post-sync script

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • Avatar photoCustomer Inquiry
    Member
    Post count: 197

    I am developing a post-sync script which works great when I run it from the BASH command line. However, when Haast runs the script I get the error “sorry you must have a tty to run sudo”.

    How do I fix this?

    Avatar photoTelium Support Group
    Member
    Post count: 258

    First of all make sure you know which system is generating the error (the host running HAAst, or the host which the post-sync script is connecting to). That may change the answer, and/or where you need to apply changes.

    One of these solutions should help:

    1. Try adding the “-t” parameter to the ssh command to create a pseudo terminal for the command to run in.
    2. Instead of “-t” try “-tt” to force a tty (even if ssh has no local tty).
    3. Remove sudo completely from the command in your bash script. Since the HAAst (service) runs as root the processes it forks also run as root (unless the system is further locked down). Assuming error is locally generated.
    4. Comment out the line “Defaults requiretty” in the /etc/sudoers file. Then sudo won’t require a TTY anymore for sudo commands. (But undstand security implications).
    5. Use the “su –c” command instead of sudo
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.