Connect to ssh

hello,
I am a beginner and i have a question please.
when i nmap an ip address, i get for example port 22 ssh.
can i connect to that server using “ssh username@ip” ? if yes, what username or password should i provide? does hack the box provide username/passwork ? should i also write theese credentials in etc/hosts ?
thank you in advance i am still a total beginner i’m still learning.