Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[runner] Back up and restore ~/.ssh files #2261

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

un-def
Copy link
Collaborator

@un-def un-def commented Feb 4, 2025

Preserve ~/.ssh directory state, namely environment and authorized_keys files, as follows:

Before a job started:

  • If <file> exists:
    • rename <file> to <file>.dstack.bak
    • copy backup to a new file with original name <file>
  • If <file> does not exist: remember this

After the job finished:

  • If <file> existed: rename <file>.dstack.bak back to <file>
  • If <file> did not exist: remove <file>

Fixes: #2257

Preserve `~/.ssh` directory state, namely `environment` and
`authorized_keys` files, as follows:

Before a job started:

* If `<file>` exists:
    - rename `<file>` to `<file>.dstack.bak`
    - copy backup to a new file with original name `<file>`
* If `<file>` does not exist: remember this

After the job finished:

* If `<file>` existed: rename `<file>.dstack.bak` back to `<file>`
* If `<file>` did not exist: remove `<file>`

Fixes: #2257
@un-def un-def requested a review from r4victor February 4, 2025 06:51
@un-def un-def merged commit 4cc82c3 into master Feb 4, 2025
24 checks passed
@un-def un-def deleted the issue_2257_runner_restore_ssh_dir_state branch February 4, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot log into run container when ~/.ssh is located on a volume
2 participants