is it possible to install software without asking for a password?

Posted on

Problem :

Okay, so i am not sure if it is possible, but i am creating a menu and the user can select an option that will install two bits of software, however, once this is pressed there can be no other prompts.

Can this be done? I need ‘gnome-disk-utility’ and ‘gparted’ to be installed.

any help will be appreciated

Solution :

I would recommend simply adding these programs to your script’s requirements so the script cannot be installed unless these programs are present. If GNOME is not already installed on your target system, installing those two gnome utilities will also install many many libraries from the GNOME project. As a user I would be annoyed if I had to download a few hundred megabytes of data and bloat my system just to run your tool.

Anyway, the choice is yours. As for installing, you cannot install a program globally on *nix without the root password, no. You can install locally from source with no need for passwords but I would not recommend that either.

If you know that your users will be running some kind of GNOME based, debian derivative, you could have your menu command launch gksudo synaptic or whatever to allow the user to enter their password.

I don’t know why you would want this of course. Just have an error message explaining to your user that these programs need to be installed. Why do you want them to install through your script? You are complicating your life and theirs for no real benefit.

You need to run that tool with root privileges. Everything it launches will be run as root too, so nothing will prompt for password.

So basically you need to check if the tool is started as root and prompt an user otherwise. To execute command as root if you have sudo installed use:

sudo (command)

Without sudo you’ll have to use this:

su -c '(command)'

Leave a Reply

Your email address will not be published. Required fields are marked *