linux搭建SSH服务器
<p><strong><span style="color: rgba(0, 0, 0, 1); font-size: 16px">搭建ssh服务器</span></strong></p><p><span style="color: rgba(0, 0, 0, 1)">1.安装ssh服务器:<span style="color: rgba(51, 204, 204, 1)">sudo apt-get install openssh-server</span></span></p>
<p><span style="color: rgba(0, 0, 0, 1)"><span style="color: rgba(51, 204, 204, 1)"><img src="https://img2018.cnblogs.com/i-beta/1069003/202001/1069003-20200114171857464-1411892528.png"></span></span></p>
<p> </p>
<p><span style="color: rgba(0, 0, 0, 1)"><span style="color: rgba(51, 204, 204, 1)"></span></span></p>
<p> 2.查看ssh配置文件:vim /etc/ssh/sshd_config</p>
<div class="cnblogs_Highlighter">
<pre class="brush:cpp;gutter:true;"># Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024
# Logging
SyslogFacility AUTH
88 lines yanked </pre>
<p># Authentication:<br>LoginGraceTime 120<br>PermitRootLogin prohibit-password<br>StrictModes yes</p>
<p>RSAAuthentication yes<br>PubkeyAuthentication yes<br>#AuthorizedKeysFile %h/.ssh/authorized_keys</p>
<p># Don't read the user's ~/.rhosts and ~/.shosts files<br>IgnoreRhosts yes<br># For this to work you will also need host keys in /etc/ssh_known_hosts<br>RhostsRSAAuthentication no<br># similar for protocol version 2<br>HostbasedAuthentication no<br># Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication<br>#IgnoreUserKnownHosts yes</p>
<p># To enable empty passwords, change to yes (NOT RECOMMENDED)<br>PermitEmptyPasswords no</p>
<pre class="brush:cpp;gutter:true;"> 1,1 Top
</pre>
</div>
<p> 说明:</p>
<p> Port 22 //默认使用22端口,也可以自行修改为其他端口,但登录时要打上端口号<br data-filtered="filtered"> #ListenAddress //指定提供ssh服务的IP,这里我注释掉。<br data-filtered="filtered"> PermitRootLogin //禁止以root远程登录<br data-filtered="filtered"> PasswordAuthentication yes //启用口令验证方式<br data-filtered="filtered"> PermitEmptyPassword //禁止使用空密码登录<br data-filtered="filtered"> LoginGraceTime 1m //重复验证时间为1分钟<br data-filtered="filtered"> MaxAuthTimes 3 //最大重试验证次数<br data-filtered="filtered"> 保存修改好的配置,退出。</p>
<p>3.我们先不修改,先择启动服务器</p>
<p>4.使用SSH客户端登录</p>
<p>(1)Linux客户机<br data-filtered="filtered"> # ssh 192.168.1.100 //输入服务器IP登录,不加用户名默认以root身份登录<br data-filtered="filtered"> 或者<br data-filtered="filtered"> # ssh<span class="Apple-converted-space"> hui@192.168.1.100 //以hui身份登入服务器</span></p>
<p><span class="Apple-converted-space"><img src="https://img2018.cnblogs.com/i-beta/1069003/202001/1069003-20200114173158728-1026532224.png"></span></p>
<p> </p>
<p> </p>
<p><span class="Apple-converted-space"><br data-filtered="filtered">(2).windows下使用远程登录客户端登录<br data-filtered="filtered"> 时下最流行的是putty这款登录软件,无需安装,下载下来就可以使用,简单、方便、安全!<br data-filtered="filtered"> ·当服务器使用口令验证方式时,只需输入用户名和密码即可</span></p>
<p><span class="Apple-converted-space"><img src="https://img2018.cnblogs.com/i-beta/1069003/202001/1069003-20200114173323583-1850694175.png"></span></p>
</div>
<div id="MySignature" role="contentinfo">
需要程序源码的可以加我微信x241602私聊。<br><br>
来源:https://www.cnblogs.com/huipengbo/p/12193288.html
頁:
[1]