SSH Into remote machine
Let, a user wants to ssh into remote machine from admin01 machine , the remote machine is server02 (I’ve configured IP addresses of server02 inside admin01 machine’s /etc/hosts file, you must use IP address of server02 instead of the hostname “server02” if you haven’t configured)
After login into admin01 machine generate public-private key pair:
ssh-keygen
Copy the public key after executing the command below:
cat ~/.ssh/id_rsa.pub
In the remote machine server02, create .ssh directory inside home:
Paste the public key of admin01 here:
mkdir -p ~/.ssh && chmod 700 ~/.ssh ; touch ~/.ssh/authorized_keys
Insert admin01’s public key into server02’s authorized_key file:
echo "${MY_KEY}" >> ~/.ssh/authorized_keys
SSH into server02 from admin01:
ssh server02
I was having issues with `ssh-copy-id server02` command. It was giving this error:
permission denied (publickey gssapi-keyex gssapi-with-mic)
So, I’ve solved it in this way.