AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1161579
Accepted
Alan
Alan
Asked: 2019-07-28 17:48:50 +0800 CST2019-07-28 17:48:50 +0800 CST 2019-07-28 17:48:50 +0800 CST

找不到 SSH 服务器 - 即使已安装

  • 772

我有一台运行 Ubuntu 18.04 LTS 的机器,我似乎无法让 SSH 服务器正常工作。

我使用以下方法安装了 SSHServer:

sudo apt install openssh-server

但是当我尝试启动和/或检查状态时,我得到以下信息:

sudo systemctl start sshd

Failed to start sshd.service: Unit sshd.service not found.

.

sudo systemctl status sshd

Unit sshd.service could not be found.

我想我一定是在安装时做错了什么(错字?),所以我尝试再次安装:

sudo apt install openssh-server

我得到:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
openssh-server is already the newest version (1:7.6p1-4ubuntu0.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

因此,它似乎已安装,但由于某种原因 Ubuntu 找不到它。

我不确定从这里去哪里,所以欢迎任何建议。

谢谢,

艾伦。

ssh openssh sshd
  • 2 2 个回答
  • 35633 Views

2 个回答

  • Voted
  1. Best Answer
    Nic Wanavit
    2019-07-28T20:12:07+08:002019-07-28T20:12:07+08:00

    该服务可能未调用 sshd。你可以试试这个命令

    systemctl -l --type service --all|grep ssh
    

    在我的 ubuntu 18.04 上,该服务默认称为 ssh。

    就我而言,我做到了

    sudo systemctl start ssh
    

    如果这不能解决您的问题,您可以重新安装 ssh

    sudo apt-get remove --purge openssh-server
    sudo apt-get update
    sudo apt-get install openssh-server
    
    • 8
  2. Alan
    2019-07-28T21:58:27+08:002019-07-28T21:58:27+08:00
    systemctl -l --type service --all|grep ssh
    

    什么也没返回,所以我按照您的建议删除并重新安装。

    为了以防万一,我在重新安装后也重新启动了(我之前已经重新启动过,但它没有帮助)。现在好像没事了。如果我再次尝试该命令,我会得到:

    ssh.service    loaded    active   running OpenBSD Secure Shell server
    

    如果我运行:

    sudo systemctl status sshd
    

    我得到:

    ● ssh.service - OpenBSD Secure Shell server
    Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
    Active: active (running) since Sun 2019-07-28 17:46:39 NZST; 1min 7s ago
    Process: 1343 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
    Process: 1337 ExecReload=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
    Process: 1151 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
    Main PID: 1166 (sshd)
    Tasks: 1 (limit: 4915)
    CGroup: /system.slice/ssh.service
           └─1166 /usr/sbin/sshd -D
    
    Jul 28 17:46:37 Ubuntu-12345 systemd[1]: Starting OpenBSD Secure Shell server...
    Jul 28 17:46:39 Ubuntu-12345 sshd[1166]: Server listening on 0.0.0.0 port 22.
    Jul 28 17:46:39 Ubuntu-12345 systemd[1]: Started OpenBSD Secure Shell server.
    Jul 28 17:46:39 Ubuntu-12345 sshd[1166]: Server listening on :: port 22.
    Jul 28 17:46:45 Ubuntu-12345 systemd[1]: Reloading OpenBSD Secure Shell server.
    Jul 28 17:46:45 Ubuntu-12345 sshd[1166]: Received SIGHUP; restarting.
    Jul 28 17:46:45 Ubuntu-12345 systemd[1]: Reloaded OpenBSD Secure Shell server.
    Jul 28 17:46:45 Ubuntu-12345 sshd[1166]: Server listening on 0.0.0.0 port 22.
    Jul 28 17:46:45 Ubuntu-12345 sshd[1166]: Server listening on :: port 22.
    

    所以它现在看起来没问题 - 至少据我所知。

    谢谢,

    艾伦。

    • 4

相关问题

  • Gnome-terminal 快捷方式在选项卡中打开多个 ssh 连接

  • 通过 SSH 禁用密码访问?

  • ssh 如何使用多个私钥?

  • 如何通过一个 SSH 连接拥有多个终端会话?

  • 如何与无头服务器进行图形交互?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve