Monday, January 16, 2023

How to install ssh terminal on your own network? (Part 01)

Introduction 

In terms of having a well redundant network for develoment in my personal opinion you must have a common protocol to comunicate between servers, as my regarding supposition the correct and common protocol is ssh, this article provide several steps to join and conclude a quick reference for the installation.

Development

Case: Installation of WSL/Ubuntu/Windows upper 10+

sudo apt install openssh-server

sudo nano /etc/ssh/sshd_config


Modify next lines:

/etc/ssh/sshd_config

...STUFF ABOVE THIS...

Port 2222

#AddressFamily any

ListenAddress 0.0.0.0

#ListenAddress ::

...STUFF BELOW  THIS..

service ssh start


netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=2222 connectaddress=172.23.129.80 connectport=2222

netsh advfirewall firewall add rule name=”Open Port 2222 for WSL2” dir=in action=allow protocol=TCP localport=2222

netsh interface portproxy show v4tov4


#erase everything

netsh int portproxy reset all

Case: Installation between networks

1. Check fqdn in proper file of windows operating system:

Check this file as Administrator user:

c:\Windows\System32\Drivers\etc\hosts

Add the following line described below:

172.177.126.3 localhost machine-name

2. Configuration of firewall in Linux Machine


  • sudo ufw status verbose
  • sudo ufw allow 22/tcp
  • sudo ufw status verbose
  • sudo ufw allow http
  • sudo ufw allow https
  • sudo ufw allow 80/tcp
  • sudo ufw allow 443/tcp
  • sudo ufw allow 53
  • sudo ufw status verbose
  • sudo ufw allow from 192.168.1.10 to any port 22
  • ufw allow from 192.168.1.0/24 to any app Samba
  • sudo ufw app list
  • sudo ufw status numbered
  • sudo ufw delete {num}
  • sudo ufw delete 5

Reference:

Simic, S. (2022, December 7). How to install and configure FTP server on Ubuntu with VSFTPD. Knowledge Base by phoenixNAP. https://phoenixnap.com/kb/install-ftp-server-on-ubuntu-vsftpd

Installing SFTP/SSH server on Windows using OpenSSH :: WinSCP. (2022, October 24). WinSCP :: Official Site :: Free SFTP and FTP client for Windows. https://winscp.net/eng/docs/guide_windows_openssh_server#win10

How to install and configure open SSH server in Windows 10. (2022, November 10). Askme4Tech. https://askme4tech.com/how-install-and-configure-open-ssh-server-windows-10

How to SSH into WSL2 on Windows 10 from an external machine. (n.d.). Scott Hanselman - Coder, Blogger, Teacher, Speaker, Author. https://www.hanselman.com/blog/how-to-ssh-into-wsl2-on-windows-10-from-an-external-machine

Just a moment... (n.d.). Just a moment... https://www.cyberciti.biz/faq/how-to-open-firewall-port-on-ubuntu-linux-12-04-14-04-lts/