0

Simply said, I can't execute any file or directory with screen. The error 'Cannot exec '/path/to/file': permission denied.' occurs every time.

I'm logged in with root, and should have all permissions needed, but it still fails to execute any file.

I'm trying to screen a .js file. (The .js file works fine without screen, and isn't supposed to shut-down/return anything at all.)

  • sudo chmod +x /path/to/file – Android Dev Mar 15 '16 at 14:22
  • Seems to work, but when I use screen after that it just terminates immediately. – Gilbert Gobbels Mar 15 '16 at 14:27
  • 2
    Could you elaborate a bit on what exactly you are doing? – Android Dev Mar 15 '16 at 14:29
  • 1
    Right, so I'm trying to screen a .js file, as I want it to be accesable from outside one terminal ETC. (The .js file works fine without screen, and isn't supposed to shut-down/return anything at all.) – Gilbert Gobbels Mar 15 '16 at 14:30
  • I'm not able to reproduce using an sh file. – Android Dev Mar 15 '16 at 14:48
1

As Android Dev said in comments, you must set execution properties for your file, by chmod +x path-to-file or by chmod 777 path-to-file.

0

You need to do 2 things:

  1. Update the permissions of the file with chmod:

    sudo chmod +x path/to/file.sh
    
  2. For screen to execute the file and stay open, you must specify to run it with sh:

    screen -S nameOfSession sh /path/to/file.sh
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.