Reputation: 103
I am on a linux virtual machine and I'm trying to run the command sudo synaptic &
which should start synaptic in the background. However, it doesn't ask for the password and the program doesn't seem to start. I have not typed my password earlier, as running any other command withouth the & at the end ask for my password. What is the problem?
Upvotes: 10
Views: 16082
Reputation: 1988
From the previous answer, only adding -b
to a command starting with sudo
might work, as below:
sudo -b COMMAND
Worked for the command below:
sudo -b mongod --config /etc/mongod.conf
Note. For a non-sudo command, there's nohup, as below:
nohup COMMAND &
Adding nohup
before the command, and an &
after the command might work for a non-sudo
command.
Upvotes: 0
Reputation: 1480
sudo --help says about option -b
-b, --background run command in the background
This worked for me
sudo -b su -c "command what you want to run"
Upvotes: 15
Reputation: 19601
The problem is that the sudo
command itself is being run in the background. As a result, it will be stopped (SIGSTOP) when it tries to access the standard input to read the password.
A simple solution is to create a shell script to run synaptic &
and then sudo
the script in the foreground (i.e. without &
).
Upvotes: 5