DEV Community

Jasper Rodda
Jasper Rodda

Posted on • Updated on

Securely copy secret.pem file from local to a remote machine.

  1. locate secret.pem file /home/Jasper/MyDocuments/secrets/secret.pem
  2. Copy secret.pem file from local to remote machine
  • List files in present folder
/home/Jasper/MyDocuments/secrets/ ls
Jenkins_default.png  secret.pem
Enter fullscreen mode Exit fullscreen mode
  • Copy secret.pem file from local to remote machine
scp -i /home/Jasper/MyDocuments/secrets/secret.pem /home/Jasper/MyDocuments/secrets/secret.pem ubuntu@5.54.193.106:/home/ubuntu
Enter fullscreen mode Exit fullscreen mode
  • Output:
The authenticity of host '5.54.193.106 (5.54.193.106)' can't be established.
ED25519 key fingerprint is SHA256:qOMD/OD6lMLFEkqiuodkj0XNTCw3kPgdQ8ljzoeGHh98.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? y
Please type 'yes', 'no' or the fingerprint: yes
Warning: Permanently added '5.54.193.106' (ED25519) to the list of known hosts.
secret.pem   
Enter fullscreen mode Exit fullscreen mode
  • SSH from bastian host to another host in private subnet ssh -i secret.pem ubuntu@10.10.0.1

Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.19.0-1025-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Thu Aug 31 05:32:50 UTC 2023

  System load:  0.0               Processes:             99
  Usage of /:   20.8% of 7.57GB   Users logged in:       1
  Memory usage: 26%               IPv4 address for eth0: 10.0.135.36
  Swap usage:   0%

 * Ubuntu Pro delivers the most comprehensive open source security and
   compliance features.

   https://ubuntu.com/aws/pro

Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


The list of available updates is more than a week old.
To check for new updates run: sudo apt update

Last login: Thu Aug 31 05:25:56 2023 from 10.0.26.238
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Enter fullscreen mode Exit fullscreen mode
  • In Ubuntu - create an "index.html" file and host in python vim "index.html"
<!DOCTYPE html>
<html>
<head>
<title>MyApp</title>
</head>
<body>

<h1>This is from private app hosted in subnetg</h1>
<p>This is a paragraph.</p>

</body>
</html>
Enter fullscreen mode Exit fullscreen mode
  • run python3 server to host index.html application
ubuntu@ip-10-0-135-36:~$ python3 -m http.server 8000

Enter fullscreen mode Exit fullscreen mode

Top comments (0)