Cannot execute script while its permission is 'x'Firefox script errorInstall linux bash script from windows to a remote linux systemHow to invoke shell script while staying in interactive modehow to grant execute permission without read permission?How do I get a shell script to run at start-up with cron?execute function in different shelllinux why can't i execute a script as rootHow to give script read access to files in a directory on LinuxCannot update Symbol Links - Permission Deniedpython subprocess.run() doesn't wait for sh script completion

Blood-based alcohol for vampires?

Language Selector

Is it possible to spoof an IP address to an exact number?

Are there advantages in writing by hand over typing out a story?

Will greasing clutch parts make it softer

Auto replacement of characters

Where is read command?

Why did my leaking pool light trip the circuit breaker, but not the GFCI?

What caused the flashes in the video footage of Chernobyl?

Why is quantum gravity non-renormalizable?

Does this circuit have marginal voltage level problem?

Should I warn my boss I might take sick leave

How to create a 2D table with varying step?

What is a "tittering order"?

Can you move between the attacks of a Twinned Booming Blade?

Should I cheat if the majority does it?

What do you call the angle of the direction of an airplane?

Phrase origin: "You ain't got to go home but you got to get out of here."

What can a novel do that film and TV cannot?

How come having a Deathly Hallow is not a big deal?

Was Wolfgang Unzicker the last Amateur GM?

What is meaning of 4 letter acronyms in Roman names like Titus Flavius T. f. T. n. Sabinus?

Can I deep fry food in butter instead of vegetable oil?

Should I hide my travel history to the UK when I apply for an Australian visa?



Cannot execute script while its permission is 'x'


Firefox script errorInstall linux bash script from windows to a remote linux systemHow to invoke shell script while staying in interactive modehow to grant execute permission without read permission?How do I get a shell script to run at start-up with cron?execute function in different shelllinux why can't i execute a script as rootHow to give script read access to files in a directory on LinuxCannot update Symbol Links - Permission Deniedpython subprocess.run() doesn't wait for sh script completion






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








17















I have a script in the current directory, however, given that:



  1. the permission is -rwxr-xr-x

  2. the script has a shebang #!/bin/bash at the top of the file

  3. my shell is /bin/bash

  4. I can execute it using bash script.sh

I cannot execute it using ./script.sh. It gives me:




bash: ./script.sh: Permission denied




Why is this happening and what is the solution?










share|improve this question






























    17















    I have a script in the current directory, however, given that:



    1. the permission is -rwxr-xr-x

    2. the script has a shebang #!/bin/bash at the top of the file

    3. my shell is /bin/bash

    4. I can execute it using bash script.sh

    I cannot execute it using ./script.sh. It gives me:




    bash: ./script.sh: Permission denied




    Why is this happening and what is the solution?










    share|improve this question


























      17












      17








      17


      1






      I have a script in the current directory, however, given that:



      1. the permission is -rwxr-xr-x

      2. the script has a shebang #!/bin/bash at the top of the file

      3. my shell is /bin/bash

      4. I can execute it using bash script.sh

      I cannot execute it using ./script.sh. It gives me:




      bash: ./script.sh: Permission denied




      Why is this happening and what is the solution?










      share|improve this question
















      I have a script in the current directory, however, given that:



      1. the permission is -rwxr-xr-x

      2. the script has a shebang #!/bin/bash at the top of the file

      3. my shell is /bin/bash

      4. I can execute it using bash script.sh

      I cannot execute it using ./script.sh. It gives me:




      bash: ./script.sh: Permission denied




      Why is this happening and what is the solution?







      linux bash shell






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 25 at 22:02









      Peter Mortensen

      8,46616 gold badges61 silver badges85 bronze badges




      8,46616 gold badges61 silver badges85 bronze badges










      asked Jun 24 at 21:01









      HenryHenry

      1887 bronze badges




      1887 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          20














          • The execution is not allowed because the file is on a filesystem mounted with the "noexec" option. Use findmnt -u -T . to find out if that's the case. If you have root privileges, mount -o remount,exec <dir> should remove this option.


          • The execution is not allowed by MAC policies (SELinux, SMACK, possibly AppArmor). Check the system logs, starting with journalctl -n 100 and dmesg. Bypassing this (if you're the administrator) depends on which MAC system is actually in use.






          share|improve this answer




















          • 3





            Thank you, in my case it is noexec. I got confused, I have this disk mount as /home ext4 auto,exec,rw,async,user 0 2 in /etc/fstab, why is it noexec?

            – Henry
            Jun 24 at 21:28






          • 6





            Because you have the user option in there.

            – grawity
            Jun 25 at 14:15











          • What is MAC (in this context)? Not MAC address, I presume(?).

            – Peter Mortensen
            Jun 25 at 22:03







          • 3





            Mandatory Access Control

            – Dancrumb
            Jun 25 at 22:25













          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "3"
          ;
          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%2fsuperuser.com%2fquestions%2f1452496%2fcannot-execute-script-while-its-permission-is-x%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          20














          • The execution is not allowed because the file is on a filesystem mounted with the "noexec" option. Use findmnt -u -T . to find out if that's the case. If you have root privileges, mount -o remount,exec <dir> should remove this option.


          • The execution is not allowed by MAC policies (SELinux, SMACK, possibly AppArmor). Check the system logs, starting with journalctl -n 100 and dmesg. Bypassing this (if you're the administrator) depends on which MAC system is actually in use.






          share|improve this answer




















          • 3





            Thank you, in my case it is noexec. I got confused, I have this disk mount as /home ext4 auto,exec,rw,async,user 0 2 in /etc/fstab, why is it noexec?

            – Henry
            Jun 24 at 21:28






          • 6





            Because you have the user option in there.

            – grawity
            Jun 25 at 14:15











          • What is MAC (in this context)? Not MAC address, I presume(?).

            – Peter Mortensen
            Jun 25 at 22:03







          • 3





            Mandatory Access Control

            – Dancrumb
            Jun 25 at 22:25















          20














          • The execution is not allowed because the file is on a filesystem mounted with the "noexec" option. Use findmnt -u -T . to find out if that's the case. If you have root privileges, mount -o remount,exec <dir> should remove this option.


          • The execution is not allowed by MAC policies (SELinux, SMACK, possibly AppArmor). Check the system logs, starting with journalctl -n 100 and dmesg. Bypassing this (if you're the administrator) depends on which MAC system is actually in use.






          share|improve this answer




















          • 3





            Thank you, in my case it is noexec. I got confused, I have this disk mount as /home ext4 auto,exec,rw,async,user 0 2 in /etc/fstab, why is it noexec?

            – Henry
            Jun 24 at 21:28






          • 6





            Because you have the user option in there.

            – grawity
            Jun 25 at 14:15











          • What is MAC (in this context)? Not MAC address, I presume(?).

            – Peter Mortensen
            Jun 25 at 22:03







          • 3





            Mandatory Access Control

            – Dancrumb
            Jun 25 at 22:25













          20












          20








          20







          • The execution is not allowed because the file is on a filesystem mounted with the "noexec" option. Use findmnt -u -T . to find out if that's the case. If you have root privileges, mount -o remount,exec <dir> should remove this option.


          • The execution is not allowed by MAC policies (SELinux, SMACK, possibly AppArmor). Check the system logs, starting with journalctl -n 100 and dmesg. Bypassing this (if you're the administrator) depends on which MAC system is actually in use.






          share|improve this answer















          • The execution is not allowed because the file is on a filesystem mounted with the "noexec" option. Use findmnt -u -T . to find out if that's the case. If you have root privileges, mount -o remount,exec <dir> should remove this option.


          • The execution is not allowed by MAC policies (SELinux, SMACK, possibly AppArmor). Check the system logs, starting with journalctl -n 100 and dmesg. Bypassing this (if you're the administrator) depends on which MAC system is actually in use.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 9 hours ago









          Moshe Katz

          2,2722 gold badges16 silver badges34 bronze badges




          2,2722 gold badges16 silver badges34 bronze badges










          answered Jun 24 at 21:11









          grawitygrawity

          253k38 gold badges534 silver badges599 bronze badges




          253k38 gold badges534 silver badges599 bronze badges







          • 3





            Thank you, in my case it is noexec. I got confused, I have this disk mount as /home ext4 auto,exec,rw,async,user 0 2 in /etc/fstab, why is it noexec?

            – Henry
            Jun 24 at 21:28






          • 6





            Because you have the user option in there.

            – grawity
            Jun 25 at 14:15











          • What is MAC (in this context)? Not MAC address, I presume(?).

            – Peter Mortensen
            Jun 25 at 22:03







          • 3





            Mandatory Access Control

            – Dancrumb
            Jun 25 at 22:25












          • 3





            Thank you, in my case it is noexec. I got confused, I have this disk mount as /home ext4 auto,exec,rw,async,user 0 2 in /etc/fstab, why is it noexec?

            – Henry
            Jun 24 at 21:28






          • 6





            Because you have the user option in there.

            – grawity
            Jun 25 at 14:15











          • What is MAC (in this context)? Not MAC address, I presume(?).

            – Peter Mortensen
            Jun 25 at 22:03







          • 3





            Mandatory Access Control

            – Dancrumb
            Jun 25 at 22:25







          3




          3





          Thank you, in my case it is noexec. I got confused, I have this disk mount as /home ext4 auto,exec,rw,async,user 0 2 in /etc/fstab, why is it noexec?

          – Henry
          Jun 24 at 21:28





          Thank you, in my case it is noexec. I got confused, I have this disk mount as /home ext4 auto,exec,rw,async,user 0 2 in /etc/fstab, why is it noexec?

          – Henry
          Jun 24 at 21:28




          6




          6





          Because you have the user option in there.

          – grawity
          Jun 25 at 14:15





          Because you have the user option in there.

          – grawity
          Jun 25 at 14:15













          What is MAC (in this context)? Not MAC address, I presume(?).

          – Peter Mortensen
          Jun 25 at 22:03






          What is MAC (in this context)? Not MAC address, I presume(?).

          – Peter Mortensen
          Jun 25 at 22:03





          3




          3





          Mandatory Access Control

          – Dancrumb
          Jun 25 at 22:25





          Mandatory Access Control

          – Dancrumb
          Jun 25 at 22:25

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Super User!


          • 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%2fsuperuser.com%2fquestions%2f1452496%2fcannot-execute-script-while-its-permission-is-x%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

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form