-
Notifications
You must be signed in to change notification settings - Fork 88
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
[capistrano] Add ability to use etc.getpwuid
instead of etc.getlogin
to get the user name
#146
Conversation
This issue has been automatically marked as stale because it has not had activity in the last 30 days. |
Hi @rkul Sorry for the late reply, |
`getlogin()` obtains the logged-in username by looking up the current tty in `utmp` and reporting the login name found in that utmp record. If Capistrano is ran from Jenkins in the host it returns the user logged in to `pts/0`, which is not the same user as runs the Capistrano. Also Ruby docs recommends avoid using `getlogin()`: >getlogin → String >Returns the short user name of the currently logged in user. Unfortunately, it is often rather easy to fool ::getlogin. > >Avoid ::getlogin for security-related purposes. > >If ::getlogin fails, try ::getpwuid. > >See the unix manpage for getpwuid(3) for more detail. http://ruby-doc.org/stdlib-2.2.0/libdoc/etc/rdoc/Etc.html#method-c-getlogin
etc.getpwuid
instead of etc.getlogin
to get the user name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 💯
getlogin()
obtains the logged-in username by looking up the current tty inutmp
and reporting the login name found in that utmp record. If Capistrano is ran from Jenkins in the host it returns the user logged in topts/0
, which is not the same user as runs the Capistrano. Also Ruby docs recommends avoid usinggetlogin()
: