This is a topic I keep searching for every so often, thanks to proxy server misconfigurations. If one needs to push to git or rsync files over a port other than 22, it is possible to do so with a couple of commands.

SSH over 443

We can temporarily set a cloud server to serve SSH over 443. This would allow us to SSH or Rsync over that port.

# Edit sshd config to use port 443 (replace `Port 22` with `Port 443`)
sudo vim /etc/ssh/sshd_config
#Port 22
Port 443

# Stop apache since it listens on 443
sudo systemctl stop httpd.service

# Restart sshd
sudo systemctl restart sshd

Now SSH into that server from your local machine:

ssh -p 443 user@example.com

Once you’re done, revert the settings:

  • replace Port 443 with Port 22 in /etc/ssh/sshd_config
sudo systemctl restart sshd
sudo systemctl start httpd.service

Rsync over SSH

Once you’ve setup your SSH server to serve over 443, you can rsync with the following command:

rsync -v -e "ssh -p443" file.txt user@example.com:/mnt/destination/

GitHub over SSH

GitHub has a brief write up on how to push/pull over port 443.

# Test if you're able to SSH over 443 (you will get "Hi ...!", if successful)
ssh -T -p 443 git@ssh.github.com

# If successful, add the follwoing to ~/.ssh/config
Host github.com
  Hostname ssh.github.com
  Port 443

# Test if new settings work
ssh -T git@github.com

Resources