通过免密码登陆:https://www.yuque.com/mugpeng/linux/bazwcy#548ss
    已经很方便了,密码都不用老是输入了。

    但可不可以再偷懒一点呢?
    image.png

    像大家,随随便便不都是配置了多台服务器的吗?这么多username, ip, port谁顶得住啊:
    image.png 当然,你可以像我一样记录下来。

    这必须记不住啊!

    或者熟练使用history 命令,这大概是我用的最熟练的操作了:
    image.png

    如果我能直接用别名,比如 ssh cuiflower 替代某台服务器的访问就好了。

    我们可以在.ssh 目录下的config 文件追加一下配置:

    1. Host cuiflower
    2. HostName 192.168.130.128 # 服务器IP
    3. User mugpeng # 用户
    4. Port 22 # 端口

    试试看:

    $ cat >> config
    Host cuiflower
        HostName 192.168.130.128
      User mugpeng
      Port 22    
    ^C # ctrl + c 退出编辑
    
    $ ssh cuiflower
    Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.8.0-41-generic x86_64)
    
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    
    
    243 updates can be installed immediately.
    24 of these updates are security updates.
    To see these additional updates run: apt list --upgradable
    
    Your Hardware Enablement Stack (HWE) is supported until April 2025.
    Last login: Tue Feb  9 18:54:32 2021 from 192.168.130.1
    

    scp 也是同理:

    $ scp -r cuiflower:~/Desktop ~/Desktop/
    test1.txt                                     100%    0     0.0KB/s   00:00
    

    使用起来几乎等于用cp 命令了。
    ps:就是没办法对远程路径使用tab。

    有点舒服,哈哈。
    image.png