Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User specific hosts in Linux

Tags:

linux

ssh

hosts

I want to ssh to a server, I have its IP address. It's suffering to remember it's IP, I want to ssh to it using a host name. But I have no authority to write the /etc/hosts.

Is there a user specific hosts table that I have access to?

like image 435
Joey.Z Avatar asked Nov 19 '25 18:11

Joey.Z


1 Answers

Don't create an alias. This is exactly what ssh config is for.

You can add a host alias in your ssh config in ~/.ssh/config.

Example:

 Host foo
     HostName 172.16.254.1

Now when you type ssh foo it will execute ssh 172.16.254.1.

You can also add a user to the config. Example:

  Host foo
      HostName 172.16.254.1
      User bar
like image 69
dogbane Avatar answered Nov 22 '25 09:11

dogbane



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!