$ ssh-keygen -t rsa -b 2048 -v
This will prompt you for a filename. Enter something simple and unique like "rally". There is no need to enter a password.
Output:Generating public/private rsa key pair. Enter file in which to save the key (/home/ops/.ssh/id_rsa): rally Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in rally. Your public key has been saved in rally.pub. The key fingerprint is: SHA256:a2JVkaY7V2VtCum+uP6pcsuxCYLSDmM3Di5lMBl3GWI [email protected] The key's randomart image is: +---[RSA 2048]----+ |XE=...ooooo | |&=o.. + | |oB o+.o . . | |. .. + o.= + . | | . =S* . | | o . =. | | o o | | ......... | | +=++. | +----[SHA256]-----+
$ ssh-copy-id -i rally.pub [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "rally.pub" The authenticity of host '192.168.0.1 (192.168.0.1)' can't be established. ECDSA key fingerprint is SHA256:ps0kmToFDj85quAVhRZhycd84KBnn1k7otGCQ30Senc. Are you sure you want to continue connecting (yes/no)? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys [email protected]'s password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh '[email protected]'" and check to make sure that only the key(s) you wanted were added.
$ sftp -i rally [email protected]
Connected to 192.168.0.1. sftp>
sftp> pwd
Remote working directory: /upload
<Please see attached file for image>