read

This is a small post about uploading a file over SSH to a remote Linux server.

I love to run my first .sh scripts (thanks Chat-GPT!); I edit and store them for now on my Windows PC. Over SSH I copy them to the remote Linux machine. SCP (Secure Copy) does the job well!

Download over SSH:

scp your_username@remotehost.com:yourfile.txt /local/dir
 scp root@192.168.10.50:../MyAmazingScript.sh e:\mywindowsfolder\

Upload over SSH:

scp <file to upload> <username>@<hostname>:<destination path>
scp e:\mywindowsfolder\yourfile.txt root@192.168.10.50:../linuxfolder/

Alternative:

#!/bin/bash

cd ./files-to-upload
scp * user@host:/path/to/upload/files/to

Extra:

This to list files remotely and directly close the connection afterwards

ssh root@192.168.10.50 ls -l ../

This is to run the the script remotely and directly close the connection afterwards

ssh root@192.168.10.50 ls bash /folder/MyAmazingScript.sh
Blog Logo

Vincentde Koning

The world is a playground!


Published

Image

DE KONING

Projects, Adventures and Experiments

Back to Overview