-
Notifications
You must be signed in to change notification settings - Fork 0
How To Setup The Server
Kiarash Golezardi edited this page Feb 6, 2019
·
1 revision
Suppose we've got a server that is going the be named heart.
Put the following at the end of /etc/hosts file on your local machine.
<server-ip> heart
$ 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.
Put the following in your own ~/.ssh/config file:
Host heart
Hostname <server-ip>
User <your-username>
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
Now you can run ssh heart and you should be logged in by your own user.