Port Forwarding Using SSH
Sometimes we are faced with the following situation:
graph LR
A(Computer A)-->|SSH|B(Server A 192.168.1.3)
B-->|has access via 192.168.1.2:80|C(Server B 192.168.1.2)
A-->|does not have access|C
Computer A
is the computer that we can operate on, and through SSH, we can access Server A
. Server A
has access to Server B
by a GUI web server running on Server B
's port 80. Theoretically we can have access to Server B
, but since SSH does not a GUI, its's difficult to do so.
The ideal way of tacking this situation is somehow forwarding the 80 port on Server B
to a port on our local computer. By doing so, we can have access to Server B
by visiting the URL in our browser as if we are operating Server A
.
SSH provides a function called port forwarding
to do the exact job.
ssh -L 3311:192.168.1.2:80 [email protected]
This command forward the port at 192.168.1.2:80
to localhost:3311
.
Life Saver When Fixing Someone's Internet
How to get MAC address?
Method 1. On Windows, open terminal and type in getmac -V
Method 2. On Windows, open terminal and type in ipconfig -all
, this command can also give out the DNS server being used.
Method 3. On Windows11 only, right click the network button on the button right corner and select Network and Internet settings
, then click the network adapter you want to check MAC address for and it will show all the information.
Deal with Windows11 Start Menu Search Not Working
Use Task Manager
to restart Windows Explorer
.
PowerToys | Powerful Windows Toolbox
Find it in Microsoft Store.
Win + Number | Open Taskbar Apps
e.g. Win+1
Ctrl+D | Detach from Something
Using this shortcut keys, users can detach from various things. Such as:
ssh
connection, basically replacing the commandexit
screen
in linux. ThoughCtrl+D
is not enough, you should useCtrl+A+D
Oh My Posh | A Theme Engine for Any Shell
Jump to the Installation
part and do according to the docs based on your OS.
Then, read the Prompt
part and setup the terminal profile.
Restart the terminal and you should be ready to enjoy the beautiful terminal.
Personally, I use theme atomic
on my Windows machine and thecyberden
on my linux servers.
Also, Nerd Fonts are recommended. Check out this site to install them.
Personally, I use FuraCode Nerd Font Retina
in any editor and FiraCode Nerd Font Retina
in any terminal. This is because FuraCode
is thinner than FiraCode
and thus can make the code looks compact while FiraCode
has better Nerd Pattern display.
Transfer SSH keys to a New Computer (Windows)
If you purchased a new computer and still want to use the ssh keys on the old computer to log in to your server. Just copy the .ssh
folder under C:\User\yourUserName
in the old computer to the exact path in the new computer. Simple.