Copying a file is one of the simplest tasks you can do with Junos PyEZ or with Junos in general. You typically do this for example when you are copying the text file for request support information before you submit it to support. Having said that, let's get right into an example of this using Junos PyEZ.
In my previous post Managing SSH Logins The Way You Are Supposed To I talked about how you should use the SSH config file to manage your SSH login details. The lab example that we used is 1 SSH client and 2 SSH servers which are both 1 hop from the client. 1 hop in a sense that both can be accessed directly from the client. There is nothing standing in between any of them.
Do you ever find yourself trying to remember all the server names or IP addresses along with the usernames you need to log in to them? And what if you're using SSH key-based authentication (like I discussed here) and you're using different keys on different group of servers. It's actually not practical to maintain all of this information externally. In fact, you really are supposed to manage this in SSH itself.
In my last post How To Configure SSH Key-based Authentication on Linux, I gave a walkthrough on how to set up SSH keys with an SSH agent so you get the benefits of passwordless logins while still maintaining the increased security that key-based authentication is supposed to provide. The reason why I reiterate this is because using SSH keys without passphrases pretty much defeats the purpose of using keys at all.
In my last post about The Easiest Way to Build a Network Automation Lab, I have introduced the topic of SSH key-based authentication. Although that post was specific to Networking, this particular post is quite applicable to anything Linux and UNIX-like. I will specifically be performing all procedures on Centos 7 but by no means it will not apply to other Linux distributions. There should be minimal differences, if not, none at all. Let's dive in.