---
title: "【转】ubuntu安装ssh server"
author: "GhostWolf"
date: "2014-11-19T17:09:02Z"
tags: []
categories: ["操作系统"]
slug: "ubuntu-ssh-server"
draft: false
lastmod: "2014-11-19T17:09:02Z"
id: 2158160
url: "https://ghostwolf.iteye.com/blog/2158160"
---

转载链接：http://www.cnblogs.com/nodot/archive/2011/06/10/2077595.html

 

SSH分客户端openssh-client和openssh-server  
如果你只是想登陆别的机器的SSH只需要安装openssh-client（ubuntu有默认安装，如果没有则sudo  
apt-get install openssh-client），如果要使本机开放SSH服务就需要安装openssh-server  
sudo apt-get install openssh-server  
然后确认sshserver是否启动了：  
ps -e |grep ssh  
如果看到sshd那说明ssh-server已经启动了。  
如果没有则可以这样启动：sudo /etc/init.d/ssh start 或者 service ssh start  
ssh-server配置文件位于/etc/ssh/sshd\_config，在这里可以定义SSH的服务端口，默认端口是22，你可以自己定义成其他端口号，如222。  
然后重启SSH服务：  
sudo  
/etc/init.d/ssh stop  
sudo /etc/init.d/ssh start  
然后使用以下方式登陆SSH：  
ssh [username@192.168.1.112](mailto:username@192.168.1.112) username为192.168.1.112 机器上的用户，需要输入密码。