简体   繁体   中英

User specific hosts in Linux

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM