Support Questions

Find answers, ask questions, and share your expertise

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

avatar

I am installing single node cluster but I am getting the Permission denied (publickey,gssapi-keyex,gssapi-with-mic) .

however I have set

PasswordAuthentication yes
PermitRootLogin yes 
in the /etc/ssh/sshd_config 
service sshd restart

i have done below steps from root :

selinux=disabled
service iptables stop
service ip6tables stop
chkconfig iptables off 
chkconfig ip6tables off 
service ntpd start
chkconfig ntpd on
ssh-keygen -t rsa
cd .sshcat id_rsa >> authorized_keys
chmod 700 ~/.ssh

when i try to

[root@instance-5 .ssh]# ssh host
root@104.196.221.168's password:

but earlier trying the same root password on the same host required .

Thanks

Anurag

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Anurag Mishra

I guess the command the following command was incorrectyou are storing Private key instead of Public key file.

# cd .ssh
# cat id_rsa >> authorized_keys

.

You should be passing the "id_rsa.pub" file instead like following

# cd .ssh
# cat id_rsa.pub >> authorized_keys
(OR)
# ssh-copy-id  -i ~/.ssh/id_rsa.pub  $HOST

.

Additionally can you please verify if the "hostname" which you are passing to the SSH command is correct? Please run the following command to verify the hostname.

# hostname
# hostname -f

.

Then after verifying the hostname please run the below command.

# ssh-copy-id  -i ~/.ssh/id_rsa.pub  $HOST

.

View solution in original post

1 REPLY 1

avatar
Master Mentor

@Anurag Mishra

I guess the command the following command was incorrectyou are storing Private key instead of Public key file.

# cd .ssh
# cat id_rsa >> authorized_keys

.

You should be passing the "id_rsa.pub" file instead like following

# cd .ssh
# cat id_rsa.pub >> authorized_keys
(OR)
# ssh-copy-id  -i ~/.ssh/id_rsa.pub  $HOST

.

Additionally can you please verify if the "hostname" which you are passing to the SSH command is correct? Please run the following command to verify the hostname.

# hostname
# hostname -f

.

Then after verifying the hostname please run the below command.

# ssh-copy-id  -i ~/.ssh/id_rsa.pub  $HOST

.