Closed hertell closed 8 years ago
Is it important, that the config-file is named .rsub? Because rmate already supports loading of settings from config file, see: https://github.com/aurora/rmate#default-parameter-configuration
Also your code is not portable: there is no getent
on Mac OS X, is it a Linux-specific command?
I close this PR, because config files are already supported.
Hi, Yes, for the config-file part it's ok to close. The other logic to figure out the originally logged in user is still something that would be good to have. Doing a sudo when editing the file will loose the config-file for the particular user.. Unfortunately i did not figure out what i could use instead of getent in OSX.
Ah, i think i misunderstood the issue ... however i still cannot merge the patch, we need a more generic way to do this. I'll have a look if i can come up with some other solution.
@hertell I think i have a portable solution for this, i've just pushed the change. Would be happy if you can try it and provide feedback for it. I am using $SUDO_USER
which should always be set by sudo and fall back to $LOGNAME
, which is POSIX conform. Neither solution will work however if you specify a user for sudo -u ...
that cannot access the config-file due to missing permissions, but i think this case should be very rare ...
This works great :-) Normally i edit config-files etc as root, so the need to be someone else is more or less zero. Thanks! :-)
@hertell Fine! I never ran into this issue myself, but i think it's a very useful addition, so: thanks very much for filing this issue.
When using rsub in multiuser-environmets. setting a custom port via environment-variables won’t work if you use sudo. This patch let’s you set a .rsub config-file in your homedir witht the following content:
port=52697
the .rsub-file can be eg. distributed by puppet for making things easier.
The same port should then be set in your .ssh/config file as: Host * RemoteForward 52697 127.0.0.1:52698