Download / Upload local files to a remote server using SSH and PuTTY

Download / Upload local files to a remote server using SSH and PuTTY

Open SSH Client is now built-in in Windows 10, from Windows 10 Fall Creators Update RS3 v. 1709 and enabled by default from Windows 10 April 2018 Update v. 1803. So you can do some basic operations like SSH a server, rename files, delete files, check the list of directories, etc from CMD without starting PuTTY.


Connect sever with windows 10 built-in Open SSH Client

ssh username@123.123.123.123 -p 10022

-p defines the port. Default is 22. If you want to use default port then don’t need to use -p flag.

Press enter it ask for our password. Type or password and hit enter. If you want to copy-paste password, copy password from somewhere then on your command line just click “Right-Click” on your mouse. Remember password isn’t visible in command-line interface.

ls

After successful login . Type ls to see the list of files and folder in the directory. Also you may be need to jump of the directory using ” cd ../ ” if you want to change directory.


Copy full directory. Remote -> Local

For this you will need to use PSCP from PuTTY. Download and install PuTTY first. Either from there website or with chocolatey. I would prefer chocolatey. Simply run your CMD as administrator and typo following.

choco install putty
refreshenv

Then run following command.

pscp -P 10022 -r username@123.123.123.123:/folder_path c:\mytemp

and check your C:\mytemp folder. You may change the destination folder as your wish. -r flag used for recursively copy files.


Copy full directory. Local -> Remote

pscp -P 10022 -r c:\mytemp username@123.123.123.123:/folder_path 

Copy file. Remote -> Local

Then run following command.

pscp -P 10022 username@123.123.123.123:/folder_path/filename.txt c:\mytemp\filename.txt

and check your C:\mytemp folder. You may change the destination folder as your wish.


Copy files. Local -> Remote

pscp -P 10022 c:\mytemp\filename.txt username@123.123.123.123:/folder_path/