In this tutorial we will learn about sudo, so why do I have to use sudo for almost everything?
On modern Linux systems, the administrative tasks are done by a special user called root. The root user is almighty, it can delete every file in the system and kill every process, power which should not fell on untrusted hands. To avoid security issues, a normal user can switch to the root user only when needed.
In the last years, Ubuntu has encouraged the usage of sudo, which gives the normal user root priviledges only for the command needing administrative access.
In Ubuntu the root user is deactivated (it does not have a valid password) and a certain user gets super user access, without beeing logged in as root.
Reasons why sudo is better that su:
1. Sudo can have limited access. For example you can allow a normal user to do a few administrative tasks only. For example you can allow a normal user only to add users in the system.
2. When the user uses sudo, he is asked to type his user’s password, not the root password. The user has to remember only a password (his password) instead of two.
3. Once you’ve typed your password for sudo, you will be able to use passwordless sudo for 15 minutes, unless you switch user.
4. By using sudo, the user uses his own environment variables and settings (like default text editor, shell settings), which is be very usefull sometimes.
5. Every usage of sudo is stored in the log files and it can be easily monitorised.
6. You can easilly assign root priviledges to a user in a configuration file (usually /etc/sudoers) and so, more users can use root commands in the same time.