Step 1: Create user

Assuming your newly created server doesn’t already have the user you want, you’d run useradd -m {NEW_USER} to create that user and their home directory. For example, to create the user ‘leland’, I’d use the following command:

# useradd -m leland

This will create the user leland on the system, then create a home directory for that user with the same name as the user, and correctly associate the two. So the user leland would (by default) also now have a home directory of /home/leland.

Step 2: Set password

Now, set the password for the newly created user with passwd. For the brand new leland user, I’d use:

# passwd leland

At the prompt you’ll type in the new password for that user.

Step 3: Sudo access

Assuming you’re using an Ubuntu-based system, to give an existing user sudo access, add them to the sudo group with the usermod -a -G sudo {USERNAME} command. For example, given our newly created leland user, I’d use:

# usermod -a -G sudo leland

And that would add leland to the sudo group, giving leland sudo access.

Step 4: SSH Keys

Now that the user is configured, we add our local SSH keys so we can use them to log in as that user on the server. To do that, we use the ssh-copy-id command on our local machine. For example, on my laptop, I’d run the following to add my laptops public SSH keys to the leland user on the remote:

$ ssh-copy-id leland@{IP_ADDRESS}

Then, after typing in the password for leland on the server, my laptop would add its public key to the server, thus allowing for automatic login via SSH.

Step 5: Install Environment

Finally, we want to install our custom environment configurations on our server. I have a custom install script just for this, and I’d automatically install it with something like this:

$ curl | sh

You’ll have to use your own install method for your own configuration, whatever that is.