As root or via sudo add the user with a home directory, where "developer" is the new username:
useradd -d /home/developer -m developer
Update the new user's password; making sure you use a very strong one:
passwd developer
If this user should have the ability to use sudo
commands add them to the sudo group:
usermod -aG sudo developer
Add a .ssh
directory for the user, and make sure it is owned by the new user:
mkdir -p /home/developer/.ssh
chown -R developer:developer /home/developer/.ssh
If you already have SSH keys setup for your root user that you wish to use for the new user, copy the authorized_keys
file to the new user's .ssh
directory though this is probably not recommended:
cp /root/.ssh/authorized_keys /home/developer/.ssh/authorized_keys
chown -R developer:developer /home/developer/.ssh
Now to make it easier to get to the web root we will add a sym-link to /var/www/html
in the new user's home directory:
ln -s /var/www/html /home/developer/html
The new user won't have permission to make changes in the web root so let's change that by adding them to the www-data
group:
usermod -aG www-data developer