Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: want all files in a particular folder to have permission 755

  1. #1
    Join Date
    Aug 2012
    Beans
    623

    want all files in a particular folder to have permission 755

    Hello,
    Assume I have a folder called /home/IAMTubby/shellscrtipts .I want all files created in this folder to have permission 755.

    Use case:
    Otherwise, for every shell script I write, before running, it , I have to go and do a chmod +x myshellscript.sh or sh myshellscript.sh.

    Thanks.

  2. #2
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,165
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: want all files in a particular folder to have permission 755

    I don't think it can be done (and that would be a nice security hole)... I circumvent the problem with a "newscript" script: creates a stub (shebangs for bash & python and I drop the one I don't need) in my ~/bin, sets it executable, and starts the editor on it.

  3. #3
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: want all files in a particular folder to have permission 755

    nautilus supports such a feature already. Whatever you put in your Templates dir will be accessible from rightclick/new document menu. Filename is used as the entry name and that barebone template file is simply copied to where you need the new instance. I have templates named 'Bash script.sh' and 'Python script.py' with hashbangs and permissions set, plus Libre office doc and spreadsheet.
    Last edited by Vaphell; June 4th, 2013 at 01:10 PM.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  4. #4
    Join Date
    Aug 2012
    Beans
    623

    Re: want all files in a particular folder to have permission 755

    Quote Originally Posted by ofnuts View Post
    I don't think it can be done (and that would be a nice security hole)... I circumvent the problem with a "newscript" script: creates a stub (shebangs for bash & python and I drop the one I don't need) in my ~/bin, sets it executable, and starts the editor on it.
    ofnuts, thanks for the reply, but can't it be done by changing the folder properties or something? Sorry, don't know what's technically possible, just talking from an end-user point of view . I couldn't understand the solution you gave, I'm sorry


    Quote Originally Posted by Vaphell View Post
    nautilus supports such a feature already. Whatever you put in your Templates dir will be accessible from rightclick/new document menu. Filename is used as the entry name and that barebone template file is simply copied to where you need the new instance. I have templates for 'Bash script.sh' and 'Python script.py' with hashbangs and permissions set, plus Libre office doc and spreadsheet.
    Vaphell, thanks, but I'm not running a nautilus sadly. Is there a solution by editing the folder properties ?

  5. #5
    Join Date
    Dec 2009
    Beans
    5,683

    Re: want all files in a particular folder to have permission 755

    What version of Ubuntu are you using? - 12.04, 12.10, 13.04, .....

    There's a way to do this using bindfs but it different in 12.04 than in newer versions.

  6. #6
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    Re: want all files in a particular folder to have permission 755

    Quote Originally Posted by IAMTubby View Post
    Hello,
    Assume I have a folder called /home/IAMTubby/shellscrtipts .I want all files created in this folder to have permission 755.

    Use case:
    Otherwise, for every shell script I write, before running, it , I have to go and do a chmod +x myshellscript.sh or sh myshellscript.sh.

    Thanks.
    Put in a crontab entry * * * * *, and ... problem solved.

    So: "crontab -e" and then

    Code:
    * * * * *               chmod +x /home/IAMTubby/shellscrtipts/*.sh
    HTH

  7. #7
    Join Date
    Aug 2012
    Beans
    623

    Re: want all files in a particular folder to have permission 755

    Quote Originally Posted by Morbius1 View Post
    What version of Ubuntu are you using? - 12.04, 12.10, 13.04, .....

    There's a way to do this using bindfs but it different in 12.04 than in newer versions.
    Morbius1, I'm very sorry for the late reply.
    I'm running 11.04 but ideally I would like to have a solution which fits all versions, because I use other systems as well.

  8. #8
    Join Date
    Aug 2012
    Beans
    623

    Re: want all files in a particular folder to have permission 755

    Quote Originally Posted by sanderj View Post
    Put in a crontab entry * * * * *, and ... problem solved.

    So: "crontab -e" and then

    Code:
    * * * * *               chmod +x /home/IAMTubby/shellscrtipts/*.sh
    HTH
    sanderj, I'm sorry for the late reply, I added that line after doing a crontab -e. (I did make sure all my paths are correct.)


    I then went and wrote a 1-line shell script in the same directory as above and tried executing once again as ./test.sh, but it still gave me the same Permission denied message.
    Am I executing incorrectly ?

  9. #9
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    Re: want all files in a particular folder to have permission 755

    post the output of:

    Code:
    crontab -l
    ls -al /home/IAMTubby/shellscrtipts/*.sh

  10. #10
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: want all files in a particular folder to have permission 755

    which DE/file browser do you use that it doesn't support the file templates?
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

Page 1 of 3 123 LastLast

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
  •