Objective: Upload Files/Folder from my local to server. (How to Send Files from your localhost to Another Server through SSH)
Challenge: I’m bored to use Filezilla. So just have to use putty or Git Bash or Windows Subsystem.
I have used Ubuntu Subsystem in my Windows 10 for SSH access.
Solution: Use Secure Copy Command from your local machine and login to server directly.
Command:
sudo scp -i key.pem -r /mnt/d/sourcefolder/ [email protected]:/var/html/destination/
- Sudo – So to not ask permission for each and every file.
- scp – Secure Copy command to copy files between servers. you should use scp so it would use SSH for transferring files and would use authentication like password or pem key.
- -i key.pem – this is the key for my server login authentication.
- -r -recursive files/subfolders inside the folder.
- /mnt/d/sourcefolder/ – Source folder in local.
- [email protected]: – user in the particular server and its IPv4. you can also use root or ubuntu.
- /var/html/destination – Destination folder
Task Completed Successfully.
Note: Remember that the folder copied to the server is under the user centos/root/ubuntu.