Permission denied when running sh file

118,133

The permissions don't have the execute bit set, so bash won't execute the script. You can set the bit and execute the script:

chmod u+x mc.sh
./mc.sh

or let bash execute it for you:

bash mc.sh
Share:
118,133

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I am trying to use an sh file to easily start a screen with my minecraft server console. I named this file mc.sh. I have another sh file in the same directory as mc.sh that runs fine.

    Here is what is in mc.sh:

    screen -S minecraft java -Xms1024M -Xmx1024M -jar spigot.jar nogui
    

    Here is what is in the other sh file:

    #!/bin/sh    
    java -Xms512M -Xmx1024M -XX:MaxPermSize=128M -jar spigot.jar
    

    The error message i get is -bash: ./mc.sh: Permission denied. The permissions for mc.sh are -rw-rw-r-- 1