Managing users on a Debian server is essential for controlling access and permissions. This guide explains how to add and delete users in Debian 12.
Step 1: Create an Instance
Before proceeding, ensure you have a Debian 12 instance.
Access the Dashboard: Log in to your Shape.Host account and navigate to the Dashboard.
Click Create: Click the “Create” button at the top-right corner.
Select Instances: Choose “Instances” to start creating a new server.
Select Location: Choose a data center location closest to your target audience.
Choose a Plan: Select a plan that suits your project, such as Standard, CPU-Optimized, or Memory-Optimized.
Choose an Image: Select Debian 12 as the operating system.
Authentication and Finalize: Choose your preferred authentication method, either SSH keys or password, then click Create Instance.
- Obtain IP Address
- Once your instance is created, return to the dashboard.
- Find your instance’s IP address under the Resources section and use it to access your server.
Step 2: Connect to Your Instance
To connect to your Debian server:
- Linux/macOS: Open a terminal and type:
ssh root@<your_server_ip>
- Windows: Use PuTTY. Enter the server’s IP, select SSH, and log in as
root
using your credentials.
Step 3: Add a New User
Create a new user named user-1
:
adduser user-1
You will be prompted to set a password and provide optional user information.
Step 4: Grant Sudo Privileges
Add the new user to the sudo
group to grant administrative privileges:
usermod -aG sudo user-1
Verify the user in the system:
cat /etc/passwd
Step 5: Delete a User
To delete the user user-1
and remove their home directory:
deluser user-1 --remove-home
Confirm the deletion by checking the system’s user list:
cat /etc/passwd | grep "user-1"
If no output appears, the user has been successfully deleted.
Adding and deleting users in Debian 12 is straightforward and allows you to maintain proper access controls on your server.
For a reliable hosting environment, consider using Shape.Host’s Cloud VPS services, offering high performance and flexibility for your Debian-based projects.