I am trying to copy a file from my computer to my server through scp command. I have changed the default sshd port from 22 to 36871. Now, the problem is when I issue the scp command over port 36871, I get a "Connection refused" error, as it tries to connect through the default port 22. I issue the command as follow:
sudo scp /Users/developer/Desktop/file.zip -P 36871 admin@XXX.XXX.XXX.XXX:public_html
I don't have this problem when I change the port back to 22 and issue the following command:
sudo scp /Users/developer/Desktop/file.zip -P 22 admin@XXX.XXX.XXX.XXX:public_html
Update: It seems it does not have to do with my server's firewall settings. The problem is that when I issue the command with a port other than 22, my computer's firewall (Little Snitch) shows that the terminal wants to connect with port 22. In other words, the terminal does not even try the other port. I think there is a problem with the command itself. Do I need to enter the port in some other arrangement?
Any ideas would be appreciated.
Thanks