Skip to content

Instantly share code, notes, and snippets.

@wyyder
Created January 25, 2020 07:19
Show Gist options
  • Save wyyder/85d5a0d29c4338ae099204570db15f47 to your computer and use it in GitHub Desktop.
Save wyyder/85d5a0d29c4338ae099204570db15f47 to your computer and use it in GitHub Desktop.
To create a new user with sudo permission in Kali Linux
# Add user.
useradd -m username
# -m creates a home directory for the user.
# Set Password.
passwd username
# Set user group to sudo.
usermod -a -G sudo username
# -a option to add and ‘-G sudo’ means to add the user to the sudo group.
chsh -s /bin/bash username
# chsh command is used to change the login shell for a user.
@AjarnSpencer
Copy link

AjarnSpencer commented Jun 28, 2024

  • I tried that but when I got to set password with PASSWD username adding my password and my username instead it didn’t work. My username was however, just numbers no characters for example 2001 so the password may have been something like for example “ 1234“, and the username might have been “200 one”. Is that what caused the failure? Should I not use integers for a username? The last time I did an installation, I used a different method which worked perfectly, but I can’t remember it and this definitely wasn’t it and also I was unable to create the CHSH command, meaning it was not possible to change the login. The user was created, but the password was not, and I can’t find the user from the command line, so it’s all messed up. I just won’t use that user and make another super user but I’m not using this script again because it just creates a user with no password and can’t change the login shell if you start it from the basic kali profile. anyway, I just saw this post is four years old so it’s definitely the wrong syntax. It should be updated or removed because it’s false information in the present day now in 2024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment