My How Tos
  1. You are here:  
  2. Home
  3. Categories
  4. System Setups
  • Linux

Edit System Hostname

This is to manually change the system so it understands the hosts name and fqdn or the host.

 

1- Edit the hosts file

  • sudo nano /etc/hosts
  • change the second 127.0.0.1 hostname to 127.0.0.1 name.domain.com name
  • close and save the file

2- Edit the hostname file

  • sudo nano /etc/hostname
  • remove the single line of text and replace it with just the host name (without the domain.com)

 

3- Reboot your system

UFW For Ubuntu

Please use the following web page for full information on the commands I reference below. UFW Essentials

 

1- sudo ufw enable

2- sudo ufw default deny incoming

3- sudo ufw default allow outgoing

4- sudo ufw default deny routed

 

Is SSH Running on Port 22 (5a) or a Custom Port(5b)?

5a- ufw allow ssh or ufw allow openssh (depending on application reference each allow TCP port 22)

 

5b- sudo cp /etc/ufw/applications.d/openssh-server /etc/ufw/applications.d/customssh

 

6- sudo nano /etc/ufw/applications.d/customssh

change the [OpenSSH] to [customssh]

change the application name to custom ssh server

leave description alone so you know it later references openssh services

change the port number to the port your ssh server uses ex: 1022/tcp

press ctrl + x to exit editing and press y and hit enter to save the file

 

7- sudo ufw allow customssh

 

8- sudo ufw reload

 

for more advanced setting please use the reference at the top of the article

SSH Keys for Users via PuttyGen

Step 1: Generate the Key Pair in PuTTYgen
  1. Launch the PuTTYgen application on your local computer.
  2. Locate the Parameters section at the bottom of the window.
  3. Choose your key type; Ed25519 or RSA (minimum 2048 bits) are highly recommended.
  4. Click the Generate button.
  5. Move your mouse cursor randomly over the blank space to generate entropy until the progress bar fills.
Step 2: Save Your Keys
  1. Locate the Key passphrase and Confirm passphrase fields.
  2. Type a secure password to protect your private key file.
  3. Click Save private key.
  4. Save the file with a .ppk extension in a secure location on your local machine.
  5. Do not close the PuTTYgen window yet.
Step 3: Copy the OpenSSH Public Key
  1. Go to the text box at the top labeled “Public key for pasting into OpenSSH authorized_keys file”.
  2. Right-click inside that box and select Select All.
  3. Press Ctrl + C to copy the entire public key string.
Step 4: Install the Public Key on Ubuntu
Log into your Ubuntu server using your existing credentials and execute the following commands to register your new public key: [1]
  1. Create the SSH directory for your user if it does not exist:
    mkdir -p ~/.ssh
    
     
  2. Open or create the authorized_keys file using a text editor like Nano:
    nano ~/.ssh/authorized_keys
     
  3. Paste the copied public key string into the file (Ensure it stays on a single line).
  4. Save and exit the editor (Press Ctrl + O, Enter, then Ctrl + X).
  5. Restrict permissions on the directory and file to secure them (you must set to this any lax permissions and it wont load the key):
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys
    
Step 5: Connect Using PuTTY
  1. Open the main PuTTY application.
  2. Enter your Ubuntu server's IP address or hostname under Session.
  3. Navigate to Connection > SSH > Auth > Credentials in the left sidebar sidebar.
  4. Click Browse next to “Private key file for authentication”.
  5. Select the .ppk file you saved in Step 2.
  6. Return to Session, give it a name under Saved Sessions, and click Save.
  7. Click Open and enter your Ubuntu username and key passphrase to connect. 

 

Reference : Google Search

Main Menu

  • Home
    • All
  • Categories
  • Out Of Date Topics

Login Form

  • Forgot your password?
  • Forgot your username?