Quantcast
Channel: Copy a file between two Ubuntu instances - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2

Answer by user1179897 for Copy a file between two Ubuntu instances

$
0
0

If you have created the ssh keys on the instance1 then in the /home/username/.ssh or /root/.ssh directory there will be a file called the id_rsa.pub. Take this file and copy its contents into the authorized_keys file (creating it most likely) in the other instance2 directory, reverse the procedure for the instance2 .pub file to instance1. Once done you have passwordless copying in place. This works for any account.

Without access to anything except side by side on screen or written to paper for it. Then opening of the .id_rsa.pub and writing it into the mentioned file authorized_keys. Once done in instance2 then you can copy it back from them to your authorized_keys file, their .id_rsa.pubThere is a good amount of characters to copy and everything you see needs to be copied over into the other file exactly as it appears. On one long single line that starts with the.

ssh-rsa AAAAB3NzaC1yc

For example the start of my public key file.

Root is always disabled now I see this in your edit. You need to login as normal user then use sudo or su to become root to do anything as root. #PermitRootLogin prohibit-password needs to be Yes in your /etc/ssh/sshd_config to allow it access. Then only for the time to get a /root/.ssh/authorized_keys file in place to allow the key method to be used. You need to restart the ssh service sshd restart both times you edit the file once when enabling and the second when you disable as soon as possible, namely immediately upon the key file put in place and a logout and back in with it confirms it works.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>