I have a VM running Kali Linux 2021.3. I have only 2 users kali and root. The kali user possesses sudo permissions with a password. When I run a command without sudo permission, it executes fine. But when I execute the same command with sudo permissions, it takes at least more than 20 seconds to prompt me for the password

But when I switch the user to root with su root and run commands, this doesn't happen. Additionally, programs like python and PHP take longer than usual to get executed. For example, to start a simple HTTP server with python: python3 -m http.server 8080 also takes more than 20 seconds.

I thought this was a problem with low RAM. So I tried increasing the RAM by 2GB. It still doesn't work. I did an upgrade with APT recently. I wonder if that's what caused this issue. My current version is,

uname -a:

Linux kali 5.10.0-kali7-amd64 #1 SMP Debian 5.10.28-1kali1 (2021-04-12) x86_64 GNU/Linux

This is the output of the auth.log when I execute the command with sudo

tail -f /var/log/auth.log
Oct 23 17:21:27 kali sudo:     kali : TTY=pts/3 ; PWD=/home/kali ; USER=root ; COMMAND=/usr/bin/ls
Oct 23 17:21:27 kali sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
Oct 23 17:21:27 kali sudo: pam_unix(sudo:session): session closed for user root

  • I wonder is this is a problem with your user configuration. I reinstalled Kali at 2021.1 (for other reasons) and there is no "root" user. My own user runs everything either natively or with sudo and there is no slowness with sudo . My Kali machine is a virtual machine.
    – John
    Oct 23, 2021 at 20:34
  • To break up the problem (for troubleshooting), first run sudo -i to get into a root prompt, then run your command. What happens? Oct 23, 2021 at 23:03

1 Answer 1


This was a problem with the /etc/hosts file. I didn't have an entry for my hostname(kali). I just added an entry in my host files as:


I found about this from this post.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .