22.04 ﻮﺘﻧﻮﺑﻭﺍ ﺭﺩ ﺹﺎﺧ ﯼﺎﻫ ﺕﺭﻮﭘ ﺎﯾ USB ﻢﺘﺴﯿﺳ ﻥﺩﺮﮐ ﻝﺎﻌﻓﺮﯿﻏ ﻩﻮﺤﻧ


.ﺪﻫﺩ ﯽﻣ ﻥﺎﺸﻧ ،ﺹﺎﺧ USB ﯼﺎﻫ ﺕﺭﻮﭘ ﯼﺍﺮﺑ ﻪﭼ ﻭ ﻞﻣﺎﮐ ﻢﺘﺴﯿﺳ ﺮﯾﺯ ﺭﺩ ﻪﭼ ،ﻮﺘﻧﻮﺑﻭﺍ ﺭﺩ ﺍﺭ U

:ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﻩﺍﺭ 3 ﻖﯾﺮﻃ ﺯﺍ ﺍﺭ USB ﻪﻧﻮﮕﭼ ﻪﮐ ﻢﻫﺩ ﯽﻣ ﻥﺎﺸﻧ ﺎﻤﺷ ﻪﺑ ﺎﺠﻨﯾﺍ ﺭﺩ ،ﺮﮕﯾﺩ

  • ﻢﺘﺴﯿﺳ ﺮﯾﺯ ﻞﮐ USB ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﺍﺭ
  • ﻪﻈﻓﺎﺣ ﻂﻘﻓ USB ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﺍﺭ – ﺶﻠﻓ ﻮﯾﺍﺭﺩ ﻪﺑ ﯽﺳﺮﺘﺳﺩ ﻂﻘﻓ USB ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿ
  • ﻩﺎﮔﺭﺩ USB ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﺍﺭ ﺹﺎﺧ

ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﺎﻫ ﺲﮐﻮﻨﯿﻟ ﺮﯾﺎﺳ ﻭ ﻮﺘﻧﻮﺑﻭﺍ ﺭﺩ ﺍﺭ USB ﯽﻋﺮﻓ ﻢﺘﺴﯿﺳ :1 ﻪﻨﯾﺰﮔ

.ﺪﻧﺭﺍﺪﻧ ﮊﺭﺎﺷ ﯼﺍﺮﺑ ﯽﻗﺮﺑ ﭻﯿﻫ USB ﯼﺎﻫ ﺕﺭﻮﭘ ﻭ .ﺪﻧﻮﺷ ﯽﻣ ﻝﺎﻌﻓﺮﯿﻏ ﺙﻮﺗﻮﻠﺑ ،ﺖﺸﮕﻧﺍ ﺮﺛﺍ ﻩ

.ﺪﯿﻨﮐ ﯼﺪﻨﺑﺮﮑﯿﭘ ﺱﻮﯾﺎﺑ ﺕﺎﻤﯿﻈﻨﺗ ﺭﺩ ﺍﺭ ﻥﺁ ،ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﺍﺭ ﻥﺁ ﺭﻭﺎﭘ ﻪﻤﮐﺩ ﻥﺩﺍﺩ ﺭﺎﺸﻓ

1. ﺎﯾ ﺪﯾﻮﺷ ﻞﺼﺘﻣ ﻮﺘﻧﻮﺑﻭﺍ ﺭﻭﺮﺳ ﻪﺑ ﺎﯾ ﺍﺪﺘﺑﺍ Ctrl+Alt+T ﮏﺳﺩ ﺭﺩ

sudo nano /etc/default/grub

ﯽﻣ ،ﭖﺎﺘﮑﺳﺩ ﻪﺨﺴﻧ ﯼﺍﺮﺑﺪﯿﻧﺍﻮﺗ nano ﺎﺑ ﺍﺭ gedit

