How to get a text file from a server I already SSHed into ?

· 159 words · 1 minute read

I ssh into my server via this command.

sudo ssh -i /Users/mbp/.ssh/authorized_keys/id_bus [email protected]

When I click enter, I should write the sudo password. Then I write the password of the SSH key (id_bus).

Make sure you use the main domain name of your shared hosting or dedicated VPS.

So, I use SCP to download a text file from my server using SSH key identity by this command.

sudo scp -i /Users/mbp/.ssh/authorized_keys/id_bus [email protected]:/home/username/app/storage/logs/laravel.log ~/Downloads/

This command downloads the file /home/username/app/storage/logs/laravel.log into local downloads directory ~/Downloads/.

This part of the command -i /Users/mbp/.ssh/authorized_keys/id_bus using SSH private key to prove my identity.

Note: you run this command on your local computer not on ther remote server.

I hope this post helps you. If you know a person who can benefit from this information, send them a link of this post. If you want to get notified about new posts, follow me on YouTube , Twitter (x) , LinkedIn , and GitHub .

Share:
waffarx cash back