I am ssh-ing into a Linux cluster that uses an AFS home directory. I am trying to use GNU screen to run a long-running program in a detached screen. If I remain logged in the program executes perfectly, and this includes writing to a file.

I want to be able to logout from the ssh session and leave the program running in the detached screen. I try logging out and ssh-ing back in. However, when I check on the detached screen I see that my program has crashed because it did not have permissions to write to file.

[local]me: ssh info@inf.ed.us
[remote]user: screen    # this pops up a new screen
[remote]user: python get_data.py

I then hit Ctrl-a d (to detach screen)

[remote]user: logout
[local]me: ssh info@inf.ed.us
[local]me: screen

And this is what I see in the detached screen:

 Traceback (most recent call last):
      File "get_data.py", line 430, in <module>
      File "get_data.py", line 346, in produce_roof_patches
      File "get_data.py", line 225, in save_patch
    IOError: [Errno 13] Permission denied: '../data/training/labels.csv'

If I do not log out and simply detach (Ctrl-a d) and reattach via 'screen' then the program continues running without any trouble.

I have read that this is because when logging out my filesystem becomes unmounted and the program does not have permissions to write anywhere in my filesystem. Is there a workaround for this?

  • Please add the scripts and error messages – 030 Jul 1 '15 at 20:26
  • What kind of authentication do you have in place? Are your home directories encrypted, auto-mounted via nfs or something else? – Zoredache Jul 1 '15 at 21:28
  • I have a feeling that you are using ecryptfs. Can you confirm that please? Do you see a /home/.ecryptfs directory on the system? – vagarwal Jul 2 '15 at 12:50
  • I adde more info. I do not have a /home/.ecryptfs directory – angela Jul 3 '15 at 8:02
  • Also, @Zoredache - how can I find that out? This link has more info on the server, but I couldn't find the info you asked for. – angela Jul 3 '15 at 8:09

Detached... as in... <control>-<z> then bg? or running with the & symbol? These are not detached. These are forked processes.

Detached processes can be started using the nohup command, or run in a tmux session or some such.

If you would like more information about any of these, feel free to ask.

  • gnu-screen is exactly what tmux resembles. Detaching means not the logout but disconnecting from the launched sessions. – Kondybas Jul 2 '15 at 7:04
  • I added more info to my question. Hope that clarifies things! – angela Jul 3 '15 at 8:02

Using absolute paths instead of relative paths to write to file fixed my problem.

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.