.ﺪﯿﻫﺩ ﺭﺎﺸﻓ ﻮﻧﺎﻧ ﻦﺘﻣ ﺮﮕﺸﯾﺍﺮﯾﻭ ﺯﺍ ﺝﻭﺮﺧ ﯼﺍﺮﺑ ﺍﺭ Ctrl+X ﻭ ﻩﺮﯿﺧﺫ ﯼﺍﺮﺑ ﺍﺭ

2. ﻪﺑ ﯼﺍﺮﺑ ﺍﺭ ﺭﻮﺘﺳﺩ ،ﺲﭙﺳﯼﺪﻨﺑﺮﮑﯿﭘ ﯽﻧﺎﺳﺭﺯﻭﺭ grub ﺪﯿﻨﮐ ﺍﺮﺟﺍ:

sudo update-grub

ﺩﻮﺷ ﻝﺎﻤﻋﺍ ﺎﺗ ﺪﯿﻨﮐ ﯼﺯﺍﺪﻧﺍ ﻩﺍﺭ ﺍًﺩﺪﺠﻣ ﺍﺭ ﺩﻮﺧ ﻪﻧﺎﯾﺍﺭ ،ﻡﺎﻤﺗﺍ ﺯﺍ ﺲﭘ .ﺪﺷﺎﺑ ﺕﻭﺎﻔﺘﻣ

.ﺪﻨﮐ ﻪﻓﺎﺿﺍ ﺍﺭ ﻪﺘﺴﻫ ﺮﺘﻣﺍﺭﺎﭘ «ﯽﻣﻮﻤﻋ ﺕﺎﻤﯿﻈﻨﺗ» ﻪﮔﺮﺑ ﻪﺑ ﻦﺘﻓﺭ ﺎﺑ ﻭ ﺪﻨﮐ ﯼﺯﺍﺪﻧﺍﻩﺍ

ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﺍﺭ USB ﯼﺯﺎﺳ ﻩﺮﯿﺧﺫ ﻩﺎﮕﺘﺳﺩ ﻂﻘﻓ :2 ﻪﻨﯾﺰﮔ

.ﺪﻨﮐ ﺭﺎﮐ ﻥﺎﻨﭽﻤﻫ ﺍﺭ ﯽﻠﺧﺍﺩ USB ﯼﺎﻫ ﻩﺎﮕﺘﺳﺩ ﺮﯾﺎﺳ ﻭ ﺱﻭﺎﻣ ،ﺪﯿﻠﮐ ﻪﺤﻔﺻ ،ﺪﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﺍﺭ

1. ﻝﺎﻨﯿﻣﺮﺗ ﺍﺪﺘﺑﺍ (Ctrl+Alt+T) ﺪﯿﻨﮐ ﺍﺮﺟﺍ ﯼﺪﻨﺑﺮﮑﯿﭘ ﻞﯾﺎﻓ ﺶﯾﺍﺮﯾﻭ ﻭ ﺩﺎﺠﯾﺍ ﯼﺍ

sudo nano /etc/modprobe.d/blacklist-usb-storage.conf

ﯽﻣ ،ﻦﯿﻨﭽﻤﻫﺪﯿﻧﺍﻮﺗ nano ﺪﯿﻨﮐ ﻦﯾﺰﮕﯾﺎﺟ ﺩﻮﺧ ﻩﺍﻮﺨﻟﺩ ﻦﺘﻣ ﺮﮕﺸﯾﺍﺮﯾ

blacklist usb_storage
blacklist uas

.ﺪﯿﻫﺩ ﺭﺎﺸﻓ ﻮﻧﺎﻧ ﻦﺘﻣ ﺮﮕﺸﯾﺍﺮﯾﻭ ﺯﺍ ﺝﻭﺮﺧ ﯼﺍﺮﺑ ﺍﺭ Ctrl+X ﻭ ﻩﺮﯿﺧﺫ ﯼﺍﺮﺑ ﺍﺭ Ctrl+S ﺲﭙﺳ

