Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Installing Software Introduction to Package Managers

Sudo

Why do we always have to use sudo?

2 Answers

Traci McGrew
Traci McGrew
2,559 Points

sudo stands for "super user" and it allows us to temporarily override permissions to run certain commands that require a higher level of permissions. However, it still only works if you are authorized to use it. There is a whole video dedicated to just it in the Console Foundations course. Look under the section "Users and Permissions" and there is like an 8 min. video dedicated to just sudo aptly named "sudo". Certain commands just require that you use it. In the section you posted your question in we are installing and running package managers and apt requires that permission level to run many of its commands.

Christian Ebner
Christian Ebner
12,132 Points

As an addendum to the good explanation what sudo is for by Traci:

sudo is an important security measurement in order to ensure that the user was willing to perform an action as the other user.

On that note: sudo actually doesn't mean "Super User Do" but substitute user + do - which gives it a bit of a wider usecase than strictly using it as root suplement - although the use as root is probably 99%+ of the usecase.

Example: '''sudo -H -u USERNAME command'''

The ubuntu wiki states a way to circumvent the necessity of sudo"ing" everything with use of the Rootshell:

'''sudo -i'''

When you are finished with what you need to do:

'''exit'''

BE CAREFUL: if you don't exit - you will stay in rootshell mode without time restriction.