Find the answer to your Linux question:
Results 1 to 8 of 8
Who is allowed to execute chmod on a file? Only the owner? If I don't have x privilege for a file then why am I allowed to execute it by ...
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Location
    STL, USA
    Posts
    8

    Question Execution Privileges?

    Who is allowed to execute chmod on a file? Only the owner?

    If I don't have x privilege for a file then why am I allowed to execute it by shelling out?

    What files am I allowed to execute by shelling out?

    Thanks.

  2. #2
    Linux Engineer nujinini's Avatar
    Join Date
    Apr 2009
    Posts
    1,229
    Hello davejjj,

    May I please ask what you mean by "shelling out"?

    Anyways, the owner or anybody with privileges as root (su -, or sudo) can chmod. If I am not mistaken.
    nujinini
    Linux User #489667

  3. #3
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Quote Originally Posted by davejjj
    If I don't have x privilege for a file then why am I allowed to execute it by shelling out?
    What do you mean by shelling out? Even google couldn't find out relevant info.
    Have you checked manual of chmod command?
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  4. #4
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    Could shelling out be
    Code:
    bash myscript
    although even in that case I'm not sure of the answer to the original question.
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  5. #5
    Trusted Penguin jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    4,071
    You may be right, elija.
    The only other thought I had would be specifying the path.
    Code:
    /entire/path/to/command
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to Private Messages asking for Linux help. Please, keep it on the public boards.

  6. #6
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    With regards to "shelling out":

    Executing a script works differently from executing a compiled program. In particular, executing a script is simply giving input to another program. When you execute a script like:
    Code:
    #!/usr/bin/perl
    
    LINES
    The OS, behind the scenes, converts it to executing the program /usr/bin/perl, with the input of the script.

    So, the answer to "why can you execute it by shelling out?" (assuming that shelling out means executing the script as "bash SCRIPT" instead of "./SCRIPT") is that as long as a user can read the file, he could input it into the interpreter program directly.

    Note that if you had a script that was both unexecutable and unreadable, it could not be executed at all.

    This does not apply to compiled programs, which are executed directly by the system. If a compiled program does not have executable privileges, it cannot be executed. However, if it is readable, it could be copied, the copy made executable, and then executed.
    DISTRO=Arch
    Registered Linux User #388732

  7. #7
    Trusted Penguin jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    4,071
    Makes sense...
    I think we're all just stuck here wondering, though, until the OP pops back in to explain what he means.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to Private Messages asking for Linux help. Please, keep it on the public boards.

  8. #8
    Just Joined!
    Join Date
    Oct 2011
    Location
    STL, USA
    Posts
    8
    Quote Originally Posted by nujinini View Post
    Hello davejjj,

    May I please ask what you mean by "shelling out"?

    Anyways, the owner or anybody with privileges as root (su -, or sudo) can chmod. If I am not mistaken.
    Oh, I'm sorry, I was led to believe that was the standard terminology. What I mean is that if you have written a script and you have not set the x bit for that file, you can still type...

    sh ./myscript

    ...and execute the script. This led me to wonder whether this only worked because of the specifics of the situation. Thanks. Sorry for the delay in getting back here.

Posting Permissions

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