美文网首页
mac使用终端远程连接liunx

mac使用终端远程连接liunx

作者: 葡小萄家的猫 | 来源:发表于2017-09-15 20:18 被阅读13次

    格式

    ssh -p 端口号 用户名@主机IP
    例子
    ssh -p 22 root@198.168.25.168
    

    第一次连接报错

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    
    Snip20171012_7.png Snip20171012_8.png
    ssh-keygen -l -f ~/.ssh/known_hosts //查看添加的IP
    ssh-keygen -R 192.168.25.135 //初次连接的IP
    ssh root@192.168.25.135 //连接服务器
    

    报错问题:permission denied 或者authentication denied,

    大致意思就是权限不足
    vi /etc/ssh/ssh_config 
    进入编辑状态
    把PasswordAuthentication设成yes 
    把PasswordAuthentication前面的#号去掉
    然后使用命令关闭ssh服务 
    sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist 
    然后重启,去掉un 
    sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist 
    查看重启状态 
    sudo launchctl list | grep ssh 
    然后重新连接应该就能连上了

    相关文章

      网友评论

          本文标题:mac使用终端远程连接liunx

          本文链接:https://www.haomeiwen.com/subject/zasesxtx.html