Results 1 to 3 of 3

Thread: Permission Denied When Running Shell Script

  1. #1
    Join Date
    Sep 2021
    Beans
    1

    Permission Denied When Running Shell Script

    I'm using Ubuntu Server 20.04 LTS. When I run a shell script, I get the following error:
    Code:
    -bash: ./install.sh: Permission denied
    . I've looked at a similar post on this forum and none of those answers solved the problem. My terminal input and output are below. If anyone can help, that'd be very appreciated.

    Terminal: https://pastebin.com/ZbkKNYLd

  2. #2
    Join Date
    May 2008
    Beans
    4,367
    Distro
    Ubuntu 24.04 Noble Numbat

    Re: Permission Denied When Running Shell Script

    Permission denied usually means that you need sudo (elevated) privileges.

    Are you trying to install a software package?

  3. #3
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Permission Denied When Running Shell Script

    Code:
    wilsont@bzoit:/media/wilsont/disk$ chmod u+r+x install.sh
    That isn't a valid command.
    You want either
    Code:
    chmod 700 install.sh
    or
    Code:
    chmod u+rx install.sh
    Code:
    wilsont@bzoit:/media/wilsont/disk$ ./install.sh
    -bash: ./install.sh: Permission denied
    Cannot execute scripts that don't have the correct permissions.

    Use
    Code:
     ls -l install.sh
    to see the permissions.


    BTW, sudo ain't gonna help with the permissions in this situation.
    If you have trouble with Unix permissions, any Unix tutorial on permissions is 100% valid for Linux too. Any beginning Unix book from 1990 will have a chapter on it for $0.50. Or google "linux permissions tutorial", and spend 15 minutes working through that, then another 30 minutes in a play directory - perhaps /tmp/foo/ on your own system with 3 userids, 2 groups then setup files and subdirectories with every possible combination of owners, groups, and file permissions. Go from 000. 001, 002, 003, 004, 005, ..... to 771, 772, 773, 774, 775, 776, 777 ... and check out how each change allows or prevents access for the owner, group members, others and people outside the group. You'll see the pattern quickly and then you'll "have it" for the rest of your life.

    Or spend hours, days, weeks, months, years being frustrated over little issues like the above. Your choice.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •