Execute sudo on remote agent

memoryleak November 3, 2013

In my deployment project I need to execute sudo in order to change ownership and permissions. When I try to execute it as command or a inline shell script I get following error:

you must have tty to run sudo

Is there a way to work around this?

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 3, 2013

on the remote agent, execute:

sudo visudo

then just remove the 'requiretty' setting. If you want to limit it to users/specific commands, google for it, there are some ready made recipes for it.

memoryleak November 3, 2013
Defaults:bamboo !requiretty

Did the job. Thanks!

Richard Cross September 26, 2017

The real solution would be for the SSH Task in Bamboo to offer a "Force pseudo-tty allocation" option (i.e. the equivalent of ssh -t).

This would avoid having to open up security holes in /etc/sudoers to accomodate Bamboo jobs that require sudo.

1 vote
gadelkareem November 7, 2014

Looks like bamboo user which is used on the tasks script is not a sudoer. You can add via the init script on the image config 

echo 'bamboo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/cloud-init
1 vote
Alex Perez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 3, 2013
memoryleak November 3, 2013

Can you explain to me why this command is executed via SSH when it should be executed on the remote agent? Are deployment tasks assigned to a remote agent not executed directly on the remote machine?

memoryleak November 3, 2013

Can you explain to me why this command is executed via SSH when it should be executed on the remote agent? Are deployment tasks assigned to a remote agent not executed directly on the remote machine?

memoryleak November 3, 2013

Can you explain to me why this command is executed via SSH when it should be executed on the remote agent? Are deployment tasks assigned to a remote agent not executed directly on the remote machine?

TAGS
AUG Leaders

Atlassian Community Events