Is it possible to add a username a password to a hostname in /etc/hosts?

Like: a.b.c.d username:password@hostname

  • No, /etc/hosts is used only to map an IP address to a name.
    – ThoriumBR
    Nov 13, 2022 at 19:52
  • Welcome to the community. What have you tried so far? The hosts file is not like the shadow file where it could lead to corruption of the whole file if edited incorrectly or with a text editor. Also, this seems to be not quite the right place for this question, I think it belongs in SuperUser? Nov 13, 2022 at 20:33
  • Thank you. I will try it out hoping to get a solution.
    – 1n4ho12
    Nov 13, 2022 at 21:33
  • This is not a security question and you have accepted an answer to a cross-post of this on SuperUser.
    – schroeder
    Nov 14, 2022 at 0:27


Browse other questions tagged or ask your own question.