How To Setup The Server - kgolezardi/SAD-Project GitHub Wiki

Suppose we've got a server that is going the be named heart.

Setting up /etc/hosts

Put the following at the end of /etc/hosts file on your local machine.

<server-ip> heart

Creating new user on servers

$ ssh root@heart
# Now we're on the server
$ adduser <your-username>
# Now provide your new password and other information.
$ usermod -aG sudo <your-username>
$ cd ~<your-username>
$ su <your-username>
$ mkdir .ssh
$ echo "<your-public-ssh-key>" >> .ssh/authorized_keys

Note that your public SSH key can be found in ~/.ssh/id_rsa.pub on your local machine. If this file does not exist, run ssh-keygen first.

Setting up SSH config file

Put the following in your own ~/.ssh/config file:

Host heart
    Hostname <server-ip>
    User <your-username>

Setting up the server for the second user

You should do the following:

  • Setting up /etc/hosts
  • Then you need to add your SSH public key:
$ ssh <your-username>@heart
# Now you should be in the server as <your-username> and in ~
$ echo "<your-public-ssh-key>" >> .ssh/authorized_keys

Again, note that your public SSH key can be found in ~/.ssh/id_rsa.pub on your local machine. If this file does not exist, run ssh-keygen first.

  • Setting up SSH config file

Everything should be fine

Now you can run ssh heart and you should be logged in by your own user.

⚠️ **GitHub.com Fallback** ⚠️