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

Login as one user and run commands as a deploy user #574

Open
alexwebgr opened this issue Oct 3, 2017 · 4 comments
Open

Login as one user and run commands as a deploy user #574

alexwebgr opened this issue Oct 3, 2017 · 4 comments
Labels

Comments

@alexwebgr
Copy link
Contributor

hi guys

i have encountered a scenario where for the sake of security commands must run as a 'deploy' user but i login as 'alex'
how can i switch users before executing any commands and ideally without touching mina source code ?
so far i have added a new task in mina-1.0.7/tasks/mina/deploy.rb

task :switch_user do command %{sudo su - deploy} end

which i invoke in the setup task but i when i run the mina setup it hangs. I assume this is because mina is running in a non-interactive ssh mode.

when i add this task in the generated deploy.rb setup task it runs last

thanks
alex

@d4be4st
Copy link
Member

d4be4st commented Oct 3, 2017

You are correct in your assumption about mina running in non-interactvie ssh mode.
And i believe it hangs because it is waiting for your to input your password.

I believe a fix would be to set execution mode to system

set :execution_mode, :system

Another solution would be to remove the need of a password when changing su to deploy.
Like adding this:
username ALL=(ALL) NOPASSWD: sudo su - deploy
to your sudoers file.

@alexwebgr
Copy link
Contributor Author

alexwebgr commented Oct 3, 2017

it appears that the deploy user was already set with NOPASSWD
however after setting the execution to system now it logs in and does nothing ! and when i exit i starts to run again

@d4be4st
Copy link
Member

d4be4st commented Oct 6, 2017

We do not have this kind of setup so I can't test it unfortunately.

Will try to set something up in the coming days and see if I can find a fix/workaround for this problem

@d4be4st d4be4st added the bug label Oct 6, 2017
@alexwebgr
Copy link
Contributor Author

alexwebgr commented Oct 6, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants