I have the following little script:
#!/bin/bash
cd ~
thunderbird &
firefox &
sudo apt-get update
sudo apt-get upgrade
It worked for the last two years, but for a few days it skips the password prompt. Output (without any actions from me, except starting the script):
me@UBUNTU:~$ sh goodmorningscript.sh
[sudo] password for me:
[sudo] password for me:
me@UBUNTU:~$
It just runs through, without stopping and waiting on the password prompt. I don't want a solution without entering my password.
What could have caused my Ubuntu to skip the prompt and how can I solve it?
Note: If I manually enter sudo
commands, the prompt works as expected.
GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)
Ubuntu 18.04.1 LTS
I found one possible solution, that works in my case. If the sudo
command comes before the ones with &
, the password prompt works as expected:
#!/bin/bash
cd ~
sudo apt-get update
sudo apt-get upgrade
thunderbird &
firefox &
I still don't know why, but maybe this helps.
apt-get
commands actually run? or do you just see two password prompts and then nothing? Is the behavior different if you run the script directly./goodmorningscript.sh
rather than viash
? – steeldriver Feb 05 '19 at 16:48apt-get
commands run as expected (with pw-prompt). If I run it with./
it behaves the same. – izlin Feb 06 '19 at 07:54