Skip to content

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
pranitnaik43 pushed a commit to bahaal-tech/dstack that referenced this pull request Feb 9, 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: dstackai#2257
pranitnaik43 pushed a commit to bahaal-tech/dstack that referenced this pull request Mar 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: dstackai#2257
pranitnaik43 pushed a commit to bahaal-tech/dstack that referenced this pull request Mar 5, 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: dstackai#2257
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

3 participants