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

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

          Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

          Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?