linux开启ssh服务

本文概略:1)ubuntu发行版开启ssh。2)centos发行版开启ssh

1、ubuntu发行版安装/开启ssh服务

 1.1 安装ssh服务端

sudo apt-get install openssh-server

 1.2 开启ssh服务

sudo /etc/init.d/ssh start

 1.3 查看ssh服务端是否启动了

ps -e | grep ssh
  555 ?        00:00:00 sshd

 1.4 ssh服务进程(sshd)已经开启后就可以进行连接了。(假设开启ssh服务的机器IP为192.168.1.1)

ssh root@192.168.1.1

 1.5 如果需要,还可以修改ssh服务端开启的端口。ssh默认的端口是22,可以更改端口。

  1.5.1 首先,停止ssh服务

  1.5.2 然后修改ssh的配置文件

vi /etc/ssh/sshd_config

  看到如下所示的内容进行修改即可

# What ports, IPs and protocols we listen for
Port 22

  1.5.3 启动ssh服务

 2、CentOS发行版开启ssh服务

  2.1 默认CentOS已经安装了OpenSSH,即使你是最小化安装也是如此,但是万一没有呢。这里使用yum进行安装。

yum install openssh

  2.2 开启ssh服务

/etc/init.d/sshd start

作者:风波

mail : fengbohello@qq.com

原文地址:https://www.cnblogs.com/fengbohello/p/4127023.html