一般情況下,在安裝Linux系統時會自動安裝好bash軟件,查看系統bash版本的命令如下:
[root@localhost ~]# cat /etc/redhat-release # 顯示Linux的環境版本
CentOS release 6.8 (Final)
[root@localhost ~]# bash –versuion # 顯示bash的版本
GNU bash, version 4.1.2(1)-release(x86_64-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation. Inc.
如果Shell版本較舊的話,建議升級到最新版本的Shell,特別是企業用戶。因為近年老版本的的bash被暴存在嚴重的安全漏洞。例如:bash軟件曾經爆出了嚴重漏洞(破殼漏洞),憑借此漏洞,攻擊者可能會接管計算機的整個操作系統,得以訪問各種系統內的機密信息,并對系統進行更改。任何人的計算機系統,如果使用了bash軟件,都需要立即打上補丁。檢查系統是否存在漏洞的方法:
[root@localhost ~]# env x='() { :; }; echo be careful' bash -c "This is a test"
This is a test.
如果上面的顯示,系統無需升級的。如果是返回下面兩行,則表示要盡快升級bash.
[root@localhost ~]# env x='() { :; }; echo be careful' bash -c "This is a test"
be careful
This is a test
升級方法如下:
[root@localhost ~]# yum -y update bash # 使用yun來升級bash
[root@localhost ~]# rpm -qa bash # 查看最新的bash版本
bash-4.1.2-40.e16.x86_64