MacOS上的殺毒軟件ClamAV
0、最重要的事情
1、一定要讀用戶手冊栓袖,很多操作和配置用戶手冊都用提到。
用戶手冊:https://docs.clamav.net/manual/Installing.html
2店诗、善用搜索引擎裹刮,有時英文搜索效率較高。
1庞瘸、Mac用戶下載
找到官網下載頁面捧弃,選擇需要的系統(tǒng),即可下載并安裝。
下載頁面:https://www.clamav.net/downloads
選擇最后一個pkg安裝包
2违霞、Mac用戶安裝
找到已經下載好的pkg安裝包嘴办,雙擊后輸入密碼即可安裝。
安裝簡單
3买鸽、Mac用戶配置殺毒軟件
默認配置即可涧郊,如需特別配置參見用戶手冊。
用戶手冊:https://docs.clamav.net/manual/Usage/Configuration.html
主要的配置文件有三個癞谒,分別是下圖
clamav配置文件
如果目錄下不存在可以手工命令創(chuàng)建
方法1:
clamconf -g freshclam.conf > freshclam.conf
clamconf -g clamd.conf > clamd.conf
clamconf -g clamav-milter.conf > clamav-milter.conf
方法2:
touch freshclam.conf
touch clamd.conf
touch clamav-milter.conf
4底燎、同步病毒庫
創(chuàng)建好三個空配置文件后,使用freshclam命令同步最新的病毒庫弹砚。
XXX@XXXXMac etc % freshclam
Creating missing database directory: /usr/local/clamav/share/clamav
ERROR: Failed to create database directory: /usr/local/clamav/share/clamav
Manually prepare the database directory, or re-run freshclam with higher privileges.
ERROR: Initialization error!
#注意使用管理員權限運行
XXX@XXXXMac etc % sudo freshclam
Creating missing database directory: /usr/local/clamav/share/clamav
Assigned ownership of database directory to user "clamav".
ClamAV update process started at Sat Feb 4 21:44:12 2023
daily database available for download (remote version: 26802)
Download failed (92) Message: Stream error in the HTTP/2 framing layeriB
Can't download daily.cvd from https://database.clamav.net/daily.cvd
Trying again in 5 secs...
daily database available for download (remote version: 26802)
Time: 2m 40s, ETA: 54m 09s [> ] 2.72MiB/57.84MiB
5双仍、運行掃描查殺制定文件
添加ClamAV運行環(huán)境變量,以zsh為例
vi ~/.zshrc
#添加下面的語句到.zshrc文件
export PATH=/usr/local/clamav/bin:/usr/local/clamav/sbin:$PATH
在命令行運行下列命令
clamdscan [*options*] [*file/directory/-*]
#例:對 file1.apk 掃描
clamdscan file1.apk
6桌吃、安裝過程中其他問題
問題1:無法創(chuàng)建或編輯freshclam.conf等配置文件
chmod 775 XXX.conf
#修改要編輯的文件權限即可
問題2:vi無法修改freshclam.conf
在編輯freshclam.conf文件時會顯示E212朱沃、E325錯誤
E212: Can't open file for writing
出現(xiàn)E212這個錯誤的原因可能有兩個:
1當前用戶的權限不足
2此文件可能正被其他程序或用戶使用。
E325: ATTENTION
Found a swap file by the name "/var/tmp/freshclam.conf.swp"
owned by: XXXX dated: 六 2 04 21:37:33 2023
file name: /usr/local/clamav/etc/freshclam.conf
modified: YES
user name: windnemo host name: winddeMac-mini.local
process ID: 37868
While opening file "freshclam.conf"
出現(xiàn)E325這個錯誤的原因可能有兩個:
1此文件可能正被其他程序或用戶使用茅诱。
2編輯器崩潰過緩存文件沖突逗物,這時只需要刪除"/var/tmp/freshclam.conf.swp"文件
問題3:創(chuàng)建了freshclam.conf依然無法運行
$ freshclam
ERROR: Can't open/parse the config file /usr/local/etc/clamav/freshclam.conf
需要修改報錯的配置文件,如freshclam.conf等
# Comment or remove the line below.
Example
↓ 把上面的格式瑟俭,改為下面的翎卓。暨注釋掉Example。
# Comment or remove the line below.
# Example