When you connect to a server via ssh on command line, you are usually prompted to add the public key of the server to the ~/.ssh/known_hosts by confirmation. This is what the code you've posted does 'manually'.
this post was submitted on 22 Feb 2026
8 points (100.0% liked)
Linux Questions
3758 readers
8 users here now
Linux questions Rules (in addition of the Lemmy.zip rules)
- stay on topic
- be nice (no name calling)
- do not post long blocks of text such as logs
- do not delete your posts
- only post questions (no information posts)
Tips for giving and receiving help
- be as clear and specific
- say thank you if a solution works
- verify your solutions before posting them as facts.
Any rule violations will result in disciplinary actions
founded 2 years ago
MODERATORS