October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk8 min

How to Create a New SSH User on Ubuntu

A practical Ubuntu procedure for creating a new SSH user, granting optional sudo access, installing a public key, fixing permissions and testing the login without locking yourself out.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To create a separate SSH account on an Ubuntu server, create the user, grant sudo only if needed, install that user’s public key, correct the SSH file permissions and ownership, then test from a second connection. The essential commands are sudo adduser username, sudo usermod -aG sudo username, and a correctly secured ~/.ssh/authorized_keys file.

This procedure assumes you already have working SSH access to the server through an existing account with sudo privileges. Replace username with the account name you want to create. The commands are the standard sequence described by Ubuntu community guides; the specific behavior of any future Ubuntu release should be checked against that release’s documentation.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What you need before starting

  • An Ubuntu server that is already reachable over SSH.
  • An existing login account that can run commands with sudo.
  • The new user’s intended login name.
  • The user’s SSH public key, if you want key-based authentication. A public key normally ends in a line such as ssh-ed25519 ... or ssh-rsa ....

No paid service or physical product is required. Keep the original SSH session open until the new account has successfully logged in and run a sudo check.

Step 1: Create the Ubuntu user

Run this from your existing administrative session:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
sudo adduser username

Ubuntu’s interactive adduser command asks you to choose a password and then offers optional profile fields. Enter the password when prompted. For fields such as the full name, room number, work phone, home phone and other information, press Enter to leave them blank unless your system has a specific reason to store them. Confirm the details when the command asks.

Use a distinct account for each person or service that needs access. Do not make several people share one login: individual accounts make it possible to remove one person’s access without changing everyone else’s credentials.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check that the account exists

After adduser completes, inspect the account and its groups:

id username

The output should show the new user’s numeric user ID, primary group and supplementary groups. At this point the account exists, but it has not yet been granted membership of Ubuntu’s administrative group and may not have an SSH key installed.

Step 2: Decide whether the user needs sudo

Only add the account to the sudo group if it must administer the server. A user who only needs to run an application or transfer files usually should not receive full administrative privileges.

Grant sudo access

To add the account to Ubuntu’s standard sudo group, run:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo usermod -aG sudo username

The -G option names supplementary groups. The -a option means “append”; it preserves the user’s existing supplementary-group memberships instead of replacing them. Ubuntu grants sudo privileges to members of the sudo group by default, so this command is the normal way to create a sudo-capable account.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Confirm the group assignment

Run the identity check again:

id username

Look for sudo in the groups listed for the account. The group membership is associated with new login sessions, so do not assume an already-open shell has picked up the change.

Step 3: Create the user’s SSH directory

SSH looks for the public keys allowed for a user in that user’s home directory, under .ssh/authorized_keys. The directory and file must belong to the account that will log in, and they should not be writable by other users.

You can create the directory while logged in as the new user, or create it from the existing administrator account with sudo. The following commands create it from the administrator account and then apply the required ownership and modes:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo mkdir -p /home/username/.ssh
sudo chmod 700 /home/username/.ssh
sudo chown username:username /home/username/.ssh

Mode 700 gives the user full access to .ssh while denying directory access to group and other users. The ownership command is important: a directory with the right mode but the wrong owner can still prevent key authentication.

Check the home-directory path

The commands above assume the usual home directory, /home/username, created by adduser. If your system uses a different home path, use the path shown for the account rather than blindly creating a second directory. You can display the account record with:

getent passwd username

The home directory is the sixth field in the colon-separated output. Use that directory when creating .ssh and authorized_keys.

Step 4: Create and secure authorized_keys

Create the key file, set its mode to 600, and assign it to the new user:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
sudo touch /home/username/.ssh/authorized_keys
sudo chmod 600 /home/username/.ssh/authorized_keys
sudo chown username:username /home/username/.ssh/authorized_keys

Mode 600 allows the account to read and write the file while denying access to group and other users. Both .ssh and authorized_keys should be owned by username.

Install the public key

Open the file as an administrator:

sudo nano /home/username/.ssh/authorized_keys

Paste the user’s public key into the file. Put one complete key on each line. Do not wrap a single key across multiple lines, add quotation marks, or paste the private key. Save the file and exit the editor.

If several devices or people need access to the same account, add each authorized public key on its own line. Removing one line later removes that key’s authorization without changing the others.

Reapply ownership and modes after editing

Run these commands once more after editing, especially if the file was created or modified through a different account:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo chmod 700 /home/username/.ssh
sudo chmod 600 /home/username/.ssh/authorized_keys
sudo chown -R username:username /home/username/.ssh

The recursive ownership command applies the account as owner of the directory and its key file. Avoid using a broad, permissive mode such as 777; SSH commonly rejects key files that are accessible to other users.

Step 5: Test the new SSH login safely

Do not close your working administrative session yet. Open a second terminal or terminal tab and connect to the server as the new user:

ssh username@server-address

Replace server-address with the server’s hostname or IP address. If the private key is not in your SSH client’s default key location, specify it with the client’s key option, for example:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
ssh -i /path/to/private-key username@server-address

Use the corresponding private key on the client that matches the public key placed in authorized_keys. The private key should remain on the client and should not be pasted into the server’s authorized-keys file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify identity and sudo in the new session

Once logged in, confirm that the session is the intended account:

whoami
id

If the account was meant to administer the server, run:

sudo -v

Enter the new user’s password if prompted. A successful command validates that the account can obtain sudo credentials. Run this test in the second session before closing the original session; if SSH or sudo is misconfigured, the original connection is your recovery path.

Complete command sequence

For a typical new sudo user, the sequence is:

sudo adduser username
sudo usermod -aG sudo username
sudo mkdir -p /home/username/.ssh
sudo chmod 700 /home/username/.ssh
sudo chown username:username /home/username/.ssh
sudo touch /home/username/.ssh/authorized_keys
sudo chmod 600 /home/username/.ssh/authorized_keys
sudo chown username:username /home/username/.ssh/authorized_keys
sudo nano /home/username/.ssh/authorized_keys
sudo chmod 700 /home/username/.ssh
sudo chmod 600 /home/username/.ssh/authorized_keys
sudo chown -R username:username /home/username/.ssh
id username

Paste the public key while the editor is open, save it, then perform the second-session SSH and sudo -v test. If the account does not need administration, omit the usermod command and the sudo test.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

adduser versus useradd

Ubuntu includes both adduser and useradd, but they serve different roles. A Medium guide titled “Ubuntu Server 101” describes useradd as a low-level binary compiled with the system and adduser as a higher-level Perl script built on top of useradd. In practical terms, adduser provides the interactive account-creation flow used above, including prompts for a password and optional user information.

Command Role in this procedure What to expect
adduser username Recommended interactive account creation Prompts for a password and optional profile fields.
useradd username Lower-level account creation Provides fewer interactive conveniences and generally requires you to specify or create additional account settings yourself.

For a normal human SSH account on Ubuntu, the interactive command avoids common omissions. Use the lower-level tool only when you deliberately need its more granular behavior and know which account properties must be supplied.

Troubleshooting failed SSH login

The server says “Permission denied (publickey)”

  • Check that the public key in authorized_keys is complete and occupies one line.
  • Confirm that the key belongs to the private key being used by the client.
  • Check the directory and file modes: .ssh should be 700 and authorized_keys should be 600.
  • Check ownership with ls -ld /home/username/.ssh and ls -l /home/username/.ssh/authorized_keys. Both should show username as owner.
  • Make sure you are connecting with the correct spelling of the username and the correct server address.

After correcting a problem, retry from the second terminal. Keep the original session open until the retry succeeds.

The account can log in but sudo fails

  • Run id username from the administrative session and confirm that sudo appears among the groups.
  • If you just ran usermod -aG sudo username, disconnect and start a fresh SSH session. Existing sessions may not have the new supplementary-group list.
  • Run sudo -v in the fresh session and enter the password created by adduser.

The key file is in the wrong home directory

If adduser created a nonstandard home path, placing the key under /home/username/.ssh will not help. Use getent passwd username to identify the actual home directory, move or recreate the .ssh/authorized_keys files there, and then reapply ownership and modes.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The public key was pasted with line breaks

A public key must be a single logical line in authorized_keys. If an editor wrapped the display but did not insert newline characters, that is normally harmless; an actual newline in the middle of the key is not. Paste the key again as one line and remove the broken copy.

Security and access decisions

Use sudo only when the job requires it

Adding a user to the sudo group grants administrative capability. For a contractor, application account or file-transfer-only login, create the account without that group unless administration is genuinely required.

Prefer separate keys for separate people and devices

One key per authorized person or device makes access revocation precise. Delete only the corresponding line from authorized_keys when that key should no longer work.

Keep a recovery session available

The safest order is to create the account, install the key, test a second SSH connection, run sudo -v if applicable, and only then close the original session. This prevents a permissions mistake or an incorrect key from eliminating your only administrative path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Ubuntu version considerations

A third-party walkthrough is titled for Ubuntu 26.04 and says the same commands apply, but that version-specific behavior is not confirmed by official release notes in the available material. Treat the commands here as the established community procedure and verify any release-specific defaults on the server you administer. The account, group, SSH-directory and key-file steps should be checked if a distribution update changes defaults.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.