linux搭建SSH服務器


搭建ssh服務器

1.安裝ssh服務器:sudo apt-get install openssh-server

 

 2.查看ssh配置文件:vim /etc/ssh/sshd_config

# 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         

# Authentication:
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

                                      1,1           Top

 說明:

  Port 22  //默認使用22端口,也可以自行修改為其他端口,但登錄時要打上端口號
  #ListenAddress   //指定提供ssh服務的IP,這里我注釋掉。
  PermitRootLogin   //禁止以root遠程登錄
  PasswordAuthentication  yes  //啟用口令驗證方式
  PermitEmptyPassword   //禁止使用空密碼登錄
  LoginGraceTime  1m   //重復驗證時間為1分鍾
  MaxAuthTimes   3    //最大重試驗證次數
  保存修改好的配置,退出。

3.我們先不修改,先擇啟動服務器

4.使用SSH客戶端登錄

(1)Linux客戶機
  # ssh 192.168.1.100   //輸入服務器IP登錄,不加用戶名默認以root身份登錄
  或者
  # ssh hui@192.168.1.100   //以hui身份登入服務器

 

 


(2).windows下使用遠程登錄客戶端登錄
  時下最流行的是putty這款登錄軟件,無需安裝,下載下來就可以使用,簡單、方便、安全!
  ·當服務器使用口令驗證方式時,只需輸入用戶名和密碼即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM