在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ Linux/
Linux 下常用壓縮文件的解壓、壓縮
  • 1.
Maven 安裝和配置
  • 1.
CentOS 網(wǎng)絡(luò)設(shè)置
  • 1.
  • 1.
  • 1.
TeamCity 安裝和配置
Zsh 入門
  • 1.
  • 1.
Bash 其他常用命令
Bash 常用命令
  • 1.
  • 1.
  • 1.
Ubuntu 介紹
Ubuntu 網(wǎng)絡(luò)相關(guān)設(shè)置問(wèn)題
Nginx 安裝和配置
  • 1.
  • 1.
  • 1.
  • 1.
Linux-Tutorial
Nexus 安裝和配置
  • 1.
黑客入侵檢查
Yum 下載安裝包及對(duì)應(yīng)依賴包
  • 1.
  • 1.
Tomcat 8 安裝和配置、優(yōu)化
  • 1.
Ubuntu 安裝和分區(qū)



SSH 安裝

  • 查看是否已安裝:

    • CentOS:rpm -qa | grep openssh
    • Ubuntu:dpkg -l | grep openssh
  • 安裝:
    • CentOS 6:sudo yum install -y openssh-server openssh-clients
    • Ubuntu:sudo apt-get install -y openssh-server openssh-client

SSH 配置文件常用參數(shù)

  • 配置文件介紹(記得先備份):sudo vim /etc/ssh/sshd_config
    • Port 22 #默認(rèn)指定 22 端口,可以自己修改
    • Protocol 2,1 #指定了 SSH 協(xié)議版本,目前 SSH 只有兩個(gè)版本 2 和 1
    • PasswordAuthentication yes #是否開啟密碼驗(yàn)證,因?yàn)?SSH 也可以設(shè)置秘鑰類授權(quán)登錄的方式,如果用這種方式我們可以考慮關(guān)掉密碼登錄的方式。
    • PermitEmptyPasswords no #是否允許密碼為空,與上面參數(shù)配合用。

SSH 允許 root 賬戶登錄

  • 編輯配置文件(記得先備份):sudo vim /etc/ssh/sshd_config
    • 允許 root 賬號(hào)登錄
      • 注釋掉:PermitRootLogin without-password
      • 新增一行:PermitRootLogin yes

SSH 密鑰登錄

  • 生成秘鑰和公鑰文件,命令:sudo ssh-keygen,在交互提示中連續(xù)按三次回車,如果看得懂交互的表達(dá),那就根據(jù)你自己需求來(lái)。默認(rèn)生成密鑰和公鑰文件是在:/root/.ssh。
  • 進(jìn)入生成目錄:cd /root/.ssh,可以看到有兩個(gè)文件:id_rsa (私鑰) 和 id_rsa.pub (公鑰)
  • 在 .ssh 目錄下創(chuàng)建 SSH 認(rèn)證文件,命令:touch /root/.ssh/authorized_keys
  • 將公鑰內(nèi)容寫到SSH認(rèn)證文件里面,命令:cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
  • 修改SSH認(rèn)證文件權(quán)限,命令:
    • sudo chmod 700 /root/.ssh
    • sudo chmod 600 /root/.ssh/authorized_keys
  • 重啟服務(wù):sudo service ssh restart
  • 設(shè)置 SSH 服務(wù)默認(rèn)啟動(dòng):sudo sysv-rc-conf ssh on

現(xiàn)在 SSH 客戶端可以去拿著 SSH 服務(wù)器端上的 id_rsa,在客戶端指定秘鑰文件地址即可,這個(gè)一般由于你使用的客戶端決定的,我這里推薦的是 Xshell 軟件。

SSH 資料

上一篇:下一篇: