Initial Server Connection

Connect to the server for the first time as a root user. To maintain security standards, we will immediately add a new user to perform server tasks.

Start an SSH connection.

ssh -i ~/.ssh/ssh-key-file root@ip

For example, ssh -i/.ssh/ root@

Enter Yes to add the server to the known_hosts file.

Adding a Server User

Once logged in, add a new user as a security measure. The new credentials will be used to login into the server, install software, upload files, run the application, and perform maintenance.

adduser username

For example, adduser john.

Enter password for the user. We recommend using KeyChain to generate and store a strong password, then copy and paste it into the terminal.

Enter additional info as needed.

Add user to the sudo group.

usermod -aG sudo username

For example, usermod -aG sudo john.

Enabling Remote User Access

Copy SSH keys to the user directory.

cp -r ~/.ssh /home/username

For example, cp -r ~/.ssh /home/john.

Set permissions.

chown -R username:username /home/username/.ssh

For example, chown -R john:john /home/john/.ssh.

Exit your remote session.



Next: Server Connection Scripts