Copy files and folder to remote server having different port number

To copy files to remote server use SCP (Secure copy) and SSH. Steps are listed below:

Copy files to remote server on different port number (say 2345)

$ scp -P 2345 cat.mp4 [email protected]:/home/video

#-P = indicate it is a port number [UPPERCASE P], 2345 is actual port number.
#cat.mp4 = name of a file to copy
#john = user on a remote server
# = server IP Address
#/home/video = folder on the remote server where the file cat.mp4 will be copied

Now to copy a directory to remote server having different port, use following command

$ scp -P 4567 -r photo_gallary [email protected]:/home/video

-r = recursively copy all the files and folder inside photo_gallary 

To copy From remote server to your local computer

scp -P 4567 -r [email protected]:/home/john/SmallSites/resource /home/john/Desktop/

Note: you can also use rsync

$ rsync -aruv photo_gallary [email protected]:/home/video