如何改变一个特定的IP地址的SSH端口?

我得到了腻子的麻烦,所以我更喜欢使用shell(linux)通过SSH访问服务器,我的IP地址有更改端口为SSH是6091,所以有反正通过命令通过SSH访问服务器

ssh root@myipaddress 

因为我有很多服务器有默认的ssh端口是22,所以我只是想把端口改成特定的ip地址。

长期最舒适的解决scheme是将主机添加到~/.ssh/config文件中。 编辑/创build文件并添加:

  Host home User root Hostname myipaddress Port 6091 

然后,您可以简单地连接到家:

  ssh home 

更多信息

ssh -p 6091 root @ myipaddress

 -p port Port to connect to on the remote host. This can be specified on a per-host basis in the configuration file. 

添加到你的〜/ .ssh / config

  Host special HostName special.myjob.com Port 22000 User fooey 

现在你可以运行:

  ssh special 

要得到

  ssh -p 22000 [email protected] 

更多的ssh提示:

http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/

对于系统范围的更改,可以在/ etc / ssh / sshd_config文件中更改端口号,然后重新启动ssh服务/ deamon