Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I guess this should be a simple thing for ubuntu users out there. I have two questions.

  1. Whenever I need to run some command that requires permission from root, I run as sudo followed by that command. It would be nice if that does not prompt for password (but I should still be issuing a sudo to make sure that I know what I am doing). How to do this?

  2. Every time I start my system, I go to terminal and start my VPN using sudo vpnc. This is almost everytime! How to automate this to a startup script?

Help much appreciated! Thanks

share|improve this question
Part 2 of your question is similar to: How can I make Shutter open at startup? – Sid Jan 13 '11 at 12:43
Please do not ask two different questions in one question. Make them separate questions so they can be objectively answered. – Marco Ceppi Jan 13 '11 at 15:16
up vote 4 down vote accepted

First Question

  • If you dont want to enter password everytime,then you should edit sudoers file.

    sudo visudo

  • Then add the following line at the end of the file.

    %username ALL=(ALL) NOPASSWD:ALL

    alt text

  • Now if you enter sudo followed by the command it wont prompt you to enter password.

Second Question

  • For your second question you can add that command sudo vpnc to startup applications.
  • To add that command in startup applications Goto System Preferences Startup Applications.

    alt text

share|improve this answer
where did you get the lime green theme? It will go wonderfully with my desktop background :) – rumtscho Jan 13 '11 at 13:04
@rumtscho It's tropical theme :) Installation instruction is [here ]( – karthick87 Jan 13 '11 at 15:43
f cool!! thanks for a neat answer!! – bragboy Jan 13 '11 at 17:49
Your computer's your own, but I would suggest being a little careful about blanket NOPASSWD. You could do it for specific commands, so that you can run vpnc without a password, but not rm -rf /. – Jefromi Jan 13 '11 at 19:03

Tag the users or groups who you want to have passwordless access to sudo with "NOPASSWD" in your sudoers file (sudo visudo to edit it). See the man page for sudoers for more details.

You can then create a startup script by editing the appropriate file for the shell you're using -- .profile, or .bashrc, or .cshrc, and so on.

share|improve this answer

In 10.04 I see that in the Network Manager (v0.8) I have a flag on the VPN Configuration screen (System > Preference > Network Connections , click the VPN tab, select the connection and "Edit") "Connect Automatically" I believe that it fires up the selected connection at login.

share|improve this answer
It might be required to install network-manager-vpnc & network-manager-vpnc-gnome [ !Install VPNC plugin for Network Manager ]( for that to work. (Or the equivalent KDE-package when using Kubuntu.) – JanC Jan 13 '11 at 16:24
Sorry, for the broken link, but there seems to be a bug in the Markdown parser... :-( Try clicking this link instead. – JanC Jan 13 '11 at 16:51

Your Answer


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.