SU Command


Kali Linux is a fantastic operating system for penetration testing and security evaluation. It comes with virtually all security tools built in, it’s lightweight by default, and it has a huge ecosystem that is constantly helping with the project.

I created a new installation of Kali Linux recently. One of the first post-installation tasks I did was to create a new user for daily use. Running as root all the time is a poor security practice, so I recommend that you create a new user as soon as possible after installation.

However, root privileges are required for many tasks in Kali. For example, running apt-get to update software fails as a non-root user:

001-running-apt-get-in-Kali-Linux

A little trick is helpful here. The su command is a Linux command that temporarily switches the context of Terminal commands into the root user. This means that new commands issued after typing su (and providing the password for root) are executed as root.

To do this, just type in su and press enter. You’ll be prompted for the password.

002-Root-Tasks-as-a-Non-Root-User-in-Kali-Linux

Notice the prompt has changed from user@machine to root@machine. That’s the reminder that you’re now executing commands as root. This allows me to complete the earlier operation successfully, as shown here.

003-successfully-running-Root-Tasks-as-a-Non-Root-User-in-Kali-Linux

Now you can execute multiple root commands while remaining logged in as a non-root user.

Enjoy!

enoK