Creating a Linux user with no password login is generally not recommended for security reasons, as it poses a potential security risk. However, if you have specific requirements or a good reason to do so, you can follow these steps. Keep in mind that this is generally not a best practice and should be used cautiously.
Here’s how you can create a Linux user with no password:
Open a terminal window on your Linux system
Use the sudo
command to create a new user. Replace <username>
with the desired username.
sudo adduser <username>
During the user creation process, you will be prompted to enter a password. Just press Enter without typing anything, leaving it blank.
Confirm that you want to proceed without a password by pressing Enter again.
Modify the /etc/shadow file
Once the user is created, you need to modify the /etc/shadow
file to remove the password hash for the user. Use the sudo
command with a text editor (such as nano
or vim
) to edit the file.
sudo nano /etc/shadow
Find the line corresponding to the user you created (it should be at the end of the file) and remove the password hash field. The line will look something like this:
username:!:...
Delete the characters between the first and second colons (:
) to make it:
username::...
Save the file and exit the text editor.
Now, the user should be able to log in without a password.
Make the account temporary
I would advise you to keep this account temporary as leaving it running on your server can potentially lead to threat intrusion into your system.
Here is the guide we’ve prepared about how to create a temporary Linux user in Ubuntu