First of all, thanks for everyone's advices.
My testing environment: two ubuntu servers (abbreviate as S1, S2)
Server version: 22.04.2 LTS
My Steps for configuring ssh login without password as below:
install open-ssh both server and client on S1 and S2
check ssh from S1 to S2 within password => OK
generate key pair on S1
ssh-keygen -t ed25519
copy public key from S1 to S2
ssh-copy-id -i MY_ID.pub USERNAME@IP_S2
check the public key appended at ~/.ssh/authorized_keys on S2
edit the /etc/ssh/sshd_config config file on S2
PubkeyAuthentication yes
ChallengeResponseAuthentication no
PasswordAuthentication no
edit the /etc/ssh/sshd_config.d/50-cloud-init.conf on S2
#PasswordAuthentication yes
restart the sshd on S2
sudo systemctl restart sshd
ssh from S1 to S2 => Fail
Error message: Permission denied (publickey).
NOTE-1: if I markdown PasswordAuthentication no, I can be ssh from S1 to S2. However, it still has to entry password.
NOTE-2: I have been edit the relationship between hostname and IP on /etc/hosts file.
I have referred the following posts, but can not solve my situation according to them. ref: SSH without password does not work after upgrading from 18.04 to 22.04 and Unable to disable password authentication over SSH
How to fix it?
Best appreciation.