I am following the well-accpeted answer of [terminal - How to ssh to remote web server without using a password - Ask Different](https://apple.stackexchange.com/questions/48685/how-to-ssh-to-remote-web-server-without-using-a-password) to ssh to remote sever without password > I have installed ssh configure of github on both local and remote. so this is the second ssh configuration > > also reference to [Linux/Mac Tutorial: SSH Key-Based Authentication - How to SSH Without a Password - YouTube](https://www.youtube.com/watch?v=vpk_1gldOAE) 1, Generate a fresh key pair on local mac: ``` $ sudo ssh-keygen -t rsa -b 4096 -f ~/.ssh/webserver Generating public/private rsa key pair. /Users/me/.ssh/webserver already exists. Overwrite (y/n)? y Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/me/.ssh/webserver. Your public key has been saved in /Users/me/.ssh/webserver.pub. The key fingerprint is: SHA256:Ux2ntGEN66Jvpr/eJyWagEHO3frJP51SlIJGP5zGBic [email protected] The key's randomart image is: +---[RSA 4096]----+ | *o. | | . E+.B. | | + . o.O=. . | me at Max-2018 in ~/.ssh $ ls MyKeyPair.pem config id_rsa.pub webserver SecondKeyPair.pem id_rsa known_hosts webserver.pub ``` 2, copy the new key to remote server,(Centos) ``` $ scp webserver.pub [email protected]:/root/.ssh/ [email protected]'s password: webserver.pub 100% 745 45.3KB/s 00:00 [root@iz2ze9wve43n2nyuvmsfx5z .ssh]# cat webserver.pub >> authorized_keys [root@iz2ze9wve43n2nyuvmsfx5z .ssh]# cat authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8iFaLTdhR878LvznCn2PoiIG0ve5at7Bm4NtmLSmoCdNc7iAWoqQLtvx0WoX00TY0+GtaOF3n3P+O0LflIFV5B+m8Wh1PrpOP2fzBSrwQEL3UUtQ/Ti5vUd7FE2LUla8gjFglV83HFTFRwe2O4G6OutwmrBm0+ ``` 3, change permissions of .ssh ``` #on the remote [root@iz2ze9wve43n2nyuvmsfx5z ~]# chmod 700 ~/.ssh [root@iz2ze9wve43n2nyuvmsfx5z ~]# chmod 700 ~/.ssh/* #on the local $ chmod 700 ~/.ssh $ sudo chmod 700 ~/.ssh/* ``` 4, config ``` $ cat ~/.ssh/config #the above part is the newly added. Host myserver.com IdentityFile ~/.ssh/webserver User root Host * AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_rsa ``` Till now, finished all the steps from the answer "This will get you the password-less, keypair-based authentication you desire." 5. Unfortunately: ``` $ ssh [email protected] [email protected]'s password: ``` 6, I followed the thumbs youtube instrucitons [Linux/Mac Tutorial: SSH Key-Based Authentication - How to SSH Without a Password - YouTube](https://www.youtube.com/watch?v=vpk_1gldOAE) change the `/etc/ssh/sshd_config` ``` sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak #Change to no to disable tunnelled clear text passwords PasswordAuthentication no # and restart [root@iz2ze9wve43n2nyuvmsfx5z ~]# sudo systemctl restart sshd ``` 7, Try again from the local ``` [root@iz2ze9wve43n2nyuvmsfx5z ~]# ssh [email protected] Permission denied (publickey,gssapi-keyex,gssapi-with-mic). ``` 8, I search solutions to use scp ssh-copy-id ``` $ ssh-copy-id -i webserver.pub [email protected] /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "webserver.pub" /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]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). ``` 9, I check another vedio [SSH without password | Tutorial - YouTube](https://www.youtube.com/watch?v=i10NDSwJO3E) which achieve it just use step 1 and step 2, What's the problem with my trying?