Skip to content
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

ENV_SUPATH from login.defs not used when connecting to root user #1004

Closed
wants to merge 5 commits into from

Conversation

aashley
Copy link

@aashley aashley commented May 19, 2017

When connecting to a root user on Ubuntu (or any OS using login.defs) the ENV_SUPATH is used to set the default PATH variable value instead of ENV_PATH. Typically ENV_SUPATH has the sbin directories ENV_PATH does not.

This patch adds a username variable to the call of getDefaultEnvPath() and if it is root will load the ENV_SUPATH instead of ENV_PATH. This allows granting access to the root user directly while still providing the expected default PATH values.

@gravitational-jenkins
Copy link

Can one of the admins verify this patch?

@aashley
Copy link
Author

aashley commented May 19, 2017

forgot to commit a line, patch should actually do what it says on the box now

defaultValue := "PATH=" + defaultPath
variableName := "ENV_PATH"
if osUser == "root" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if root logs in without ENV_SUPATH defined, it won't pick up any path at all. instead, it should fall back to ENV_PATH in such case.

another question I have: is comparing username to root enough if a user is superuser? IMO a better test would be to check UID for 0.

@kontsevoy
Copy link
Contributor

@aashley created an issue #1046 scheduled for the next release.

@kontsevoy kontsevoy closed this Jun 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants