Initial Server Setup in Ubuntu

User Setup

Root Login

ssh root@SERVER_IP

Create new Users

useradd -m art

Grant Sudo Access to User

usermod -aG sudo art

Update User Shell to Bash

usermod -s /bin/bash art

Adding Public Key Authentication

Generate Key Pair


Copy Public Key

Add Public Key to ~/.ssh/authorized-keys

Disable Password Authentication

sudo vi /etc/ssh/sshd_config

PasswordAuthentication no

Create User

useradd <username>

Add New User to Primary Group

useradd -g <groupName> <username>

Add New User to Secondary Group

useradd -G <groupName> <username>

Assign Password for the User

passwd <username>

Add existing user to existing Group

usermod -a -G <groupname> <username>

List All Users In the System

cat /etc/passwd