Xshell连接Ubuntu

连接操作

https://blog.csdn.net/lianghe_work/article/details/47340141

遇到的问题

  1. sudo apt-get install openssh-server报错
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    ll@ubuntu:~$ sudo apt-get install openssh-server
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    openssh-server : Depends: openssh-client (= 1:7.2p2-4ubuntu2.8)
    Depends: openssh-sftp-server but it is not going to be installed
    Recommends: ssh-import-id but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

解决办法 sudo apt-get install openssh-client=1:7.2p2-4ubuntu2.8
执行以上命令后在执行安装就可以了, 不过要和以上报错的版本对应

  1. root用户无法登陆
  • 在其他用户下切换sudo su root切换到root用户
  • vi /etc/ssh/sshd_config
    1
    2
    3
    <!-- 加一句去一句 -->
    PermitRootLogin yes
    # PermitRootLogin prohibit-password
  • /etc/init.d/ssh restart 来重启ssh服务
  1. /usr/bin/xauth: file /root/.Xauthority does not exist
    1
    2
    3
    4
    vi /etc/ssh/sshd_config

    添加 AllowAgentForwarding yes
    /etc/init.d/ssh restart 来重启ssh服务
  2. Ubuntu 输入正确的密码后重新返回到登陆界面

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×