Create a deploy user on your Ubuntu server
Learn how to create a dedicated deploy user with SSH access on your Ubuntu VPS. This guide works for both Ubuntu 22.04 and 24.04.
When you first create a server or VPS, you usually get root access. You might be tempted to use it to start deploying your services and projects. However, it is highly discouraged to use the root user for anything other than creating your first non-root user.
What You’ll Learn
- Creating a non-root user.
- Adding the user to the sudo group.
- Setting up SSH authentication for the new user.
- Verifying the new user’s access and privileges.
Prerequisites
- A VPS or server running
Ubuntu 22.04 or 24.04.
- Root access to the server (or a user with sudo privileges).
- You already have a SSH key pair. (check out Generating an SSH Key Pair on Ubuntu for instructions).
Steps
- 1Login as root to Your Server via SSH Learn how to securely log in as the root user to your server using SSH from your local machine, on any operating system.
- 2Create a Linux User on Ubuntu Server Learn how to create a non-root user on your Ubuntu server for improved security and better management.
- 3Grant administrative privileges to user on Ubuntu server Learn how to add a non-root user to the sudo group on your Ubuntu server to grant administrative privileges.
- 4Enabling External Access for Your Regular User on Ubuntu Server Learn how to enable external SSH access for a non-root user on your Ubuntu server, ensuring secure and efficient remote management.
- 5Disabled Password-Based Authentication Learn how to disable password-based SSH authentication for a non-root user on your Ubuntu server.
