Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

v-server-setup

SSH Key Pair Setup and Nginx Configuration

This document outlines the steps taken to set up an SSH key pair, configure SSH authentication, set up Nginx, and link the SSH key with GitHub.

Generated SSH key

Created an SSH key pair using the command:

   ssh-keygen -t ~/.ssh/demo_ed25519 -C "DA live call demo key"

Added public key to server

  1. Used ssh-copy-id to add the public key to the remote server for passwordless login:
   ssh-copy-id username@host
  1. Test ssh connection before disabling password-based login
   ssh servername@host

Configured SSH access

  1. Updated the SSH server configuration file to allow login only via SSH key, disabling password-based login:
   /etc/ssh/sshd_config
  1. In the config file changed the "PasswordAuthentication" to "no"

  2. Restarted the SSH service to apply the changes:

   sudo systemctl restart sshd
  1. Successfully logged in to the server using the SSH key (passwordless login).

SSH Alias Setup

  1. Created an SSH alias to avoid using the full path to the SSH key every time:
   alias dal_connect="ssh -o StrictHostKeyChecking=False -i ~/Users/macUserName/.ssh/id_ed25519 username@host"
  1. Checking if the alias is existing
   alias | grep dal
  1. Testing that a login with alias is working:
   dal_connect

Set up Nginx webserver

  1. Installed NGINX package and set up a basic webpage:
sudo apt install nginx -y
  1. Created a custom Nginx page by editing the default HTML content
   sudo mkdir var/www/alternatives
   sudo touch /var/www/alternatives/alternate-index.html
  1. Updated the page content in the configuration:
   sudo nano /etc/nginx/sites-enabled/alternatives
  1. Added server blocks with port 8081 and html

  2. Ensured the Nginx service was running:

   sudo service nginx restart
  1. Opening the NGINX webpage using the IP address
  2. Adding a port 8081 to see the changed HTML page after updating the configuration:
   localhost:8081

Adding SSH Key to GitHub

  1. Added the public SSH key to GitHub to authenticate Git operations from the server under "Settings > SSH and GPG Keys".
  2. Retrieved the public key using:
     cat ~/.ssh/id_ed25519.pub

Configuring Git on the Server

Configured Git on the server to use the same username and email as on GitHub for consistency:

   git config --global user.name "GitHub Name"
   git config --global user.email "my-email@example.com"

Authenticated with GitHub

Verified SSH authentication with GitHub by running:

  ssh -T git@github.com

Cloned Git Repository

   git clone git@github.com:Bodev13/v-server-setup.git

Add new test text

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors