Move

240 / 600calories

Exercise

32 / 60minutes

Stand

7 / 12hours

Retrying...

  1. ufw allow 2048/tcp
    • The output = Skipping adding existing rule
    • Skipping adding existing rule (v6)

  2. Edited /etc/ssh/sshd_config
    • Uncommented Port 22

    • Added Port 2048

  3. systemctl restart ssh

No effect after this:

  • davidyim@ctsadmins-MacBook-Pro ~ % ssh -p 2048 root@davidyim.name
    ssh: connect to host davidyim.name port 2048: Connection refused

  • davidyim2@df01898ef77af unzip % nc -zv davidyim.name 2048
    nc: connectx to davidyim.name port 2048 (tcp) failed: Connection refused

Google suggested:

  • systemctl disable --now ssh.socket
    systemctl enable --now ssh.service

(Still does not work)

Google diagnosed the problem correctly: there was a remnant process listening to port 2048 - killing that process and restarted sshd = I can connect to 2048 now. But connecting to port 2048 does not connect me to local Mac Mini

Recap: I can ssh to port 2048 on davidyim.name - but it does not connect to home Mac Mini.

Currently running autossh -M 0 -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -nNTv -R 0.0.0.0:2048:localhost:22 root@davidyim.name from Mac Mini

Modifications made to /etc/ssh/sshd_config

  • Enabled GatewayPorts yes
  • Enabled AllowTcpForwarding yes

Current command: ssh -R 2048:localhost:22 root@davidyim.name -N -f -o ExitOnForwardFailure=yes (following https://www.tencentcloud.com/techpedia/144010)

Listening to processes at port 2048: lsof -i :2048

I briefly made a connection, but cannot replicate the situation

I can consistently make the connection now:

  • SSH daemon listening to Port 2048 was not necessary - this conflicts with reverse tunnelling
  • As long as reverse tunneling process has started + that specific port is open on ufw = sufficient
  • The above command actually backgrounds the process
  • The user name connecting should be local machine user name: ssh -p 2049 davidyim2@davidyim.name

Created a file ~/autossh_reversetunnel.sh and added to Mac OS Login Items:

  • autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -o "ExitOnForwardFailure yes" -N -f -R 2049:localhost:22 root@davidyim.name

One final word: the guide includes practical use cases, one of them being VNC - will investigate, but for now, this project is complete.