I have a script called start-hotspot-terminal.sh. The text in it is:

#! /bin/bash
x-terminal-emulator -e "sudo /home/user/tools/start-hotspot.sh; read -p 'Press [Enter] to close terminal.';"

There is another script called start-hotspot.sh. The text in it is:

#! /bin/bash
ap-hotspot start

I have done all the necessary things to execute start-hotspot.sh with root privileges without requiring the password. Basically, I read and followed this . So the sudo in the start-hotspot-terminal.sh should not be a problem.
When I simply run sudo /home/user/tools/start-hotspot.sh from the terminal, the hotspot starts without asking me for the password.

But now, when I run the start-hotspot-terminal.sh I am prompted for the password. When I replace the x-terminal-emulator with xterm, there is no problem and the hotspot starts!

Why does this happen? Any way to fix it?

System: Ubuntu 14.04 64-bit, Default terminal is gnome-terminal

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.