Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a program in the background as sudo

Tags:

linux

sudo

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?

like image 636
user2966143 Avatar asked Sep 29 '14 22:09

user2966143


2 Answers

You can run sudo bash -c 'synaptic &'

like image 159
Thyrst' Avatar answered Oct 22 '22 22:10

Thyrst'


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"
like image 38
Anurag_BEHS Avatar answered Oct 22 '22 20:10

Anurag_BEHS