Excute a command as root

Asked by peter

Hi

What do I have to do, when I'm a normal user and I would execute a command in the terminal as root?

- sudo? I guess, this is not enough.
- sudo su?

Thanks for your answer.
Peter

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu sudo Edit question
Assignee:
No assignee Edit question
Solved by:
peter
Solved:
Last query:
Last reply:
Revision history for this message
Bernhard (b.a.koenig) said :
#1

"sudo" and then the command should work, e.g.

sudo apt-get update

to update your repository info. If you type

sudo su

then you will basically switch to root user, i.e. you become the root user for that terminal session. If you still have problems, please post the terminal output of the case that's not working for you.

Revision history for this message
peter (peter-neuweiler) said :
#2

Hi Bernhard

Thanks a lot. I guess the problem has solved.

But: where is the difference between sudo and sudo su? I thought sudo will give root privileges. If this is correct sudo would be the same as sudo su. Or not?

Thanks for your answer.
Peter

Revision history for this message
Sam_ (and-sam) said :
#3
Revision history for this message
Bernhard (b.a.koenig) said :
#4

Well, "sudo" is just for one command, then you go back to be the "normal" user. But if you type "sudo su" you will remain "root" until you type "exit". That means you can execute a number of root commands in a row (if necessary) without having to type "sudo" repeatedly.

Revision history for this message
Sam_ (and-sam) said :
#5
Revision history for this message
peter (peter-neuweiler) said :
#6

Hi Bernhard

Thanks for the answer. Now I'm infomed *l.

Have a good time and be well.
Peter

Revision history for this message
peter (peter-neuweiler) said :
#7

Thanks, Sam!
Peter