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

Run command with sudo without disabling requiretty #53

Open
amitdaniel86-zz opened this issue Aug 23, 2016 · 9 comments
Open

Run command with sudo without disabling requiretty #53

amitdaniel86-zz opened this issue Aug 23, 2016 · 9 comments

Comments

@amitdaniel86-zz
Copy link

amitdaniel86-zz commented Aug 23, 2016

Hi ,

I'm using the rundeck-ec2-nodes-plugin and i need to run command with sudo .

when I'm running them as sudo I'm getting the next error :

sudo: sorry, you must have a tty to run sudo

i don't want to comment : Defaults requiretty from sudoers file .
Also i didn't fine if i can add "sudo authentication" for ec2 plugin .

Thanks for your help
Amit

@amitdaniel86-zz
Copy link
Author

amitdaniel86-zz commented Aug 28, 2016

@gschueler

Can you help ?

@gschueler
Copy link
Member

enable sudo for the node see http://rundeck.org/docs/plugins-user-guide/ssh-plugins.html#secondary-sudo-password-authentication

for ec2 plugin you willl have to add the attributes to the mapping definition in the plugin

@amitdaniel86-zz
Copy link
Author

amitdaniel86-zz commented Aug 30, 2016

@gschueler

added :

ssh-keypath.default=/var/lib/rundeck/.ssh/id_rsa;username.default=rundeck;hostname.selector=privateIpAddress;sudo-command-enabled="true"

but still i'm getting tty issue:

sudo: sorry, you must have a tty to run sudo
09:38:02 Remote command failed with exit status 1
09:38:02 Failed: NonZeroResultCode: Remote command failed with exit status 1

@gschueler
Copy link
Member

you would need sudo-command-enabled.default=true

@dvg06
Copy link

dvg06 commented Dec 16, 2016

@gschueler I have this entry, but still getting errors - anything I am missing?

@gschueler
Copy link
Member

@dvg06 what does your generated node definition look like?

@dvg06
Copy link

dvg06 commented Dec 16, 2016

@gschueler apologies , newbie here.
I am trying to use ec2 plugin since I wanted to run commands as splunk user in many instances. I do no have the password, but ec2-user has sudo su access.

field mapping:
nodename.selector=instanceId;privateIpAddress.selector=privateIpAddress;hostname.selector=privateIpAddress,privateDnsName,publicDnsName;username.default=centos; sudo-command-enabled.default=true

@dvg06
Copy link

dvg06 commented Dec 18, 2016

@gschueler - anything I am missing ?

@yellow-straw-hat
Copy link

@amitdaniel86 When configuring the Node Executor, make sure to check the "Force PTY" checkbox, this will always force the use of a new pty.

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

4 participants