ssh配置主機(jī)信任認(rèn)證

sshd 的配置文件
/etc/ssh/sshd_config
     port 修改sshd的端口
     AddressFamily any 支持的IP協(xié)議,any表示ipv4和ipv6
     ListenAddress 0.0.0.0 指定監(jiān)聽的地址,0.0,0,0表示任意地址,也可以指定特定的地址
     KeyRegenerationInterval 1h 密鑰重新生成的間隔
     ServerKeyBits 1024 服務(wù)器端的密鑰長(zhǎng)度
     LoginGraceTime 2m 登陸的寬容期,(密碼等待的時(shí)間)
     PermitRootLogin yes 是否允許root直接登陸
     MaxAuthTries 6 密碼嘗試次數(shù)
     RSAAuthentication yes 是否使用基于密鑰的認(rèn)證
     PubkeyAuthentication yes      是否使用基于密鑰的認(rèn)證
     AuthorizedKeysFile     .ssh/authorized_keys  密鑰存放路徑
     PasswordAuthentication yes 基于口令認(rèn)證
     UsePAM yes  是否使用pam認(rèn)證
     #Banner none   是否顯示banner指定的文件內(nèi)容,(打印歡迎信息)
     #PrintMotd yes   是否顯示/etc/motd文件的內(nèi)容
     #PrintLastLog yes  是否顯示上次登錄的信息,一般不顯示

白名單和黑名單:黑白名單同時(shí)出現(xiàn),黑名單失效
/etc/hosts.allow
/etc/hosts.deny


ssh
     ssh ip COMMAND 執(zhí)行命令返回
          ssh root@192.168.56.28 ifconfig
     -l 指定登錄用戶名
     調(diào)用遠(yuǎn)程圖形化命令
          -X
          -Y


基于密鑰的認(rèn)證:(互信認(rèn)證)
     ssh-keygen
          -t [rsa|dsa] 指定加密算法
          -f /path  指定輸出路徑
          -N 'password' 指定密碼
1 生成一對(duì)密鑰(公鑰和私鑰)
2 將公鑰床送至服務(wù)器某用戶的家目錄下的.ssh/authorized_keys文件中(擁有誰(shuí)的公鑰,誰(shuí)可以登陸當(dāng)前主機(jī))

[root@LinuxTest ~]# ssh-keygen -t rsa   創(chuàng)建公鑰和私鑰
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
6b:e9:a2:39:af:0c:0d:e8:95:6f:ff:4a:fb:fc:17:34 root@LinuxTest
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
| .  .        E   |
|. .o    S   . .  |
|. .o.    o   .   |
| .. .o .+     .  |
|   oo.+oo    .   |
|    ==.==+...    |
+-----------------+

[root@LinuxTest ~]# scp .ssh/id_rsa.pub root@192.168.56.89:/root/.ssh/authorized_keys  發(fā)送公鑰到遠(yuǎn)程服務(wù)器
root@192.168.56.89's password:
id_rsa.pub                                                                                                                                         100%  396     0.4KB/s   00:00    
[root@LinuxTest ~]# ssh 192.168.56.89
Last login: Tue Dec 20 09:29:41 2016 from 192.168.56.28
[root@ray ~]#

sftp ssh協(xié)議類型的ftp
[root@LinuxTest ~]# sftp 192.168.56.89
Connecting to 192.168.56.89...

網(wǎng)站欄目:ssh配置主機(jī)信任認(rèn)證
文章路徑:http://bm7419.com/article10/ipdedo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、自適應(yīng)網(wǎng)站小程序開發(fā)、搜索引擎優(yōu)化網(wǎng)站維護(hù)、定制開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)