Filters:

  • Technologies

  • Instructors

  • Performing Root Tasks as a Non-Root User in Kali Linux

    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.

    For instructor-led Security training see our course schedule

    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 horrible 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.

    You may also like:  How to Create a Bootable USB Installation for Kali Linux

    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!

    More Kali Linux Blogs:
    How to Create a Bootable USB Installation for Kali Linux

    Here’s how you can make your own bootable Kali Linux installer on USB

    Adding a New Non-Root User in Kali Linux

     

    Mike Danseglio – CISSP, MCSE, and CEH

    Mike Danseglio teaches IT Security Training, Windows, System Center and Windows Server 2012 classes at Interface Technical Training. His classes are available in Phoenix, AZ and online with RemoteLive™.

    Share your thoughts...

    Please fill out the comment form below to post a reply.