Recent Posts

Featured image for SSH Through A Router Without Port Forwarding

SSH Through A Router Without Port Forwarding

If you want to establish an SSH connection to your “linux server” from the outside without configuring port forwarding on your router, you can use SSH remote port forwarding. This technique allows you to connect to an external server (let’s call it “my_other_server”) and have it forward traffic back to your “linux server.” Here’s how you can do it:

  1. SSH from linux_server to my_other_server:

    Open a terminal on your “linux server” and use the following command to initiate an SSH connection to “my_other_server,” specifying remote port forwarding:

    bash
    1
    
    [user@linux_server]$ ssh -R 8022:localhost:22 my_other_server.com

    Explanation: This command connects to “my_other_server” and opens port 8022 on that server, which will forward traffic back to your “linux_server” on port 22.

  2. SSH from my_other_server back to linux_server:

    Now that you have established the remote port forwarding, you can SSH from “my_other_server” to your “linux_server” through the established tunnel. On “my_other_server,” open a terminal and use the following command:

    bash
    1
    
    [user@my_other_server]$ ssh -p 8022 localhost

    Explanation: This command connects to “my_other_server” itself but uses port 8022, which is being forwarded to your “linux_server.” As a result, your SSH traffic is tunneled back to your “linux_server.”

  3. Handling Connection Stability:

    If you encounter problems with the initial tunnel dropping out, you can take several measures:

    • Keepalive Settings: Adjust the SSH keepalive settings to ensure the connection stays alive. You can add the following options to your SSH command on “my_other_server”:

      bash
      1
      
      [user@my_other_server]$ ssh -o ServerAliveInterval=60 -p 8022 localhost

      This setting sends a keepalive packet every 60 seconds to maintain the connection.

    • Use autossh: autossh is a tool that helps maintain SSH tunnels. It automatically restarts SSH sessions and keeps tunnels alive even if they disconnect. You can install it and use it in place of regular SSH like this:

      bash
      1
      
      [user@my_other_server]$ autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -p 8022 localhost

      This command uses autossh with specified options to ensure a stable SSH tunnel.

Featured image for Configure Postfix to use Gmail as a Mail Relay

Configure Postfix to use Gmail as a Mail Relay

If you have a Gmail account, you can configure your Mail Transfer Agent (MTA) to relay outgoing mail through Gmail. This provides you with the reliability and infrastructure of Gmail for sending emails from the command line. In this tutorial, we’ll use Postfix as our MTA, which is a secure and open-source mail transfer agent. We’ll cover instructions for various operating systems.

Configure Postfix to use Gmail as a Mail Relay

Featured image for Change HOME Directory to User Profile Directory CYGWIN

Change HOME Directory to User Profile Directory CYGWIN

You want to change the home directory for users in Cygwin to their Windows profile directory. You’ve already identified the relevant configuration file, /etc/nsswitch.conf, and the db_home parameter. Here’s how you can change the home directory to the Windows profile directory using this configuration:

  1. Open /etc/nsswitch.conf: Use your preferred text editor (e.g., nano, vim, or notepad) to open the /etc/nsswitch.conf file in Cygwin.

  2. Edit the db_home parameter:

    Locate the line that starts with db_home:. You’ve already made the necessary change, but make sure it looks like this:

    Code
    db_home: /%H/

    This change specifies that the home directory should be located in the Windows profile directory, which is represented by %H.

  3. Save and Exit:

    If you’re using a text editor within Cygwin, save your changes and exit the editor.

  4. Restart Cygwin:

    To apply the changes, you’ll need to restart any Cygwin processes. You can do this by closing and reopening your Cygwin terminal or by restarting your computer.

Featured image for Configure Locales in Ubuntu

Configure Locales in Ubuntu

Configure Locales in Ubuntu

Locales (language settings) can be configured for Ubuntu from the command line. This guide is applicable to Ubuntu 11.10 and provides steps for displaying current settings, available locales, and adjusting locales as needed.

Displaying the Current Settings

You can check the current locale settings using the locale command:

Featured image for Installing VirtualBox as a Service on Windows using NSSM

Installing VirtualBox as a Service on Windows using NSSM

In this article, we will guide you through the process of installing VirtualBox as a Windows service using NSSM (Non-Sucking Service Manager) and starting a Virtual Machine automatically as a service. This can be useful for scenarios where you need a Virtual Machine to run in the background, even when the user is not logged in.

Prerequisites

Before we begin, ensure that you have the following prerequisites in place:

Featured image for Setting up an HTTPS Proxy with Apache

Setting up an HTTPS Proxy with Apache

In this article, we will walk you through the process of setting up an HTTPS proxy using Apache. An HTTPS proxy can be useful for various purposes, such as load balancing, reverse proxying, or providing an additional layer of security for your web applications.

To configure Apache as an HTTPS proxy, you will need to make use of the mod_proxy and mod_proxy_http modules, along with the SSL-related settings. Below are the steps to configure Apache as an HTTPS proxy with the provided SSL settings: