CentOS升級openssh8.9

  1. 安裝telnet,切換為telnet登錄饶号,確保在安裝ssh時能穩(wěn)定連接
[root@localhost ~]# yum install xinetd telnet-server -y
[root@localhost ~]# systemctl enable xinetd 
[root@localhost ~]# systemctl enable telnet.socket
[root@localhost ~]# systemctl start telnet.socket
[root@localhost ~]# systemctl start xinetd
#安裝相關(guān)依賴激率,編譯安裝必備
[root@localhost ~]# yum install  -y gcc gcc-c++ glibc make autoconf pcre-devel  pam-devel
[root@localhost ~]# yum install  -y pam* zlib*
  1. 查看當(dāng)前版本
[root@localhost ~]# ssh -V
OpenSSH_8.0p1, OpenSSL 1.0.2r  26 Feb 2019

3.更新openssl
[root@localhost ~]# yum update openssl
4.安裝opebssh

[root@localhost ~]# systemctl status sshd   #查看sshd
[root@localhost ~]# systemctl stop sshd    #停止sshd
[root@localhost ~]# rm -rf /etc/ssh/ #清理配置文件
#查看當(dāng)前openssh
[root@localhost ~]# rpm  -qa |grep  openssh
openssh-clients-6.6.1p1-31.el7.x86_64
openssh-server-6.6.1p1-31.el7.x86_64
#刪除當(dāng)前openssh
[root@localhost ~]# yum erase -y openssh-clients openssh-server openssh 
#安裝openssh
[root@localhost ~]# yum install -y pam-devel #安裝pam
[root@localhost ]# tar xf openssh-8.9p1.tar.gz #解壓openssh8.9
[root@localhost ]# cd openssh-8.9p1 
#配置
./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/include --with-ssl-dir=/usr/local/bin --with-zlib --with-md5-passwords --with-pam 
## --prefix=/usr/ 這里還是指定一下安裝的目錄路徑;
#--sysconfdir=/etc/ssh 這里指定的配置文件的目錄路徑; 
#--with-openssl-includes=/usr/local/include 看上面講一下;
# --with-ssl-dir=/usr/local/openssl 看上面講一下;后面參數(shù)不需要調(diào)整咳燕,寫上就可以啦
#安裝
make && make install
[root@localhost openssh-8.9p1]# echo $? 檢查,結(jié)果為0就好了
0
[root@localhost openssh-8.9p1]# cd contrib/redhat 在解壓的openssh目錄找到啟動文件
[root@localhost redhat]# ll
總用量 48
-rw-r--r-- 1 confluence confluence    58 2月  23 19:31 gnome-ssh-askpass.csh
-rw-r--r-- 1 confluence confluence    70 2月  23 19:31 gnome-ssh-askpass.sh
-rw-r--r-- 1 confluence confluence 30082 2月  23 19:31 openssh.spec
-rwxr-xr-x 1 confluence confluence  1721 2月  23 19:31 sshd.init
-rw-r--r-- 1 confluence confluence   277 2月  23 19:31 sshd.pam
[root@localhost redhat]# cp -a sshd.init /etc/init.d/sshd
cp:是否覆蓋"/etc/init.d/sshd"乒躺?#回車
#啟動ssh
[root@localhost redhat]# systemctl start sshd
Warning: sshd.service changed on disk. Run 'systemctl daemon-reload' to reload units. #警告了招盲,操作下
[root@localhost redhat]# systemctl daemon-reload #按照上面提示操作
[root@localhost redhat]# systemctl start sshd #啟動
#順便設(shè)置一下開機(jī)自動啟動
#常規(guī)的 systemctl 設(shè)置會給予一個提示,命令被重定向了嘉冒,那么就使用提示給的命令
[root@localhost redhat]# systemctl enable sshd
sshd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig sshd on
#再次設(shè)置開機(jī)啟動
#下面顯示2曹货、3、4讳推、5是on就可以顶籽,其數(shù)字代表啟動級別
[root@localhost redhat]# /sbin/chkconfig sshd on
[root@localhost redhat]# chkconfig --list sshd

注意:該輸出結(jié)果只顯示 SysV 服務(wù),并不包含原生 systemd 服務(wù)银觅。SysV 配置數(shù)據(jù)可能被原生 systemd 配置覆蓋礼饱。 
      如果您想列出 systemd 服務(wù),請執(zhí)行 'systemctl list-unit-files'。
      欲查看對特定 target 啟用的服務(wù)請執(zhí)行
      'systemctl list-dependencies [target]'究驴。

sshd            0:關(guān) 1:關(guān) 2:開 3:開 4:開 5:開 6:關(guān)
#配置允許root登錄
[root@localhost redhat]# vim /etc/ssh/sshd_config
#在文件中加入下面內(nèi)容
permitRootlogin yes
#重啟sshd
[root@localhost redhat]# systemctl restart sshd
[root@localhost redhat]# systemctl status sshd
● sshd.service - SYSV: OpenSSH server daemon
   Loaded: loaded (/etc/rc.d/init.d/sshd; bad; vendor preset: enabled)
   Active: active (running) since 四 2022-04-07 20:27:03 CST; 25s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 25647 ExecStop=/etc/rc.d/init.d/sshd stop (code=exited, status=0/SUCCESS)
  Process: 25650 ExecStart=/etc/rc.d/init.d/sshd start (code=exited, status=0/SUCCESS)
 Main PID: 25656 (sshd)
   CGroup: /system.slice/sshd.service
           ├─13677 sshd: root@notty
           ├─13679 /usr/libexec/sftp-server
           ├─13785 /usr/libexec/sftp-server
           └─25656 sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups

4月 07 20:27:03 localhost.localdomain systemd[1]: Starting SYSV: OpenSSH server daemon...
4月 07 20:27:03 localhost.localdomain sshd[25656]: Server listening on 0.0.0.0 port 22.
4月 07 20:27:03 localhost.localdomain sshd[25656]: Server listening on :: port 22.
4月 07 20:27:03 localhost.localdomain sshd[25650]: Starting sshd:[  確定  ]
4月 07 20:27:03 localhost.localdomain systemd[1]: Started SYSV: OpenSSH server daemon.
#查看版本
[root@localhost redhat]# ssh -V
OpenSSH_8.9p1, OpenSSL 1.0.2k-fips  26 Jan 2017
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末镊绪,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子洒忧,更是在濱河造成了極大的恐慌蝴韭,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,590評論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件跑慕,死亡現(xiàn)場離奇詭異万皿,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)核行,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,157評論 3 399
  • 文/潘曉璐 我一進(jìn)店門牢硅,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人芝雪,你說我怎么就攤上這事减余。” “怎么了惩系?”我有些...
    開封第一講書人閱讀 169,301評論 0 362
  • 文/不壞的土叔 我叫張陵位岔,是天一觀的道長如筛。 經(jīng)常有香客問我,道長抒抬,這世上最難降的妖魔是什么杨刨? 我笑而不...
    開封第一講書人閱讀 60,078評論 1 300
  • 正文 為了忘掉前任,我火速辦了婚禮擦剑,結(jié)果婚禮上妖胀,老公的妹妹穿的比我還像新娘。我一直安慰自己惠勒,他們只是感情好赚抡,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,082評論 6 398
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著纠屋,像睡著了一般涂臣。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上售担,一...
    開封第一講書人閱讀 52,682評論 1 312
  • 那天赁遗,我揣著相機(jī)與錄音,去河邊找鬼灼舍。 笑死吼和,一個胖子當(dāng)著我的面吹牛涨薪,可吹牛的內(nèi)容都是我干的骑素。 我是一名探鬼主播,決...
    沈念sama閱讀 41,155評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼刚夺,長吁一口氣:“原來是場噩夢啊……” “哼献丑!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起侠姑,我...
    開封第一講書人閱讀 40,098評論 0 277
  • 序言:老撾萬榮一對情侶失蹤创橄,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后莽红,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體妥畏,經(jīng)...
    沈念sama閱讀 46,638評論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,701評論 3 342
  • 正文 我和宋清朗相戀三年安吁,在試婚紗的時候發(fā)現(xiàn)自己被綠了醉蚁。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,852評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡鬼店,死狀恐怖网棍,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情妇智,我是刑警寧澤滥玷,帶...
    沈念sama閱讀 36,520評論 5 351
  • 正文 年R本政府宣布氏身,位于F島的核電站,受9級特大地震影響惑畴,放射性物質(zhì)發(fā)生泄漏蛋欣。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,181評論 3 335
  • 文/蒙蒙 一如贷、第九天 我趴在偏房一處隱蔽的房頂上張望豁状。 院中可真熱鬧,春花似錦倒得、人聲如沸泻红。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,674評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽谊路。三九已至,卻和暖如春菩彬,著一層夾襖步出監(jiān)牢的瞬間缠劝,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,788評論 1 274
  • 我被黑心中介騙來泰國打工骗灶, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留惨恭,地道東北人。 一個月前我還...
    沈念sama閱讀 49,279評論 3 379
  • 正文 我出身青樓耙旦,卻偏偏與公主長得像脱羡,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子免都,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,851評論 2 361

推薦閱讀更多精彩內(nèi)容