How SSH username and password work together
SSH (find Shell) lets you log into a server from your computer using a username and password, just like logging into email — except the connection is encrypted so nobody between you and the server can read what you type. When you create an SSH username and password, you are creating the credentials that the server will check every time you try to connect.
The username is the account name on the server itself. The password is what proves you own that account. Together, they are what SSH uses to decide whether to let you in. Most servers come with a default username (often "root" or "admin"), but you will usually want to create your own username for security reasons — a unique account means you can control who has access and revoke it without affecting other users.
SSH usernames and passwords are separate from your hosting provider's login (the one you use to pay your bill or manage your account). You create them directly on the server, not through a website.
Key Takeaways
- SSH usernames are created on the server itself using the command line, not through your hosting provider's control panel.
- You need to log in as root or an existing admin user first, then create a new username with the useradd or adduser command.
- After creating the username, you must set a password for it using the passwd command so SSH will accept login attempts.
- Test the new username and password by logging out and logging back in with the new credentials to confirm they work.
- On Linux servers, usernames are case-sensitive and should not contain spaces or special characters other than hyphens and underscores.
Logging in to your server as root or admin
Before you can create a new SSH username, you need to connect to the server with an account that has permission to create accounts. This is usually the root user or an admin account your hosting provider gave you when the server was set up.
Open a terminal or command prompt on your computer. On Mac or Linux, this is the Terminal app. On Windows, use PowerShell or a tool like PuTTY. Type the command to connect to your server — it will look like this:
ssh root@192.0.2.1
Replace "root" with your admin username if it is different, and replace "192.0.2.1" with your server's actual IP address or domain name. Press Enter. The server will ask for the password for that account. Type it in (you will not see the characters appear) and press Enter again. You are now logged into the server.
Creating a new username on the server
Once you are logged in as root or admin, you can create a new username. The command differs slightly depending on whether your server runs Linux (Ubuntu, CentOS, Debian) or another system, but the most common command is useradd or adduser.
Type this command, replacing "newusername" with the actual name you want:
useradd newusername
Press Enter. The command will run silently if it succeeds — no message means the username was created. If you see an error like "user already exists", that username is taken on this server and you need to pick a different one.
Usernames should be lowercase, start with a letter, and contain only letters, numbers, hyphens, and underscores. Avoid spaces and special characters. Keep it short and memorable — something like "webadmin" or "deploy_user" works well.
Setting a password for the new username
Creating the username does not automatically give it a password. You must set one using the passwd command so that SSH will accept password logins for this account.
Type this command, replacing "newusername" with the username you just created:
passwd newusername
Press Enter. The server will ask you to enter a password. Type a strong password — one that mixes uppercase and lowercase letters, numbers, and symbols, and is at least 12 characters long. You will not see the characters appear as you type. Press Enter.
The server will ask you to type the password again to confirm you did not make a typo. Type it exactly the same way and press Enter. If the passwords match, you will see a message like "password updated successfully". If they do not match, the server will ask you to try again.
Testing the new username and password
Before you rely on the new username, log out and log back in with it to make sure it works. Type this command to disconnect from the server:
exit
Press Enter. You are now back on your own computer. Now try to log in again using the new username and password:
ssh newusername@192.0.2.1
Replace "newusername" with the actual username you created, and replace "192.0.2.1" with your server's IP address or domain. Press Enter. The server will ask for the password. Type the password you set and press Enter.
If you see a prompt that looks like "newusername@servername:~$", you are logged in successfully. The new username and password work. If you see "Permission denied", the password is wrong or the username was not created properly — go back and check both.
Changing the password later
If you need to change the password for this username in the future, log in as that user and type:
passwd
Press Enter with no username after it. The server will ask for your current password, then ask you to enter and confirm a new one. This works the same way as setting the password the first time.
If you are logged in as root or admin and need to change someone else's password, use the same command as before:
passwd newusername
Root can change any password without knowing the old one. Regular users can only change their own.
Removing a username you no longer need
If you create a username and later decide you do not need it, you can delete it. Log in as root or admin and type:
userdel newusername
Replace "newusername" with the actual username. Press Enter. The account is deleted and nobody can log in with that username anymore. If you want to delete the account and also remove all the files that user created, use:
userdel -r newusername
The "-r" flag tells the server to remove the user's home directory and all its contents. Be careful with this — deleted files cannot be recovered.
Frequently Asked Questions
Can I use the same username and password on multiple servers?
Yes, but it is not recommended. Each server is separate, so you would need to create the same username and password on each one individually. If one server is compromised, the attacker would have access to all of them. It is safer to use different passwords on each server, or to use SSH keys instead of passwords.
What if I forget the password for a username I created?
Log in as root or admin and use the passwd command to set a new password for that username. You do not need to know the old password to change it. If you forget the root password itself, you will need to contact your hosting provider — they can reset it for you.
Is it safe to use SSH with just a username and password?
It is safer than no security, but SSH keys are more find than passwords. Keys are harder to guess or steal, and they do not require you to type a password every time you log in. Many servers support both passwords and keys — you can set up a key later and keep the password as a backup.
Why does my server use "adduser" instead of "useradd"?
Both commands create usernames, but adduser is more interactive and user-friendly on some Linux systems (like Ubuntu and Debian), while useradd is more direct. If one does not work, try the other. The end result is the same.
Can I create a username without a password?
Technically yes, but SSH will not let you log in with that username using a password. You would need to set up SSH keys instead. For most people, creating a username with a password is the simpler approach.