sudo
asks for your password by default. It is not recommended, but you may bypass passwords for users/groups for all, or limited commands, if you chose to do so.
Here is why sudo
asks for a password by default:
Linux is a multi-user system, and the easiest way to see this is to look at the root user, vs your own user. Major system-critical components are protected by being accessible by only root. This is why people suggest you create an alternate user than root when doing daily tasks. Imagine the following command run as both users (root and you):
apt-get purge ubuntu-desktop #DO NOT RUN THIS
If you're cruising around as root, you've just removed ubuntu-desktop
; If you're logged in as a normal user, you'll get an error.
Now, imagine how many different programs you run, and how connected to the internet they all are. Each of these clients/internet-connectable programs that you run are attack vectors or ways for people to gain entry into your machine.
Let's say that there is a new exploit for your favourite browser firefox
that allows the attacker to gain shell. Would you rather the user have YOUR shell, or your ROOT shell?
This is why sudo
asks you for your password.
The fact tat the user has managed to run sudo means that the user has passed authentication
, the user is in sudoers file, belongs to sudoers group, but why would he/she need to stay through out the session withsudo
privileges ? there's root account for that, right ? Just some thoughts