-
Notifications
You must be signed in to change notification settings - Fork 185
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
Allow non-privileged execution #8
Comments
Hi James, |
Hi Tal, Thanks for the thoughtful reply. I spent some more time looking at this today and realized that it's really only viable to do port forwarding for Direct TCP mode, since NetBIOS mode requires root permissions for packets sent from the server, which can't easily be forwarded. The solution I ended up with was just to change DirectTCPPort from a const int to a virtual property. This allows inheriting from the SMBServer class and setting the port very easily, without adding any obfuscation. For what it's worth, I also looked at adding another method in my inherited class to start the server which listens on a different port, but all the fields on SMBServer are private, so that would have been a much more disruptive change. I'll send a PR, in case you decide that a one line change is acceptable -- feel free to delete it if you like. I'm happy to fork the project if need be, but I'm not sure it's worth it for a one line diff, and this makes it much easier to work with on Unixy systems (eg: my IDE won't load when I launch it as root). Thanks for such an awesome library! :) |
Thanks James, |
Starting in Linux 4.11 you can use sysfs ( |
Hi James,
|
Hi there, I'm interested in using SMBLibrary for a project I'm working on, but I'm a bit wary of running privileged code unnecessarily. Similarly, I'm not a huge fan of running my IDE as root to be able to debug my code. However, unless I do, attempts to listen to port 139/445 fail (I'm on Linux, though I imagine it's similar on other operating systems).
Is it possible to add some kind of mechanism for allowing a non-privileged mode? I appreciate that the SMB spec requires listening on those ports, but I'm wondering if it would work to allow listening on port 1139/1445 (say), and then forward data using something like xinetd.
In terms of implementation, it looks like this might be as straightforward as making SMBServer.Start a virtual method. Or maybe making NetBiosOverTCPPort and DirectTCPPort virtual readonly rather than const (or both! :))
Thoughts?
The text was updated successfully, but these errors were encountered: