![]() ![]() Im using adhoc way to run synchronize module as a sudo user to synchronize local and remote directories (push)īelow is host file /etc/ansible/hosts Īnsible_ssh_private_key_file=/root/.ssh/id_rsaīelow are the command used: ansible webdb -s -K -m synchronize -a "src=/tmp/muhanĪnd (dest_port used) ansible webdb -s -K -m synchronize -a "dest_port=44022īoth commands outputs below error:- 10.153.99. The executed command will have no controlling terminal. 2 In the stock sudoers configuration, the following line is usually present: Defaults requiretty This is both secure and what you need in the majority of the use cases. Please let me know if you find any issuesUbuntu 14.04.3 LTS ansible version: 2.1.0, the sshport on remote server is 44022 Try to replace this: su - devops -c 'sh /path/to/myscript.sh' with this: sudo -u devops -H sh -c 'sh /path/to/myscript.sh' The -c option of su doesnt support interactive mode:-c, -command COMMAND Specify a command that will be invoked by the shell using its -c. But sudo errors out: sudo: no tty present and no askpass program specified. ![]() So if this is already added in the sudoers file then the command will work. Or if you want to give permission to all the commands then: User1 ALL = NOPASSWD: /sbin/poweroff, /sbin/start, /sbin/stop Username ALL = NOPASSWD: /fullpath/to/command, /fullpath/to/othercommand For example, if the user is user1 then I will add the following line in the sudoers file. Instead of running the commands sudo is trying to request the users password. ![]() It also has a number of detailed recommendations for working around the problem if you can't fix it. So you need to add the user to the Sudoers file with NOPASSWD option so that it will not ask for any password. The issue is caused by executing a sudo command which tries to request for a password, but sudo does not have access to a tty to prompt the user for a. As details by this answer on StackExchange, the /etc/sudoers file on the remote host is likely disallowing you from running sudo commands without a tty. Sudo: no tty present and no askpass program specifiedĬause there will be no tty available for password ask from inside the Linux OS. In that case you will get the following error: no tty present and no askpass program specified Ask Question Asked 1 year, 8 months ago Modified 1 year, 8 months ago Viewed 209 times 0 I have configured the /etc/sudoers file to include all files in the /etc/sudoers.d folder. stdin, stdout, stderr ssh. ![]() sudo: no tty present and no askpass program specified I tried. From VMScript you will not be able to successfully run it, if this asks for the password. Paramiko: no tty present and no askpass program specified ssh python duplicate Ask Question Asked 5 years, 3 months ago. Invoke-VMScript -VM -ScriptText "sudo -u root ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up" -GuestUser -GuestPassword īut remember the following point. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |