← Volver al blog

How to Add a New User in Linux

  • Xernode
  • 1 min de lectura
  • 3 de abril de 2026
Linux linux server user adduser create

Introduction

Adding new users in Linux is essential for managing access and security on your server. This guide shows you how to create a new user, set a password, and assign permissions.

Step-by-step Guide

  1. Add a new user
    • sudo adduser newusernamen
      • (Replace newusername with the desired username)
  2. Set or change the user’s password
    • sudo passwd newusername
  3. Add the user to the sudo group (optional, for admin rights)
    • sudo usermod -aG sudo newusername
  4. Switch to the new user
    • su - newusername
  5. (Optional) Set up SSH access for the new user
    • Create the .ssh directory:n
      • mkdir -p /home/newusername/.ssh
    • Set correct permissions:n
      • chmod 700 /home/newusername/.ssh
    • Add your public key to authorized_keys:n
      • ano /home/newusername/.ssh/authorized_keys
    • Set permissions:n
      • chmod 600 /home/newusername/.ssh/authorized_keys
      • chown -R newusername:newusername /home/newusername/.ssh

Recommendations

  • Only give sudo rights to trusted users.
  • Use strong passwords or SSH keys for all users.
  • Regularly review and remove unused user accounts.

Call To Action

eed a secure Linux VPS for your team? Check out our hosting plans! https://xernode.com/#pricing

Related Guides