Users and groups
Users
For a real person that will be logging into the server: Add a new user (newusername) with a specified ID (1000), a default home directory, and bash shell login (/bin/bash).
useradd --uid 1000 --create-home --shell /bin/bash newusername
For a service or limited use: Add a new user (serviceusername) with a specified ID (1001), specified home directory (/var/service), and no login.
useradd -u 1001 -d /var/service -U -s /usr/sbin/nologin serviceusername
Set the password for user (newusername):
passwd newusername
Groups
Add a group (newgroupname) with a specified ID (2000):
groupadd -g 2000 newgroupname
Add user (newusername) to a group (newgroupname):
usermod -a -G newgroupname newusername
Allow user (newusername) to run commands as root:
usermod -aG sudo newusername