{"id":534745,"date":"2025-09-30T17:54:18","date_gmt":"2025-09-30T17:54:18","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=534745"},"modified":"2025-09-30T17:54:18","modified_gmt":"2025-09-30T17:54:18","slug":"desactiver-les-peripheriques-de-stockage-usb-sur-linux","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/fr\/script-hub\/desactiver-les-peripheriques-de-stockage-usb-sur-linux\/","title":{"rendered":"Comment activer ou d\u00e9sactiver les p\u00e9riph\u00e9riques de stockage USB sur Linux avec un script Shell"},"content":{"rendered":"<p>Le contr\u00f4le de l&rsquo;acc\u00e8s aux p\u00e9riph\u00e9riques de stockage USB est une pratique fondamentale pour maintenir l&rsquo;int\u00e9grit\u00e9 des donn\u00e9es et emp\u00eacher l&rsquo;exfiltration de donn\u00e9es non autoris\u00e9es dans les environnements d&rsquo;entreprise. Face \u00e0 la persistance des menaces li\u00e9es aux supports amovibles (des fuites de donn\u00e9es internes aux cl\u00e9s USB charg\u00e9es de logiciels malveillants) les administrateurs informatiques et les <a href=\"https:\/\/www.ninjaone.com\/fr\/quest-ce-quun-msp\/\">fournisseurs de services g\u00e9r\u00e9s (MSP)<\/a> doivent appliquer des politiques strictes en mati\u00e8re d&rsquo;utilisation des cl\u00e9s USB. Une m\u00e9thode efficace et \u00e9volutive consiste \u00e0 contr\u00f4ler les scripts au niveau du module du noyau (kernel). Cet article plonge dans un script shell performant con\u00e7u pour\u00a0<strong>activer, d\u00e9sactiver ou configurer les p\u00e9riph\u00e9riques de stockage USB sur Linux avec un script shell<\/strong>.<\/p>\n<h2>Contexte<\/h2>\n<p>Sur les syst\u00e8mes <a href=\"https:\/\/www.ninjaone.com\/blog\/linux-filesystems\/\">Linux<\/a>, l&rsquo;acc\u00e8s au stockage USB est r\u00e9gi par des modules du noyau, notamment usb-storage et uas (USB Attached SCSI). Ces modules peuvent \u00eatre charg\u00e9s automatiquement lorsque les appareils sont connect\u00e9s (chargement implicite) ou invoqu\u00e9s manuellement (chargement explicite). En bloquant ou en autorisant ces modules au niveau du syst\u00e8me, les professionnels de l&rsquo;informatique peuvent contr\u00f4ler efficacement le comportement des p\u00e9riph\u00e9riques de stockage USB dans les parcs de terminaux Linux.<\/p>\n<p>Le script en question est con\u00e7u pour <a href=\"https:\/\/www.ninjaone.com\/fr\/blog\/tout-ce-que-vous-devez-savoir-sur-lautomatisation\/\">l&rsquo;automatisation<\/a>, l&rsquo;application de strat\u00e9gies et la compatibilit\u00e9 avec des plateformes RMM telles que\u00a0<strong>NinjaOne<\/strong>. Il cr\u00e9e et g\u00e8re les fichiers de configuration dans \/etc\/modprobe.d\/, met \u00e0 jour le syst\u00e8me de fichiers RAM initial (initramfs) et peut \u00e9ventuellement d\u00e9clencher un red\u00e9marrage du syst\u00e8me, ce qui en fait une solution compl\u00e8te pour la gouvernance des p\u00e9riph\u00e9riques USB.<\/p>\n<h2>Le script\u00a0:<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">#!\/usr\/bin\/env bash\r\n\r\n# Description: Enable or disable USB storage devices on Linux.\r\n# By using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https:\/\/www.ninjaone.com\/terms-of-use.\r\n# Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. \r\n# Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. \r\n# Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. \r\n# Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. \r\n# Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. \r\n# Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. \r\n# EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n#\r\n#   There are two methods of loading USB storage drivers that allow mounting of USB storage devices:\r\n#       1. Implicit loading: The USB storage driver is loaded automatically when a USB storage device is connected.\r\n#       2. Explicit loading: The USB storage driver is loaded manually by a user, program, or script.\r\n#\r\n# Release Notes: Initial Release\r\n#\r\n# Notes: This will create config files in \/etc\/modprobe.d\/ as needed to block USB storage devices.\r\n#\r\n# Usage: [-Enable | -Disable] [-Reboot]\r\n#\r\n# Preset Parameter: --help\r\n#   Displays the help menu.\r\n#\r\n# Preset Parameter: -Enable\r\n#   Enables USB storage devices.\r\n#\r\n# Preset Parameter: -Disable\r\n#   Disables USB storage devices.\r\n#\r\n# Preset Parameter: -Reboot\r\n#   Reboots the system, if needed, after enabling or disabling USB storage devices.\r\n\r\n# Functions\r\n# Print an error message and exit with a specific status code\r\ndie() {\r\n    local _ret=\"${2:-1}\"\r\n    test \"${_PRINT_HELP:-no}\" = yes &amp;&amp; print_help &gt;&amp;2\r\n    echo \"$1\" &gt;&amp;2\r\n    exit \"${_ret}\"\r\n}\r\n\r\nprint_help() {\r\n    printf '\\n\\n%s\\n\\n' 'Usage: [-Enable | -Disable]'\r\n    printf '  %s\\n' '-Enable'\r\n    printf '    Enables USB storage devices'\r\n    printf '  %s\\n' '-Disable'\r\n    printf '    Disables USB storage devices'\r\n}\r\n\r\n# Set the default values\r\n_arg_reboot=\"false\"\r\n\r\n# Parse the command-line arguments\r\nparse_commandline() {\r\n    while test $# -gt 0; do\r\n        _key=\"$1\"\r\n        case \"$_key\" in\r\n        -Enable | --Enable | -enable | --enable | -e | --e)\r\n            _arg_action=\"Enable\"\r\n            ;;\r\n        -Disable | --Disable | -disable | --disable | -d | --d)\r\n            _arg_action=\"Disable\"\r\n            ;;\r\n        --Reboot | --reboot | -Reboot | -reboot | -r | --r)\r\n            _arg_reboot=\"true\"\r\n            ;;\r\n        --help | -help | -h | --h)\r\n            _PRINT_HELP=yes die \"\" 0\r\n            ;;\r\n        *)\r\n            _PRINT_HELP=yes die \"[Error] Got an unexpected argument '$1'\" 1\r\n            ;;\r\n        esac\r\n        shift\r\n    done\r\n}\r\n\r\nparse_commandline \"$@\"\r\n\r\n# Exit if not running as root\r\nif [[ $EUID -ne 0 ]]; then\r\n    die \"[Error] This script must be run as root or SYSTEM from NinjaRMM\" 1\r\nfi\r\n\r\n# If script form variables are used, replace the command line parameters with their value.\r\nif [[ -n \"${action}\" ]] &amp;&amp; [[ \"${action}\" == \"Enable\" ]]; then\r\n    _arg_action=\"Enable\"\r\nelif [[ -n \"${action}\" ]] &amp;&amp; [[ \"${action}\" == \"Disable\" ]]; then\r\n    _arg_action=\"Disable\"\r\nfi\r\n\r\nif [[ \"${reboot}\" == \"true\" ]]; then\r\n    _arg_reboot=\"true\"\r\nfi\r\n\r\n# Check if action is empty\r\nif [[ -z \"${_arg_action}\" ]]; then\r\n    die \"Invalid action. Use Enable or Disable\" 1\r\nfi\r\n\r\n# Variables\r\n# Modprobe.d folder\r\nmodprobFolder=\"\/etc\/modprobe.d\"\r\n# Config file\r\nconfigFile=\"${modprobFolder}\/ninja-usb-block.conf\"\r\n\r\n# Check if modprobe.d folder does not exists\r\nif ! [ -d \"${modprobFolder}\" ]; then\r\n    die \"[Error] Modprobe folder does not exist\" 1\r\nfi\r\n\r\n# Check if usb-storage and uas kenel drivers are modules\r\nif ! modprobe -n uas &gt;\/dev\/null 2&gt;&amp;1; then\r\n    die \"[Error] USB Attached SCSI driver(uas) must be compiled as a kernel module\" 1\r\nfi\r\nif ! modprobe -n usb-storage &gt;\/dev\/null 2&gt;&amp;1; then\r\n    die \"[Error] USB storage(usb-storage) driver must be compiled as a kernel module\" 1\r\nfi\r\n\r\nif [[ \"${_arg_action}\" == \"Enable\" ]]; then\r\n    # Enable USB storage\r\n\r\n    # Check if our file exists\r\n    if [ -f \"${configFile}\" ]; then\r\n        echo \"[Info] Enabling USB storage devices\"\r\n        # Remove our config file\r\n        rm \"${configFile}\"\r\n        echo \"[Info] Enabled USB storage devices\"\r\n    else\r\n        echo \"[Info] USB storage devices are already enabled\"\r\n    fi\r\n\r\n    # Remove other blocks USB storage in other files\r\n    for file in \"${modprobFolder}\"\/*; do\r\n        # Remove implicit USB Storage block\r\n        if grep -q \"blacklist usb_storage\" \"${file}\"; then\r\n            echo \"[Info] Removing implicit USB Storage block in ${file}\"\r\n            sed -i '\/blacklist usb_storage\/d' \"${file}\"\r\n            echo \"[Info] Removed implicit USB Storage block in ${file}\"\r\n        fi\r\n        # Remove implicit USB Attached SCSI block\r\n        if grep -q \"blacklist uas\" \"${file}\"; then\r\n            echo \"[Info] Removing implicit USB Attached SCSI block in ${file}\"\r\n            sed -i '\/blacklist uas\/d' \"${file}\"\r\n            echo \"[Info] Removed implicit USB Attached SCSI block in ${file}\"\r\n        fi\r\n        # Remove explicit USB Storage driver block\r\n        if grep -q \"install usb-storage \/bin\/true\" \"${file}\"; then\r\n            echo \"[Info] Removing explicit USB Storage block in ${file}\"\r\n            sed -i '\/install usb-storage \\\/bin\\\/true\/d' \"${file}\"\r\n            echo \"[Info] Removed explicit USB Storage block in ${file}\"\r\n        fi\r\n        # Remove explicit USB Attached SCSI driver block\r\n        if grep -q \"install uas \/bin\/true\" \"${file}\"; then\r\n            echo \"[Info] Removing explicit USB Attached SCSI block in ${file}\"\r\n            sed -i '\/install uas \\\/bin\\\/true\/d' \"${file}\"\r\n            echo \"[Info] Removed explicit USB Attached SCSI block in ${file}\"\r\n        fi\r\n    done\r\n\r\n    # Check that update-initramfs command exists\r\n    if command -v update-initramfs &gt;\/dev\/null 2&gt;&amp;1; then\r\n        # Update the initramfs\r\n        echo \"[Info] Updating initramfs\"\r\n        update-initramfs -u &gt;\/dev\/null 2&gt;&amp;1\r\n        echo \"[Info] Updated initramfs\"\r\n    fi\r\n\r\n    if [[ \"${_arg_reboot}\" == \"true\" ]]; then\r\n        echo \"[Info] Rebooting the system to enable USB storage devices\"\r\n        # Shutdown in 1 minute\r\n        shutdown -r +1\r\n    else\r\n        echo \"[Info] USB storage devices are enabled, please reboot the system\"\r\n    fi\r\n\r\nelif [[ \"${_arg_action}\" == \"Disable\" ]]; then\r\n    # Disable USB storage\r\n\r\n    # Variables to determine if we should block the drivers\r\n    blacklist_uas=\"false\"\r\n    blacklist_usb_storage=\"false\"\r\n    block_uas=\"false\"\r\n    block_usb_storage=\"false\"\r\n\r\n    # Check if usb_storage or uas is blocked in other files\r\n    for file in \"${modprobFolder}\"\/*; do\r\n\r\n        # Check if implicit loading is already blocked\r\n        if grep -q \"blacklist uas\" \"${file}\"; then\r\n            echo \"[Info] USB Attached SCSI drivers are already implicitly blocked in ${file}\"\r\n        else\r\n            blacklist_uas=\"true\"\r\n        fi\r\n\r\n        # Check if implicit loading is already blocked\r\n        if grep -q \"blacklist usb_storage\" \"${file}\"; then\r\n            echo \"[Info] USB storage drivers are already implicitly blocked in ${file}\"\r\n        else\r\n            blacklist_usb_storage=\"true\"\r\n        fi\r\n\r\n        # Check if explicit loading is already blocked\r\n        if grep -q \"install uas \/bin\/true\" \"${file}\"; then\r\n            echo \"[Info] USB Attached SCSI drivers are already explicitly blocked in ${file}\"\r\n        else\r\n            block_uas=\"true\"\r\n        fi\r\n\r\n        # Check if explicit loading is already blocked\r\n        if grep -q \"install uas \/bin\/true\" \"${file}\"; then\r\n            echo \"[Info] USB storage drivers are already explicitly blocked in ${file}\"\r\n        else\r\n            block_usb_storage=\"true\"\r\n        fi\r\n    done\r\n\r\n    if [ \"${blacklist_uas}\" == \"true\" ]; then\r\n        echo \"[Info] Implicitly Disabling USB Attached SCSI driver\"\r\n\r\n        # Check if config file exists\r\n        if ! [ -f \"${configFile}\" ]; then\r\n            echo \"[Info] Creating blocklist config file (${configFile})\"\r\n            touch \"${configFile}\"\r\n        fi\r\n\r\n        # Write the line to the file\r\n        echo \"blacklist uas\" &gt;&gt;\"${configFile}\"\r\n    fi\r\n\r\n    if [ \"${blacklist_usb_storage}\" == \"true\" ]; then\r\n        echo \"[Info] Implicitly Disabling USB storage driver\"\r\n\r\n        # Check if config file exists\r\n        if ! [ -f \"${configFile}\" ]; then\r\n            echo \"[Info] Creating blocklist config file (${configFile})\"\r\n            touch \"${configFile}\"\r\n        fi\r\n\r\n        # Write the line to the file\r\n        echo \"blacklist usb_storage\" &gt;&gt;\"${configFile}\"\r\n    fi\r\n\r\n    if [ \"${block_uas}\" == \"true\" ]; then\r\n        echo \"[Info] Explicitly Disabling USB Attached SCSI driver\"\r\n\r\n        # Check if uas config file exists\r\n        if ! [ -f \"${modprobFolder}\" ]; then\r\n            echo \"[Info] Creating UAS config file (${modprobFolder}\/uas.conf)\"\r\n            touch \"${modprobFolder}\/uas.conf\"\r\n        fi\r\n\r\n        # Write the line to the file\r\n        echo \"install uas \/bin\/true\" &gt;&gt;\"${modprobFolder}\/uas.conf\"\r\n    fi\r\n\r\n    if [ \"${block_usb_storage}\" == \"true\" ]; then\r\n        echo \"[Info] Explicitly Disabling USB storage driver\"\r\n\r\n        # Check if usb-storage config file exists\r\n        if ! [ -f \"${modprobFolder}\" ]; then\r\n            echo \"[Info] Creating USB storage config file (${modprobFolder}\/usb-storage.conf)\"\r\n            touch \"${modprobFolder}\/usb-storage.conf\"\r\n        fi\r\n\r\n        # Write the line to the file\r\n        echo \"install usb-storage \/bin\/true\" &gt;&gt;\"${modprobFolder}\/usb-storage.conf\"\r\n    fi\r\n\r\n    # Unload the modules\r\n    echo \"[Info] Unloading USB storage modules\"\r\n    modprobe -r uas &gt;\/dev\/null 2&gt;&amp;1\r\n    modprobe -r usb_storage &gt;\/dev\/null 2&gt;&amp;1\r\n    rmmod uas &gt;\/dev\/null 2&gt;&amp;1\r\n    rmmod usb_storage &gt;\/dev\/null 2&gt;&amp;1\r\n\r\n    # Check if the modules are still loaded\r\n    modules_unloaded=\"true\"\r\n    if lsmod | grep -q uas; then\r\n        modules_unloaded=\"false\"\r\n    fi\r\n    if lsmod | grep -q usb_storage; then\r\n        modules_unloaded=\"false\"\r\n    fi\r\n\r\n    # Check that update-initramfs command exists\r\n    if command -v update-initramfs &gt;\/dev\/null 2&gt;&amp;1; then\r\n        # Update the initramfs\r\n        echo \"[Info] Updating initramfs\"\r\n        update-initramfs -u &gt;\/dev\/null 2&gt;&amp;1\r\n        echo \"[Info] Updated initramfs\"\r\n\r\n        # Set to false so we can reboot or warn that a reboot is needed\r\n        modules_unloaded=\"false\"\r\n        if [[ \"${_arg_reboot}\" == \"false\" ]]; then\r\n            echo \"[Warn] USB storage devices can still be mounted, please reboot the system\"\r\n        fi\r\n    fi\r\n\r\n    if [ \"${modules_unloaded}\" == \"true\" ]; then\r\n        echo \"[Info] Unloaded USB storage modules\"\r\n    else\r\n        if [[ \"${_arg_reboot}\" == \"true\" ]]; then\r\n            echo \"[Info] USB storage devices are still mounted, rebooting the system\"\r\n            # Shutdown in 1 minute\r\n            shutdown -r +1\r\n        else\r\n            echo \"[Warn] USB storage devices are still mounted, please unmount them and rerun this script OR reboot the system\"\r\n        fi\r\n    fi\r\n\r\nelse\r\n    die \"[Error] Invalid parameter. Use -Enable or -Disable\" 1\r\nfi<\/pre>\n<p>&nbsp;<\/p>\n\n<h2>Description d\u00e9taill\u00e9e<\/h2>\n<p>Voici comment fonctionne le script, \u00e9tape par \u00e9tape :<\/p>\n<h3>1. Analyse de la ligne de commande<\/h3>\n<p>Le script accepte les drapeaux suivants :<\/p>\n<ul>\n<li>-Enable : Permet le stockage USB en supprimant les restrictions li\u00e9es au module du noyau.<\/li>\n<li>-Disable : Emp\u00eache le stockage USB en appliquant des listes noires de modules du noyau et des blocs de chargement explicites.<\/li>\n<li>-Reboot : Indicateur facultatif permettant de red\u00e9marrer la machine apr\u00e8s la modification.<\/li>\n<li>&#8211;help : Affiche les instructions d&rsquo;utilisation.<\/li>\n<\/ul>\n<h3>2. Contr\u00f4le des privil\u00e8ges<\/h3>\n<p>Le script v\u00e9rifie qu&rsquo;il est ex\u00e9cut\u00e9 avec les privil\u00e8ges de l&rsquo;utilisateur root, ce qui est essentiel pour les modifications au niveau du noyau.<\/p>\n<h3>3. D\u00e9tection des modules<\/h3>\n<p>Il confirme que usb-storage et uas sont compil\u00e9s en tant que modules du noyau, une condition pr\u00e9alable pour que les changements soient effectifs.<\/p>\n<h3>4. Activation du stockage USB<\/h3>\n<p>Lorsque l&rsquo;option -Enable est invoqu\u00e9e :<\/p>\n<ul>\n<li>Le script supprime son propre fichier de configuration (ninja-usb-block.conf).<\/li>\n<li>Il analyse les autres fichiers .conf dans \/etc\/modprobe.d\/ et supprime toute liste noire ou directive explicite de blocage de charge.<\/li>\n<li>Il r\u00e9g\u00e9n\u00e8re les initramfs pour refl\u00e9ter les changements.<\/li>\n<li>En option, il planifie un red\u00e9marrage.<\/li>\n<\/ul>\n<h3>5. D\u00e9sactivation du stockage USB<\/h3>\n<p>Lorsque l&rsquo;option -Disable est utilis\u00e9e :<\/p>\n<ul>\n<li>Le script \u00e9crit les directives blacklist (blacklist usb_storage, blacklist uas) et install block (install usb-storage \/bin\/true) dans des fichiers .conf d\u00e9di\u00e9s.<\/li>\n<li>Il d\u00e9charge de force les modules du noyau en utilisant modprobe -r et rmmod.<\/li>\n<li>Il valide la suppression d&rsquo;un module via lsmod.<\/li>\n<li>Il met \u00e0 jour initramfs et, si n\u00e9cessaire, red\u00e9marre le syst\u00e8me.<\/li>\n<\/ul>\n<h2>Cas d&rsquo;utilisation potentiels<\/h2>\n<h3>\u00c9tude de cas\u00a0: S\u00e9curiser les ordinateurs portables des d\u00e9veloppeurs<\/h3>\n<p>Un MSP g\u00e9rant des postes de travail de d\u00e9veloppeurs Linux souhaite emp\u00eacher l&rsquo;exfiltration de code ou de donn\u00e9es propri\u00e9taires par le biais de cl\u00e9s USB. Avec NinjaOne, l&rsquo;administrateur d\u00e9ploie ce script shell avec les options -Disable -Reboot. Tous les syst\u00e8mes vis\u00e9s deviennent limit\u00e9s \u00e0 la m\u00e9moire USB au prochain d\u00e9marrage. Lors d&rsquo;un gel de code, l&rsquo;acc\u00e8s USB est temporairement r\u00e9activ\u00e9 par une t\u00e2che programm\u00e9e avec -Enable.<\/p>\n<p>Cette m\u00e9thode garantit un contr\u00f4le rigoureux avec possibilit\u00e9 d&rsquo;audit et de retour en arri\u00e8re.<\/p>\n<h2>Comparaisons<\/h2>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><strong>M\u00e9thode<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>Avantages<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>Inconv\u00e9nients<\/strong><\/td>\n<\/tr>\n<tr>\n<td>r\u00e8gles udev<\/td>\n<td>Contr\u00f4le pr\u00e9cis des appareils<\/td>\n<td>N\u00e9cessite des identifiants d&rsquo;appareils, complexes<\/td>\n<\/tr>\n<tr>\n<td>Strat\u00e9gie de groupe (sous Windows)<\/td>\n<td>Application par les autochtones<\/td>\n<td>Non applicable \u00e0 Linux<\/td>\n<\/tr>\n<tr>\n<td><strong>Shell Script (Ceci)<\/strong><\/td>\n<td>Rapide, scriptable, bien int\u00e9gr\u00e9<\/td>\n<td>N\u00e9cessite la prise en charge du module du noyau<\/td>\n<\/tr>\n<tr>\n<td>SELinux\/AppArmor<\/td>\n<td>Tr\u00e8s s\u00fbr<\/td>\n<td>Complexe \u00e0 configurer correctement<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Par rapport aux autres solutions, ce script shell offre un m\u00e9lange \u00e9quilibr\u00e9 de\u00a0<strong>simplicit\u00e9, de portabilit\u00e9 et d&rsquo;application \u00e0 l&rsquo;\u00e9chelle du syst\u00e8me<\/strong>\u00a0sans qu&rsquo;il soit n\u00e9cessaire de g\u00e9rer des identifiants d&rsquo;appareils ou des logiciels tiers.<\/p>\n<h2>Questions fr\u00e9quentes<\/h2>\n<h3>Question 1\u00a0: Que se passe-t-il si mon syst\u00e8me n&rsquo;utilise pas\u00a0initramfs ?<\/h3>\n<p>Le script saute silencieusement les mises \u00e0 jour des initramfs. Toutefois, les modifications peuvent ne pas s&rsquo;appliquer avant le prochain red\u00e9marrage.<\/p>\n<h3>Question 2\u00a0: Ce script peut-il \u00eatre d\u00e9ploy\u00e9 via NinjaOne ?<\/h3>\n<p>Oui. Il est enti\u00e8rement compatible avec l&rsquo;automatisation des scripts Linux de NinjaOne, y compris la prise en charge du passage de param\u00e8tres tels que action=Disable et reboot=true.<\/p>\n<h3>Question 3\u00a0: Que se passe-t-il si un utilisateur charge manuellement le module apr\u00e8s l&rsquo;avoir d\u00e9sactiv\u00e9 ?<\/h3>\n<p>La directive install \/bin\/true emp\u00eache m\u00eame le chargement manuel des modules, \u00e0 moins qu&rsquo;elle ne soit explicitement supprim\u00e9e.<\/p>\n<h3>Question 4\u00a0: Est-ce r\u00e9versible\u00a0?<\/h3>\n<p>Absolument. L&rsquo;ex\u00e9cution du script avec -Enable annule toute la configuration et r\u00e9tablit la fonctionnalit\u00e9 USB.<\/p>\n<h2>Implications<\/h2>\n<p>L&rsquo;utilisation de ce script permet de renforcer la s\u00e9curit\u00e9 des points d&rsquo;acc\u00e8s et d&rsquo;assurer la conformit\u00e9 des politiques sur les machines Linux. Il att\u00e9nue les risques de :<\/p>\n<ul>\n<li>Menaces d&rsquo;initi\u00e9s transf\u00e9rant des donn\u00e9es sensibles<\/li>\n<li>Infection par des logiciels malveillants \u00e0 partir de cl\u00e9s USB frauduleuses<\/li>\n<li>Contournement des syst\u00e8mes DLP via des lecteurs amovibles<\/li>\n<\/ul>\n<p>Pour les secteurs r\u00e9glement\u00e9s tels que la finance, la sant\u00e9 ou l&rsquo;administration, ce script offre un contr\u00f4le de conformit\u00e9 efficace.<\/p>\n<h2>Recommandations<\/h2>\n<ul>\n<li><strong>Testez avant de proc\u00e9der \u00e0 un d\u00e9ploiement massif, en particulier<\/strong>sur les syst\u00e8mes dot\u00e9s de modules de noyau personnalis\u00e9s.<\/li>\n<li><strong>Automatiser les proc\u00e9dures de retour en arri\u00e8re en stockant<\/strong>une sauvegarde des fichiers .conf modifi\u00e9s.<\/li>\n<li><strong>Int\u00e9gration avec les alertes RMM : suivi des<\/strong>syst\u00e8mes o\u00f9 le stockage USB est r\u00e9activ\u00e9.<\/li>\n<li><strong>Planifiez soigneusement les red\u00e9marrages<\/strong>\u00a0pour \u00e9viter de perturber les utilisateurs.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>Que vous cherchiez \u00e0\u00a0<strong>d\u00e9sactiver les p\u00e9riph\u00e9riques de stockage USB sous Linux \u00e0 l&rsquo;aide d&rsquo;un script shell<\/strong>, \u00e0\u00a0<strong>activer les p\u00e9riph\u00e9riques de stockage USB sous Linux \u00e0 l&rsquo;aide d&rsquo;un script shell<\/strong>, ou \u00e0\u00a0<strong>configurer les politiques d&rsquo;acc\u00e8s au stockage USB sur Linux<\/strong>, ce script offre une approche fiable et facile \u00e0 maintenir. Gr\u00e2ce au cadre de script et d&rsquo;automatisation de NinjaOne, les MSP et les professionnels de l&rsquo;informatique peuvent op\u00e9rationnaliser la gouvernance USB \u00e0 l&rsquo;\u00e9chelle &#8211; en renfor\u00e7ant les politiques de s\u00e9curit\u00e9 tout en conservant le contr\u00f4le administratif.<\/p>\n<p>Pour g\u00e9rer les points d&rsquo;extr\u00e9mit\u00e9 Linux de mani\u00e8re efficace et s\u00e9curis\u00e9e, les outils centralis\u00e9s de script, d&rsquo;automatisation et de reporting de <a href=\"https:\/\/www.ninjaone.com\/fr\/\">NinjaOne<\/a> compl\u00e8tent la puissance de ce script, aidant les \u00e9quipes \u00e0 faire \u00e9voluer l&rsquo;application sans augmenter la charge de travail.<\/p>\n","protected":false},"author":35,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4211],"use_cases":[4281],"class_list":["post-534745","script_hub","type-script_hub","status-publish","hentry","script_hub_category-linux"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/script_hub\/534745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/comments?post=534745"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/media?parent=534745"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/operating_system?post=534745"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/use_cases?post=534745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}