how to get the name of current host?

5,133

Solution 1

Tried entering hostname in your Terminal?

Solution 2

check under system preferences->sharing, when you enable remote login on your mac it will tell you right there what user and hostname to use.

Share:
5,133

Related videos on Youtube

One Two Three
Author by

One Two Three

Updated on September 18, 2022

Comments

  • One Two Three
    One Two Three over 1 year

    This may be a pretty dump question!

    So how do I get the host name so that I can ssh into my machine (which is a Mac)?

    For instance : ssh myusername@<hostname> Is there any command to find out the hostname from the terminal?

    [Edit] So I was able to find the host (thanks to your help! :) ). But I'm still getting 'Connection timed out' when trying to ssh into the machine. Actually, I can ssh into my machine from the VM that shared the same connection with this machine. Is there anything else (firewall option/etc) that I need to change to completely enable remote-login?

    Thanks

  • Admin
    Admin about 12 years
    Thanks! So I turned on the remote-login option. But when I tried to ssh from a different account, I keep getting connection timed out. Do you happen to know what else I need to change/re-configure in order to completely enable remote-login ?
  • vextorspace
    vextorspace about 12 years
    As far as I know that is all you need, however Remote Login must either be set to all users or have the user you want in their list. I would expect you need to have a password set for that user as well. On my computer for instance, my user is vextorspace and my ip is 192.168.1.112 and my domain is macbook.local so I can either do an ssh [email protected] or ssh [email protected]. The only things I have set under sharing are remote login and remote management. remote management is for vnc access.
  • Kvothe
    Kvothe over 3 years
    I need a command that obtains the full <hostname> when entered on the remote session. For me hostname does not return <hostname> but an abbreviation.