Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
lyaspire
V2EX  ›  Linux

关于 Linux 下进行 SSH 连接登陆的问题:如何设置默认的登陆用户名?

  •  
  •   lyaspire · Jan 26, 2018 · 3404 views
    This topic created in 3080 days ago, the information mentioned may be changed or developed.

    比如我们现在有两台机器:

    机器 1:ip:192.168.0.2 用户:m_1
    机器 2:ip:192.168.0.3 用户:m_2
    

    比如我们在 机器 1 上要 SSH 连接到 机器 2,执行 ssh 192.168.0.3,那么登陆的结果将是 [email protected],机器 2 没有 m_1 这个用户,那么将无法登陆。所以应该执行 ssh [email protected] 在 ip 前加上用户名和 @ 。

    那么问题是:能不能设置 ssh 的配置文件,修改这种 ssh 'ip' 连接方式下默认使用的用户名不再是当前的用户,而是我们指定的用户名。比如执行 ssh 192.168.0.3 其结果不再是 [email protected] 而是 [email protected]

    irockytan
        1
    irockytan  
       Jan 26, 2018 via Android
    man ssh_config
    lyaspire
        2
    lyaspire  
    OP
       Jan 26, 2018
    @irockytan thanks
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2472 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 00:35 · PVG 08:35 · LAX 17:35 · JFK 20:35
    ♥ Do have faith in what you're doing.