How to properly configure sudoers file, on debian wheezy?

You haven't added any sudo rule, so you can't use sudo for anything.

The command adduser USERNAME sudo adds the specified user to the group called sudo. A group with that name must exist; create it with addgroup sudo if it doesn't. After adding the user to the group, the user must log out and back in for the group membership to take effect.

sudo is not a special group name. It's a convention to allow users in the group called sudo to run commands as root via the sudo utility. This requires the following line in the sudoers file:

%sudo ALL = (ALL) ALL

Run visudo to edit the sudoers file, never edit it directly.

I have no idea why you believe that “that only protects aptitude”. There is nothing special about aptitude. Once you've authorized a user to run commands as root, that user can run sudo aptitude … or sudo apt-get … or sudo service …, or sudoedit to edit files that require root permission to edit. Being in the sudoers file doesn't directly change the privileges of your user, what it does is that it allows you to run sudo to run commands as root. Commands run as root only when you run them through sudo. Some programs may do that automatically, especially GUI programs where the user interface runs without special privileges and only the backend runs as root, but commands executed as root are always executed by sudo.


What may have happened is: sudo is caching your password. So, after you've correctly completed the implementation of sudo on your system, you have to enter the password for the first command, and after that it's cached for some time. If that happens and you run the sequence

sudo aptitude install sendmail
sudo apt-get install sendmail

Then you'll have to provide a password on the first command, but not on the second (at least while you are still within the timeout). This may feel like it's protecting only the first command, but not the second. Without further information (complete shell transcripts), there's no way to tell...