You can generate keys with the ' ssh-keygen' command: $ ssh-keygen -t ed25519 This is why you must keep the private key to yourself, otherwise people who have a copy of it can pass through all the doors in which you left your public key. The door will only open if you have the associated private key as you approach.
Think of this process as leaving a real key (the public key) in a remote door. The other key, the public key, is put into the remote account by the owner of that account (which may be you) or by the server administrator. The private key stays on the machine you will connect from which is usually the machine where it is created (for example, your laptop). You create a pair of files known as 'keys', one private and one public, to facilitate this process. This is useful if you'd like to not have to enter the password to an account you own and access frequently, or if you need to connect to a shared account where you are not its owner and do not know its password. SSH key pairs allow users to connect to remote accounts without having to use the password of the remote account. Berkeley Statistics Annual Research Symposium (BSTARS).Artificial Intelligence/Machine Learning.