---
title: "解决SSH不能连接的问题"
author: "daning"
date: "2008-02-29T16:27:31Z"
tags: []
categories: ["操作系统"]
slug: "ssh"
draft: false
lastmod: "2008-02-29T16:27:31Z"
id: 166186
url: "https://daning.iteye.com/blog/166186"
---

在ubuntu上装ssh服务，
sudo apt-get install ssh
原来这样就可以远程登录了。但是这次居然不可以。
一直显示连接被拒绝。
提示信息是：
ssh: connect to host 133.133.133.65 port 22: Connection refused

遂使用命令重启ssh
sudo /etc/init.d/ssh restart
结果不成功，提示信息是
Privilege separation user sshd does not exist

google了一下，找到了解决方法。

方法一（推荐）：
修改/etc/passwd文件，在其中加入
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin 
或者
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
我加入的是：
sshd:x:109:65534::/var/run/sshd:/usr/sbin/nologin
参考
http://www.unixguide.net/comments/sun/ssh_installation.shtml/37.shtml
http://www.gipsky.com/modules/newbb/viewtopic.php?topic_id=966

方法二（不推荐）：
修改/etc/ssh/sshd_config文件
将其中
UsePrivilegeSeparation yes
修改为
UsePrivilegeSeparation no
虽然能解决问题，但是降低了ssh的安全级别。
参考
http://www.linuxquestions.org/questions/fedora-35/fc4-starting-sshd-privilege-separation-user-sshd-does-not-exist-failed-396068/