All about sudo

Non-root user

With 2020.1 Kali has swapped to a privileged non-root user by default. This means that root has no password set, and the account created during installation is the one to use. It is possible to re-enable access to the root user, however this is not recommended.

Sudo?

sudo is a way that we can access tools, ports, or services that need administrative privileges. Sudo is powerful however, and can allow full access to the system, so it is not advised to use sudo on every command.

Sudo on Kali

Because Kali creates a user with administrative privileges by default, users can use sudo right away and supply their password for authentication. Should a user wish to enable password-less sudo, which poses a security risk should someone gain access the the user account, they have that option.

[email protected]:~$ sudo apt install -y kali-grant-root && sudo dpkg-reconfigure kali-grant-root

The previous command installs a package that will allow for a user to be added to a trusted group that will not need to supply a password when using sudo. This does not mean however that root will be reinstated.

In use

[email protected]:~$ ls /root
ls: cannot open directory '/root': Permission denied
[email protected]:~$
[email protected]:~$ sudo ls /root
[sudo] password for kali:
hello
[email protected]:~$ sudo apt install -y kali-grant-root
[...]
[email protected]:~$ sudo dpkg-reconfigure kali-grant-root
[...]
kali[email protected]:~$ sudo ls /root
hello
[email protected]:~$

Updated on: 2022-Jul-26
Author: gamb1t