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

Train doesn't create a login shell #148

Closed
jonathanmorley opened this issue Sep 7, 2016 · 2 comments
Closed

Train doesn't create a login shell #148

jonathanmorley opened this issue Sep 7, 2016 · 2 comments

Comments

@jonathanmorley
Copy link
Contributor

require 'train'

train = Train.create('ssh', host: '127.0.0.1', port: 2200, user: 'vagrant', password: 'vagrant')
conn = train.connection
puts conn.run_command("shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'").stdout

Expected output Login shell
Actual output Not login shell

Since train 'logs in' to the remote host, and then runs commands against them, I would expect the resulting shells to be login shells.

I think a login parameter should be added to somehow force train to create a login shell (defaulted to false for backwards compatibility).

@jonathanmorley
Copy link
Contributor Author

The main driver for this issue is that inspec tests can return different results than manual ssh, since login shells will source the /etc/profile file.

@chris-rock
Copy link
Contributor

@jonathanmorley I really like that option. I see the point that paths etc may not be loaded. I just want to make sure we keep the default as is and make this fully optional. If users need this behavior, he should have the power to do so 👍

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

No branches or pull requests

3 participants