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下载到本地。
然后根据下图所示进行操作
Ubuntu16.04 搭建ssh_第1张图片
Ubuntu16.04 搭建ssh_第2张图片

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

这里写图片描述

Ubuntu16.04 搭建ssh_第3张图片

你可能感兴趣的:(搭建服务器及后期运行维护)