scripts - Ubuntu Unity 16.10 'sudo: no tty present and no askpass program specified' - Ask Ubuntu
i made script set/unset proxy setting when switch between work , home. script works , wanna run every time automatically when login put in .profile (like : source ~/bin/proxyscript.sh).
this works when using ubuntu gnome , during login terminal , asked sudo password. since version 16.10 installed clean version of ubuntu unity , error message "sudo: no tty present , no askpass program specified" when login.
in script : sudo service cntlm stop sudo sed ..... /etc/cntlm.conf sudo service. cntlm start
i looked @ /etc/sudoers file , added following without result: defaults !/usr/bin/sed !requiretty defaults !/usr/sbin/service !requiretty
root all=(all:all) jeroen all=nopasswd: /bin/sed, /usr/sbin/service
i don't know can try fix problem. idea ?
thanks.
you should not use sudo
in script. can use policykit instead of sudo
in script:
#!/bin/bash pkexec env display=:0 xauthority=/home/$user/.xauthority service cntlm stop & sed whatever missing here pkexec env display=:0 xauthority=/home/$user/.xauthority service cntlm start
or, better yet . . . sed command first , restart service need enter password twice
#!/bin/bash pkexec env display=:0 xauthority=/home/$user/.xauthority sed 'some sed stuff' pkexec env display=:0 xauthority=/home/$user/.xauthority service cntlm restart
also, if still have problems, suggest running script "startup applications" instead of .profile
file. can search "startup applications in dash"
Comments
Post a Comment