When first enter a sudo ssh localhost
we always get a note like:
The authenticity of host 'localhost (127.0.0.1)' can't be established. ECDSA key fingerprint is SHA256:u0q6ow7gfu4IvqfGOytZB6MKjO479AUr9hulSqO/dy4. Are you sure you want to continue connecting (yes/no/[fingerprint])?
And I want to skip this step.
I have try follow(with sshpass):
ssh-keygen -t rsa -P '' -f ~/.ssh/deploy_rsa<<<y
cat ~/.ssh/deploy_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
sudo ssh-keyscan localhost>>~/.ssh/known_hosts
Well it seems just works in ssh localhost
, but not in sudo ssh localhost
.
So is there any reliable way to access my goal?