You can run the sudo -i command to access the root user for the first time on your system:
elliot@ubuntu-linux:~$ sudo -i
[sudo] password for elliot:
root@ubuntu-linux:~#
You will be prompted to enter your password, and then, all of a sudden, you have got superpowers!
Notice how the command prompt changed instead of a dollar sign ($), it now shows a # to greet the root user.
Let's run the whoami command to make sure that we are now logged in as the root user:
root@ubuntu-linux:~# whoami
root
Awesome! Now let's display the current working directory:
root@ubuntu-linux:~# pwd
/root
Remember earlier that I told you that the home directory for the root user is /root and not under /home.
Figure 1: /root is the home directory for the root user
Now let's rerun both commands that we got permission denied for, but this time, we run both commands as the root user.
root@ubuntu-linux:~# touch /var/happy
root@ubuntu-linux:~# ls -l /var/happy
-rw-r--r-- 1 root root...