Created
January 25, 2020 07:19
-
-
Save wyyder/85d5a0d29c4338ae099204570db15f47 to your computer and use it in GitHub Desktop.
To create a new user with sudo permission in Kali Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
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.
@AjarnSpencer did you use caps bc when you type passwd it should change color of the letter showing its a sudo command
I have tried this in 2024, it still works...
worked for me (2025)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment