Super user (root) in terminal


I need to run commands as root in the terminal. What is the root password?


To run commands as root you may use sudo yourcommand. If you’d like to open a session as super user you can run sudo su and then run commands as you choose. To close your super user session, just run exit.

Since terminal sessions are only available to the owner of a workspace and those they give write access to, there is no password for sudo. If you’re asked for a password you’re doing it wrong :wink:


i ran sudo -s and now im stuck as root. my username even went off the preview link.


@eloyjaws just updated my answer for you :slight_smile:


thanks for that. but i tried that and it didnt work either. I think its because it was created as a cs50 ide. when i logged out and switched to root, i couldnt login with my username.
Pls look at this Stuck as ROOT in the Terminal


Sorry for any format issues, I am new here.


It will require a password. Of course you do not have the password, but that is ok. By default you should usually be able to just type:

sudo su

But sometimes this is not going to work.
You may need to --update something and it requires su permission.

If you still can not get it to work you have 2 options:

1: Contact C9 and see if they can troubleshoot with you for a few days. That may be more hassle than it is worth.


2: Type these codes in the terminal:

  1. sudo su - Type this first to change to root.

  2. whoami (Returns; “ubuntu” or “root”)
    Note: If it says “ubuntu” go back to step 1.

  3. passwd root (Enter a new password twice as directed)

Note: passwd ubuntu requires the previous unix password, which of course we do not have, so this will fail.

I have made a video tutorial as well:

Check it out!

How can i change user in postgress trminal?