0

I am following some tutorial to install Ubuntu with full disk encryption. In it, I am asked to boot the installation media into the live session and perform some operations before installing the distro on my laptop. Some of these operations require a root terminal; alternatively the guide tells me to use sudo -i. However it does not tell me exactly how to use it. For example, in one part says:

You'll want a root terminal for this or use sudo -i.

openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero > /dev/sdxy

I tried reading the man page forsudobut apparently you can use sudo -i with and without a command so I am a bit confused. Specifically I would like to ask:

How to use sudo -i in this setting? Please remember that I will be working in a live session.

Also, any explanation of how the option works is very welcome, but try to keep it as simple as possible since I am a very basic user.

  • 1
    Why don't you just click on the "encryption" tickbox in the installer? As for your question, you'd better just use sudo -i alone, then you have a root shell you can enter the openssl command. – cylgalad Sep 15 '16 at 8:10
1

From man sudo:

-i, --login

Run the shell specified by the target user's password data‐ base entry as a login shell.

You can get an interactive shell running as root using any of the following methods (these are the full commands just run as is from an existing shell and they will give you a root shell).

  • sudo -i: Gives you a root prompt with a new shell environment (as if root did a login). Does a cd to root's home directory as well.
  • sudo sh or sudo bash: Gives a basic root shell spawned in the environment of the calling user (sanitized by sudo).
  • sudo -s -H: Gives a shell and resets $HOME, but doesn't cd to $HOME like sudo -i.
  • sudo su: Uses the normal su method of becoming root but doesn't need a root password.

Basically I use either sudo -i or sudo -s -H in most cases depending on if I wanted to end up in root's home directory or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.