rundeck-ec2-nodes-plugin icon indicating copy to clipboard operation
rundeck-ec2-nodes-plugin copied to clipboard

Run command with sudo without disabling requiretty

Open amitdaniel86-zz opened this issue 8 years ago • 9 comments

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 avatar Aug 23 '16 09:08 amitdaniel86-zz

@gschueler

Can you help ?

amitdaniel86-zz avatar Aug 28 '16 07:08 amitdaniel86-zz

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

gschueler avatar Aug 29 '16 15:08 gschueler

@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

amitdaniel86-zz avatar Aug 30 '16 06:08 amitdaniel86-zz

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

gschueler avatar Aug 30 '16 16:08 gschueler

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

dvg06 avatar Dec 16 '16 18:12 dvg06

@dvg06 what does your generated node definition look like?

gschueler avatar Dec 16 '16 18:12 gschueler

@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 avatar Dec 16 '16 18:12 dvg06

@gschueler - anything I am missing ?

dvg06 avatar Dec 18 '16 12:12 dvg06

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

yellow-straw-hat avatar May 26 '17 11:05 yellow-straw-hat