-
Notifications
You must be signed in to change notification settings - Fork 380
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
use rootDir as chroot #56
Conversation
@MikaelCluseau thanks for your PR. Can you please raise an issue describing the problem you are having, what you tried, and what prevented you from achieving your goal. It may be that this PR fixes the issue, in which case, that's very simple, but I prefer to discuss the issue first, then start coding. Thanks Dave |
The original intention of that parameter (although it is not implemented) was just a default working directory to use if the incoming path was not an absolute path. Something like: I would prefer to see this renamed serverRoot or virtualRoot; the word 'chroot' to me suggests using the chroot syscall achieve such behavior, whereas this is using code wrappers around the paths. chroot and default working directory are orthogonal concepts, so a distinct parameter would be nice, but I also don't want to add a parameter to NewServer() because that will break existing code. What does everyone think? |
Hi there. OK I understand. Envoyé depuis un mobile. -------- Message d'origine -------- The original intention of that parameter (although it is not implemented) was just a default working directory to use if the incoming path was not an absolute path. Something like: sftp to server.com as user 'mark', put local.file remote.file. I'd expect the file to on server.com to be in /home/mark/remote.file, not in /. rootDir is a vague name for this, defaultWorkingDirectory would be better. I would prefer to see this renamed serverRoot or virtualRoot; the word 'chroot' to me suggests using the chroot syscall achieve such behavior, whereas this is using code wrappers around the paths. chroot and default working directory are orthogonal concepts, so a distinct parameter would be nice, but I also don't want to add a parameter to NewServer() because that will break existing code. What does everyone think? — |
If you want to start adding configuration to the serve object the On Mon, 14 Dec 2015, 15:45 Mikaël Cluseau notifications@github.com wrote:
|
And a gentle reminder, as it looks like this pr is going away, please open Thanks Dave On Mon, 14 Dec 2015, 15:47 Dave Cheney dave@cheney.net wrote:
|
Another idea for the NewServer call: we could put all the "invariants" in the config object and create a method applying to it, allowing to create a server by giving it the reader and the writer. Like: Envoyé depuis un mobile. -------- Message d'origine -------- The original intention of that parameter (although it is not implemented) was just a default working directory to use if the incoming path was not an absolute path. Something like: sftp to server.com as user 'mark', put local.file remote.file. I'd expect the file to on server.com to be in /home/mark/remote.file, not in /. rootDir is a vague name for this, defaultWorkingDirectory would be better. I would prefer to see this renamed serverRoot or virtualRoot; the word 'chroot' to me suggests using the chroot syscall achieve such behavior, whereas this is using code wrappers around the paths. chroot and default working directory are orthogonal concepts, so a distinct parameter would be nice, but I also don't want to add a parameter to NewServer() because that will break existing code. What does everyone think? — |
Ok will do it after the night. Envoyé depuis un mobile. |
@MikaelCluseau I'm going to close this PR for the moment. Please raise an issue describing the problem you are trying to solve. |
Yes, sorry, been traveling a lot. My need evolved anyway so I'll try to get something done here. Something like http-handlers in fact, associating a "mount point" where to bind a handler. 2 handlers then: serve a local directory structure, or delegate to another sftp endpoint through a reader and a writer. I will need to implement something quickly anyways, so I'll have demo code to explain the need too. See you next year. |
Hi,
I may haven't understood the intent of "rootDir", but I understood it as a chroot-like parameter. I changed the packet handling in the server to take this idea in account.
If I'm wrong, please comment here so I can add a "chroot" argument somewhere and make another pull request introducing it.
Thanks!