How to disable automount of an harddrive?












2















I am working on a project, and for this I need to disable the aumounting of hard-drives in Ubuntu both at startup and when I plug an hard-drive.



I tried one solution with "edit-conf" disabling automount at org.gnome.desktop.media-handling but when I plug a hardrive ubuntu still mounts it an open a window even when I restart the computer in between.



There is also the fstab solution but the thing is I don't know in advance the UUID of the drive I don't want to mount automatically.



From want I understand there is the solution of editing an udev rule, but i'm not a specialist of that.










share|improve this question





























    2















    I am working on a project, and for this I need to disable the aumounting of hard-drives in Ubuntu both at startup and when I plug an hard-drive.



    I tried one solution with "edit-conf" disabling automount at org.gnome.desktop.media-handling but when I plug a hardrive ubuntu still mounts it an open a window even when I restart the computer in between.



    There is also the fstab solution but the thing is I don't know in advance the UUID of the drive I don't want to mount automatically.



    From want I understand there is the solution of editing an udev rule, but i'm not a specialist of that.










    share|improve this question



























      2












      2








      2








      I am working on a project, and for this I need to disable the aumounting of hard-drives in Ubuntu both at startup and when I plug an hard-drive.



      I tried one solution with "edit-conf" disabling automount at org.gnome.desktop.media-handling but when I plug a hardrive ubuntu still mounts it an open a window even when I restart the computer in between.



      There is also the fstab solution but the thing is I don't know in advance the UUID of the drive I don't want to mount automatically.



      From want I understand there is the solution of editing an udev rule, but i'm not a specialist of that.










      share|improve this question
















      I am working on a project, and for this I need to disable the aumounting of hard-drives in Ubuntu both at startup and when I plug an hard-drive.



      I tried one solution with "edit-conf" disabling automount at org.gnome.desktop.media-handling but when I plug a hardrive ubuntu still mounts it an open a window even when I restart the computer in between.



      There is also the fstab solution but the thing is I don't know in advance the UUID of the drive I don't want to mount automatically.



      From want I understand there is the solution of editing an udev rule, but i'm not a specialist of that.







      hard-drive automount udev






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 15 '14 at 8:47









      A J

      5,889153357




      5,889153357










      asked Jul 15 '14 at 8:02









      Didier ChavarocheDidier Chavaroche

      184




      184






















          3 Answers
          3






          active

          oldest

          votes


















          3














          Run these two commands:
          gsettings set org.gnome.desktop.media-handling automount 'false'
          gsettings set org.gnome.desktop.media-handling automount-open 'false'



          Or you can try it with a udev rule:
          sudo nano /etc/udev/rules.d/85-no-automount.rule

          Paste this line SUBSYSTEM=="usb", ENV{UDISKS_AUTO}="0" and save the file.

          Reboot the system.






          share|improve this answer


























          • It didn't work, I executed the two command then reboote, and when i plugged my hard-drive, ubuntu stills mount it.

            – Didier Chavaroche
            Jul 16 '14 at 9:33











          • You can try the udev rule I added above.

            – Pabi
            Jul 16 '14 at 9:37











          • I didn't try the rule, but I have a question before, I plug the hard drives directly onto the SATA ports of my computer, How should I translate the rule? SUBSYSTEM=="sata"?

            – Didier Chavaroche
            Jul 25 '14 at 9:35



















          1














          You can try to add the module to the blacklist:



          sudo gedit /etc/modprobe.d/blacklist.conf



          add:




          blacklist usb-storage




          or



          echo "blacklist usb-storage" | sudo tee -a /etc/modprobe.d/blacklist.conf



          Enabling it later should just be:



          sudo modprobe usb-storage






          share|improve this answer































            0














            As Pabi wrote in his answer, run this command:



            gsettings set org.gnome.desktop.media-handling automount 'false'


            BUT: this will probably not be effective until the next reboot.



            Lack of a reboot caused me to doubt the effectiveness of gsettings initially. I found it when being very thorough in preparation for filing a bug, which I found I didn't need to do. I've only tried this under sudo, however, so if you still have trouble, try doing it that way. I want this effective system-wide and found this does the job.



            You do not need to touch automount-open because it only applies when an automount happens, and you will have disabled that.






            share|improve this answer























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f497958%2fhow-to-disable-automount-of-an-harddrive%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              Run these two commands:
              gsettings set org.gnome.desktop.media-handling automount 'false'
              gsettings set org.gnome.desktop.media-handling automount-open 'false'



              Or you can try it with a udev rule:
              sudo nano /etc/udev/rules.d/85-no-automount.rule

              Paste this line SUBSYSTEM=="usb", ENV{UDISKS_AUTO}="0" and save the file.

              Reboot the system.






              share|improve this answer


























              • It didn't work, I executed the two command then reboote, and when i plugged my hard-drive, ubuntu stills mount it.

                – Didier Chavaroche
                Jul 16 '14 at 9:33











              • You can try the udev rule I added above.

                – Pabi
                Jul 16 '14 at 9:37











              • I didn't try the rule, but I have a question before, I plug the hard drives directly onto the SATA ports of my computer, How should I translate the rule? SUBSYSTEM=="sata"?

                – Didier Chavaroche
                Jul 25 '14 at 9:35
















              3














              Run these two commands:
              gsettings set org.gnome.desktop.media-handling automount 'false'
              gsettings set org.gnome.desktop.media-handling automount-open 'false'



              Or you can try it with a udev rule:
              sudo nano /etc/udev/rules.d/85-no-automount.rule

              Paste this line SUBSYSTEM=="usb", ENV{UDISKS_AUTO}="0" and save the file.

              Reboot the system.






              share|improve this answer


























              • It didn't work, I executed the two command then reboote, and when i plugged my hard-drive, ubuntu stills mount it.

                – Didier Chavaroche
                Jul 16 '14 at 9:33











              • You can try the udev rule I added above.

                – Pabi
                Jul 16 '14 at 9:37











              • I didn't try the rule, but I have a question before, I plug the hard drives directly onto the SATA ports of my computer, How should I translate the rule? SUBSYSTEM=="sata"?

                – Didier Chavaroche
                Jul 25 '14 at 9:35














              3












              3








              3







              Run these two commands:
              gsettings set org.gnome.desktop.media-handling automount 'false'
              gsettings set org.gnome.desktop.media-handling automount-open 'false'



              Or you can try it with a udev rule:
              sudo nano /etc/udev/rules.d/85-no-automount.rule

              Paste this line SUBSYSTEM=="usb", ENV{UDISKS_AUTO}="0" and save the file.

              Reboot the system.






              share|improve this answer















              Run these two commands:
              gsettings set org.gnome.desktop.media-handling automount 'false'
              gsettings set org.gnome.desktop.media-handling automount-open 'false'



              Or you can try it with a udev rule:
              sudo nano /etc/udev/rules.d/85-no-automount.rule

              Paste this line SUBSYSTEM=="usb", ENV{UDISKS_AUTO}="0" and save the file.

              Reboot the system.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jul 16 '14 at 9:37

























              answered Jul 15 '14 at 8:07









              PabiPabi

              5,67433042




              5,67433042













              • It didn't work, I executed the two command then reboote, and when i plugged my hard-drive, ubuntu stills mount it.

                – Didier Chavaroche
                Jul 16 '14 at 9:33











              • You can try the udev rule I added above.

                – Pabi
                Jul 16 '14 at 9:37











              • I didn't try the rule, but I have a question before, I plug the hard drives directly onto the SATA ports of my computer, How should I translate the rule? SUBSYSTEM=="sata"?

                – Didier Chavaroche
                Jul 25 '14 at 9:35



















              • It didn't work, I executed the two command then reboote, and when i plugged my hard-drive, ubuntu stills mount it.

                – Didier Chavaroche
                Jul 16 '14 at 9:33











              • You can try the udev rule I added above.

                – Pabi
                Jul 16 '14 at 9:37











              • I didn't try the rule, but I have a question before, I plug the hard drives directly onto the SATA ports of my computer, How should I translate the rule? SUBSYSTEM=="sata"?

                – Didier Chavaroche
                Jul 25 '14 at 9:35

















              It didn't work, I executed the two command then reboote, and when i plugged my hard-drive, ubuntu stills mount it.

              – Didier Chavaroche
              Jul 16 '14 at 9:33





              It didn't work, I executed the two command then reboote, and when i plugged my hard-drive, ubuntu stills mount it.

              – Didier Chavaroche
              Jul 16 '14 at 9:33













              You can try the udev rule I added above.

              – Pabi
              Jul 16 '14 at 9:37





              You can try the udev rule I added above.

              – Pabi
              Jul 16 '14 at 9:37













              I didn't try the rule, but I have a question before, I plug the hard drives directly onto the SATA ports of my computer, How should I translate the rule? SUBSYSTEM=="sata"?

              – Didier Chavaroche
              Jul 25 '14 at 9:35





              I didn't try the rule, but I have a question before, I plug the hard drives directly onto the SATA ports of my computer, How should I translate the rule? SUBSYSTEM=="sata"?

              – Didier Chavaroche
              Jul 25 '14 at 9:35













              1














              You can try to add the module to the blacklist:



              sudo gedit /etc/modprobe.d/blacklist.conf



              add:




              blacklist usb-storage




              or



              echo "blacklist usb-storage" | sudo tee -a /etc/modprobe.d/blacklist.conf



              Enabling it later should just be:



              sudo modprobe usb-storage






              share|improve this answer




























                1














                You can try to add the module to the blacklist:



                sudo gedit /etc/modprobe.d/blacklist.conf



                add:




                blacklist usb-storage




                or



                echo "blacklist usb-storage" | sudo tee -a /etc/modprobe.d/blacklist.conf



                Enabling it later should just be:



                sudo modprobe usb-storage






                share|improve this answer


























                  1












                  1








                  1







                  You can try to add the module to the blacklist:



                  sudo gedit /etc/modprobe.d/blacklist.conf



                  add:




                  blacklist usb-storage




                  or



                  echo "blacklist usb-storage" | sudo tee -a /etc/modprobe.d/blacklist.conf



                  Enabling it later should just be:



                  sudo modprobe usb-storage






                  share|improve this answer













                  You can try to add the module to the blacklist:



                  sudo gedit /etc/modprobe.d/blacklist.conf



                  add:




                  blacklist usb-storage




                  or



                  echo "blacklist usb-storage" | sudo tee -a /etc/modprobe.d/blacklist.conf



                  Enabling it later should just be:



                  sudo modprobe usb-storage







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 16 '14 at 11:01









                  Ruslan GerasimovRuslan Gerasimov

                  3,06221220




                  3,06221220























                      0














                      As Pabi wrote in his answer, run this command:



                      gsettings set org.gnome.desktop.media-handling automount 'false'


                      BUT: this will probably not be effective until the next reboot.



                      Lack of a reboot caused me to doubt the effectiveness of gsettings initially. I found it when being very thorough in preparation for filing a bug, which I found I didn't need to do. I've only tried this under sudo, however, so if you still have trouble, try doing it that way. I want this effective system-wide and found this does the job.



                      You do not need to touch automount-open because it only applies when an automount happens, and you will have disabled that.






                      share|improve this answer




























                        0














                        As Pabi wrote in his answer, run this command:



                        gsettings set org.gnome.desktop.media-handling automount 'false'


                        BUT: this will probably not be effective until the next reboot.



                        Lack of a reboot caused me to doubt the effectiveness of gsettings initially. I found it when being very thorough in preparation for filing a bug, which I found I didn't need to do. I've only tried this under sudo, however, so if you still have trouble, try doing it that way. I want this effective system-wide and found this does the job.



                        You do not need to touch automount-open because it only applies when an automount happens, and you will have disabled that.






                        share|improve this answer


























                          0












                          0








                          0







                          As Pabi wrote in his answer, run this command:



                          gsettings set org.gnome.desktop.media-handling automount 'false'


                          BUT: this will probably not be effective until the next reboot.



                          Lack of a reboot caused me to doubt the effectiveness of gsettings initially. I found it when being very thorough in preparation for filing a bug, which I found I didn't need to do. I've only tried this under sudo, however, so if you still have trouble, try doing it that way. I want this effective system-wide and found this does the job.



                          You do not need to touch automount-open because it only applies when an automount happens, and you will have disabled that.






                          share|improve this answer













                          As Pabi wrote in his answer, run this command:



                          gsettings set org.gnome.desktop.media-handling automount 'false'


                          BUT: this will probably not be effective until the next reboot.



                          Lack of a reboot caused me to doubt the effectiveness of gsettings initially. I found it when being very thorough in preparation for filing a bug, which I found I didn't need to do. I've only tried this under sudo, however, so if you still have trouble, try doing it that way. I want this effective system-wide and found this does the job.



                          You do not need to touch automount-open because it only applies when an automount happens, and you will have disabled that.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 20 at 22:28









                          4dummies4dummies

                          389




                          389






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f497958%2fhow-to-disable-automount-of-an-harddrive%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                              Mangá

                              Eduardo VII do Reino Unido