I know this question might have been asked before But I still cannot really find the answer, and the answer in my case should be simple.
So what have I done is in my ECS server I created a new user and gave it sudo
privilege by assigning it to the sudo group. Then I change some of the sshd_config parameter:
- change port from 22 to another
- PermitRootLogin from "yes" to "no"
- PasswordAuthentication from "yes" to "no"
And then I generate SSH key by ssh-keygen -t rsa
and copy it to the authorized_keys by ssh-copy-id user@ipAddress
and then I restart the server, ssh login to the server and get the Permission denied (publickey) error.
In the server /home/user/.ssh
folder lies authorized_keys, id_rsa.pub
and id_rsa
three files. But in my local machine .ssh
folder there is no key file.
So where is the problem?