-
Notifications
You must be signed in to change notification settings - Fork 886
SFTP sessions start in /tmp/coder.KnYnxH
(instead of $HOME
)
#3620
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
Labels
api
Area: HTTP API
Comments
I investigated this a bit... it's quite involved. We'll have to implement file handlers ourselves since their implementation is in-memory only. See: https://github.com/pkg/sftp/blob/811ed177f06e87f233019bf6eb908c0c73095d15/request-example.go#L24 Apart from that, it seems like we could just swap it out. |
mafredri
added a commit
that referenced
this issue
Oct 7, 2022
This is a simple fix for #3620 by changing the working directory of `coder agent` at runtime. Since the agent doesn't write files to it's working directory, I can't think of any downsides to this method. It does not, however, exclude that we rewrite the SFTP implementation to use the modernized `RequestServer` sometime in the future. Opted to place this in agent init vs `cli/agent` because of portability of fix, tests don't usually use `cli/agent`. Fixes #3620
This was referenced Oct 7, 2022
mafredri
added a commit
that referenced
this issue
Oct 14, 2022
This commit switches to our fork of `pkg/sftp` which includes a Server option for changing the current working directory. Attempt to upstream: pkg/sftp#528 Supercedes and closes #4420 Fixes #3620
mafredri
added a commit
that referenced
this issue
Oct 14, 2022
This commit switches to our fork of `pkg/sftp` which includes a Server option for changing the current working directory. Attempt to upstream: pkg/sftp#528 Supercedes and closes #4420 Fixes #3620
kylecarbs
pushed a commit
that referenced
this issue
Oct 21, 2022
* fix: Start SFTP sessions in user home (working directory) This commit switches to our fork of `pkg/sftp` which includes a Server option for changing the current working directory. Attempt to upstream: pkg/sftp#528 Supercedes and closes #4420 Fixes #3620 * Update fork
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since we are starting the coder agent in the tmpdir, SFTP sessions also start in that folder.
Arguably, the session should start in
$HOME
because this is my experience with OpenSSH and it's more useful when doingsftp
followed byls
(list files) or doing something with home-relative paths.There are (potentially) two ways to fix this:
os.Chdir
in an early part ofcoder agent
startup to change the default working directory by anything started by the agentsftp.Server
forsftp.RequestServer
(e.g.sftp.NewRequestServer(session, sftp.InMemHandler(), sftp.WithStartDirectory(os.Getenv("HOME")))
)Re: 2, I don't know if
sftp.RequestServer
can work as a drop-in replacement, the documentation is quite vague.Definition of done
$HOME
when usingsftp
The text was updated successfully, but these errors were encountered: