Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
add comment

migrated from stackoverflow.com Mar 18 '13 at 15:17

This question came from our site for professional and enthusiast programmers.

2 Answers

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.

share|improve this answer
    
If you really want to install without password, you can add a sudoers rule to let some users run sudo apt-get install gparted gnome-disk-utility passwordless. But it's really better to do it as a dependency. –  mgarciaisaia Mar 18 '13 at 15:42
    
@desert69 a script that adds an sudoers rule? That is the mother of all security holes! –  terdon Mar 18 '13 at 15:45
    
@terdon i am creating it for a university assignment and it is an option we have to supply on out select menu for the user ie the lecturer to select, and no other prompt must pop up. so if i simply use sudo, would that ask for my password or would it run without requiring a password? –  Cain Neal Mar 19 '13 at 20:34
    
If you are running the script as root you don't need to enter another password. I just hope your professor has not asked for this, it doesn't make much sense. –  terdon Mar 19 '13 at 21:15
add comment

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)'
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.