Ubuntu16.04 搭建ssh

一.安装SSH-server
打开终端,使用超级用户身份安装ssh

ctrl+alt+t
sudo su
apt-get install openssh-server
apt-get install openssh-client
ifconfig        #查看本机IP地址

确认ssh是否安装成功

ps -e | grep ssh*

二.启动与关闭ssh服务

sudo service ssh start  #启动ssh
sudo service ssh stop   #关闭ssh
sudo service ssh restart  #重启ssh

三.配置sshd_config

sudo gedit /etc/ssh/sshd_config  #打开配置文件

把配置文件中的”PermitRootLogin without-password“前面的”#”号去除
再增加一句”PermitRootLogin yes“,
并在文本的最下方复制粘贴以下内容:

Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc
MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org

保存,修改成功

sudo /etc/init.d/ssh restart  #重启ssh服务

四.客户端远程连接
首先将ssh下载到本地。链接:https://pan.baidu.com/s/1TFTFQXZJTpcTl47F2TaWAg 密码:8twq
然后根据下图所示进行操作
这里写图片描述
这里写图片描述

在host name 处填写服务器的IP地址,在user name 处填写 用户名,连接后,输入password即可登录服务器

这里写图片描述

这里写图片描述

猜你喜欢

转载自blog.csdn.net/swiftfake/article/details/79861320