Paramiko error when trying to edit file: “sudo: no tty present and no askpass program specified”
问题 I am using Paramiko to SSH and edit a config file. The file itself needs sudo permissions to edit. This hasn't been a problem so far, as I've just done echo <sudopw> | sudo <command> for other sudo commands in my script. When I try to edit this file using sed, though, nothing happens. stderr produces: sudo: no tty present and no askpass program specified Here is my code: stdin, stdout, stderr = client.exec_command ('echo <sudopassword> | sudo sed -i -e \"\\$aAllowUsers\" /etc/ssh/sshd_config)