Deepin安装SSH服务器

 

一、安装ssh

 

sudo -i #切换到root用户
apt-get install openssh-server #安装ssh服务器端


在终端输入SSH获得如图1所示提示命令说明成功安装

 

 

图1 ssh命令的参数

二、配置SSH


配置ssh配置文件

vi /etc/ssh/ssh_config #ssh 配置文件

 


#prot 22 的注释删除 开放端口22号,在把 #PasswordAuthentication yes 注释删除允许验证密码登录。

在配置sshd-config文件

vi /etc/ssh/sshd_config #ssh 配置文件

 


#PermitRootLogin prohibit-password的注释删除,换成 PermitRootLogin yes允许Root登录 把#Port 22注释删除开放22端口

三、启动ssh服务

 

service ssh start #启动ssh服务

 


主机登录Deepin虚拟机,如图2所示。

 

 

 

图2 登录成功

四:常用命令

1.安装ssh服务

sudo apt-get install openssh-server

2.启动ssh服务
sudo /etc/init.d/ssh start
3.设置开机自启动
sudo systemctl enable ssh
4.关闭ssh开机自动启动命令
sudo systemctl disable ssh
5.单次开启ssh
sudo systemctl start ssh
6.单次关闭ssh
sudo systemctl stop ssh
7.设置好后重启
reboot

 

 

 posted on 2023-05-18 09:59  wu小强  阅读(453)  评论(0编辑  收藏  举报