2. ﯽﻧﺎﺳﺭ ﺯﻭﺭ ﻪﺑ ﯼﺍﺮﺑ ﺍﺭ ﺭﻮﺘﺳﺩ ،ﻥﺁ ﺯﺍ ﺲﭘ initramfs ﺪﯿﻨﮐ ﺍﺮﺟﺍ.

sudo update-initramfs -u

USB ﯼﺯﺎﺳ ﻩﺮﯿﺧﺫ ﯼﺎﻫ ﻩﺎﮕﺘﺳﺩ ﻪﺑ ﯽﺳﺮﺘﺳﺩ ﯼﺍﺮﺑ .ﺪﻨﮐﯽﻣ ﺩﻭﺪﺴﻣ ﺍﺭ (uas/p>

ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﺍﺭ ﺹﺎﺧ USB ﻩﺎﮔﺭﺩ :3 ﻪﻨﯾﺰﮔ

.ﺪﻨﮐ "ﻝﺎﻌﻓﺮﯿﻏ" ﺍﺭ ﻪﻃﻮﺑﺮﻣ USB ﯼﺎﻫ ﺕﺭﻮﭘ ﺪﻧﺍﻮﺗ ﯽﻣ ﺮﺑﺭﺎﮐ ،usbguard ﺲﯾﻭﺮﺳ ﺯﺍ ﻩﺩﺎﻔﺘﺳ

ﺪﯿﻨﮐ ﺍﺪﯿﭘ ﺩﻮﺧ ﻩﺪﺷ ﺺﺨﺸﻣ USB ﺕﺭﻮﭘ ﯼﺍﺮﺑ ﺍﺭ sys ﻩﺎﮕﺘﺳﺩ ﻪﺷﻮﭘ :1 ﻪﻠﺣﺮﻣ

.ﺖﺳﺍ ﺎﻤﺷ USB ﺕﺭﻮﭘ ﯼﺍﺮﺑ ﮏﯾ ﻡﺍﺪﮐ ﺪﯿﻤﻬﻔﺑ ﺪﯾﺎﺑ ﺍﺪﺘﺑﺍ ،ﺖﺳﺍ ﻪﺷﻮﭘﺮﯾﺯ ﻦﯾﺪﻨﭼ ﯼﺍﺭﺍﺩ

1. ﻩﺎﮕﺘﺳﺩ ﮏﯾ ﺍﺪﺘﺑﺍ USB (ﺶﻠﻓ ﻮﯾﺍﺭﺩ ﺎﯾ ﺱﻭﺎﻣ ،ﺪﯿﻠﮐ ﻪﺤﻔﺻ) ﻩﺎﮔﺭﺩ ﻪﺑ ﺍﺭ USB ﺪ

2. ﻝﺎﻨﯿﻣﺮﺗ ﺲﭙﺳ (Ctrl+Alt+T) ﻩﺎﮕﺘﺳﺩ ﻪﻤﻫ ﻥﺩﺮﮐ ﺖﺳﺮﻬﻓ ﯼﺍﺮﺑ ﺍﺭ ﺭﻮﺘﺳﺩ ﻭ ﺪﯿﻨﮐ

lsusb

.ﺩﻮﺷ ﺖﺳﺮﻬﻓ ﺎﻬﻧﺁ ﻩﺪﺷﺖﯾﺮﯾﺪﻣ ﯼﺎﻫﻪﺳﺎﻨﺷ ﻦﯿﻨﭽﻤﻫ ﻭ ﯽﻋﺮﻓ ﯼﺎﻫﻪﺷﻮﭘ ﺎﺗ ﺪﯿﻨ

cd /sys/bus/usb/devices && for d in *; do if [ -f $d/idProduct ]; then prod=$( cat $d/idProduct ); vend=$( cat $d/idVendor ); echo Device: "${d}", ID: "${vend}:${prod}"; fi; done

.ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ (… ،usb1، usb2 ،2-1 ،1-1 ،ﻝﺎﺜﻣ ﻥﺍﻮﻨﻋ ﻪﺑ) ﻩﺎﮕﺘﺳﺩ ﯼﺎﻫﻪﺷﻮﭘ ﻡﺎﻧ

ﻢﯿﺳ ﯽﺑ ﺪﯿﻠﮐ ﻪﺤﻔﺻ ﻪﺑ ﻞﺼﺘﻣ USB ﺕﺭﻮﭘ ،ﺖﺳﺍ 3151:3020 ﯼﺍﺮﺑ "1-2" ﻪﺷﻮﭘ ﺮﯾﺯ ،ﻭ

USB ﻩﺎﮕﺘﺳﺩ ﺭﺎﮐﺩﻮﺧ ﻖﯿﻠﻌﺗ ﺖﻟﺎﺣ ﻪﺑ (ﯼﺭﺎﯿﺘﺧﺍ) :2 ﻪﻠﺣﺮﻣ

.ﻡﺩﺮﮐ ﺍﺪﯿﭘ ﺩﻮﺧ USB ﺕﺭﻮﭘ 2 ﯼﺍﺮﺑ ﺍﺭ (2-1 ﻭ 1-1) ﻪﻃﻮﺑﺮﻣ ﯼﺎﻫ ﻪﺷﻮﭘ ﺮﯾﺯ ،1 ﻪﻠﺣﺮﻣ ﻦﯾﺮ

.ﺩﻮﺑ ﺪﻫﺍﻮﺧ ﻖﻠﻌﻣ ﻪﺸﯿﻤﻫ ﻦﯾﺍﺮﺑﺎﻨﺑ ،ﺪﯿﻨﮐ ﻢﯿﻈﻨﺗ ﻪﯿﻧﺎﺛﯽﻠﯿﻣ 0 ﯼﻭﺭ ﺍﺭ ﺮﯿﺧﺄﺗ ﻭ ،

echo 0 | sudo tee /sys/bus/usb/devices/1-1/power/autosuspend_delay_ms
echo "auto" | sudo tee /sys/bus/usb/devices/1-1/power/control

.ﺕﺎﻤﯿﻈﻨﺗ ﻪﻤﻫ ﯽﻧﺎﺸﻧﺯﺎﺑ ﺎﺑ ﺎﻣﺍ ،ﺩﻮﺷ ﯽﻣ ﺩﺎﺠﯾﺍ ﺭﺎﮐﺩﻮﺧ ﺭﻮﻃ ﻪﺑ ﻩﺭﺎﺑﻭﺩ ﻪﺷﻮﭘ ﻥﺁ ،ﺪﯿﻨﮐ

.ﺪﯿﺷﺎﺑ ﻩﺪﺷ ﻪﻧﻭﺰﻓﺍ ﺮﻫ ﺭﺩ ﻻﺎﺑ ﺭﻮﺘﺳﺩ 2 ﺭﺎﮐﺩﻮﺧ ﯼﺍﺮﺟﺍ ﻪﺑ ﻖﻓﻮﻣ ﺎﻤﺷ ﻪﮑﻨﯾﺍ ﺮﮕﻣ .ﺪﺷﺎﺑ ﻞ

ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ USBGuard ﺯﺍ (ﺮﺘﻬﺑ ﺏﺎﺨﺘﻧﺍ) :2 ﻪﻠﺣﺮﻣ

.ﺪﻨﮐ ﯼﺯﺎﺳﻩﺩﺎﯿﭘ ﺍﺭ USB ﻩﺎﯿﺳ ﺖﺳﺮﻬﻓ ﻭ ﺪﯿﻔﺳ ﺖﺴﯿﻟ ﻪﯿﻟﻭﺍ ﯼﺎﻫﺖﯿﻠﺑﺎﻗ ﺎﺗ ﺪﻨﮐu

:ﺪﯿﻨﮐ ﺍﺮﺟﺍ ﻪﺘﺴﺑ ﺐﺼﻧ ﯼﺍﺮﺑ ﺍﺭ ﺭﻮﺘﺳﺩ ﻭ ﺪﯿﻨﮐ ﺯﺎﺑ ﺍﺭ ﻝﺎﻨﯿﻣﺮﺗ ﺍﺪﺘﺑﺍ .1

sudo apt install usbguard

:ﺪﯿﻨﮐ ﺍﺮﺟﺍ ﺲﯾﻭﺮﺳ ﻦﯾﺍ ﯼﺪﻨﺑﺮﮑﯿﭘ ﻞﯾﺎﻓ ﺶﯾﺍﺮﯾﻭ ﯼﺍﺮﺑ ﺍﺭ ﺭﻮﺘﺳﺩ ﺲﭙﺳ .2

sudo nano /etc/usbguard/rules.conf

ﻡﻮﻨﮔ ﯼﺍﺮﺑ، nano ﺎﺑ ﺍﺭ gedit (22.04 ﻥﺁ ﺯﺍ ﻞﺒﻗ ﻭ)،

.ﺪﯿﻨﮐ ﺶﯾﺍﺮﯾﻭ ﻩﺭﺎﺑﻭﺩ ﺍﺭ ﻥﺁ ﺲﭙﺳ ،ﺪﻨﮐ ﺩﺎﺠﯾﺍ ﺭﺎﮐﺩﻮﺧ ﺭﻮﻃ ﻪﺑ ﺍﺭ ﻦﯿﻧﺍﻮﻗ ﺪﯿﻫﺩ ﻩﺯﺎﺟﺍ ﻥﺁ

!ﺪﯿﻨﮐ ﯽﺑﺎﯾﺯﺎﺑ ﺍﺭ ﺕﺍﺮﯿﯿﻐﺗ ﺪﯿﻧﺍﻮﺗ ﯽﻣ ﯽﺘﺣﺍﺭ ﻪﺑ ﺎﻤﺷ ،ﻦﯾﺍﺮﺑﺎﻨﺑ .ﺪﯿﻨﮐ ﻪﯿﻬﺗ ﺽﺮﻓ ﺶﯿﭘ ﯼ

.ﺪﯿﻨﮐ ﻝﺎﻌﻓﺮﯿﻏ ﺍﺭ USB ﺕﺭﻮﭘ ﻥﺁ ('1- ﺱﺎﺳﺍ ﻦﯾﺍ ﺮﺑ 1' ﺮﯿﯿﻐﺗ) ﺪﯿﻨﮐ ﻪﻓﺎﺿﺍ "1-1" ﺕ

.ﺪﯿﻨﮐ ﯼﺯﺍﺪﻧﺍ ﻩﺍﺭ ﺍﺩﺪﺠﻣ ﺍﺭ ﺲﯾﻭﺮﺳ ﺖﯾﺎﻬﻧ ﺭﺩ .4

systemctl restart usbguard.service

.ﺪﺷ ﺪﻫﺍﻮﺧ ﻝﺎﻤﻋﺍ ﺪﻌﺑ ﻪﻈﺤﻟ ﺪﻨﭼ ﺮﯿﯿﻐﺗ ﻭ

:ﺪﯿﻨﮐ ﺐﺼﻧ ﻑﺬﺣ ﺍﺭ usbguard ﺲﭙﺳ ،ﺪﯿﻨﮐ ﻩﺩﺎﻔﺘﺳﺍ ﺎﻫ ﺲﯾﻭﺮﺳ ﻒﻗﻮﺗ ﯼﺍﺮﺑ ﺕﺍﺭﻮﺘﺳﺩ ﺯﺍ ،ﺮﯿﯿ

sudo systemctl disable --now usbguard.service
sudo systemctl stop usbguard-dbus.service
sudo systemctl mask usbguard-dbus.service
sudo apt remove --purge usbguard

:ﺪﯿﻨﮐ ﻑﺬﺣ etc/ ﻪﺷﻮﭘ ﺭﺩ ﺍﺭ ﯼﺪﻨﺑﺮﮑﯿﭘ ﯼﺎﻫ ﻞﯾﺎﻓ ،ﺖﯾﺎﻬﻧ ﺭﺩ

sudo rm -rf /etc/usbguard/