It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Running Linux scripts from Bamboo that require sudo

Brian M. Howard Dec 15, 2017

I need to remove the /opt/poky folder on my build agent machine, but cannot find a way to do it from Bamboo.  It requires root permissions (sudo) however I cannot use sudoers for this to bypass password entry for sudo, and all my efforts fail.  Is there a secure way to do this from a Bamboo inline script, or running a local build agent script, in Ubuntu 14.04?   

2 answers

Not sure I understand, is sudoers not an option because of some policy? or you just haven't been able to make it work?

Also can you explain why you need to remove /opt/poky? Maybe we can offer an alternative solution.

0 votes
Brian M. Howard Dec 15, 2017

sudoers does not work, Bamboo throws an error ... whereas the same script run under that user  on the agent machine does not require a sudo password to run. 

There is no alternative to deleting that /opt/poky folder, there are libraries being changed to new version in that folder, the old libraries need to be deleted. This is to pass security scanning. 

 

But surely there are times when something must be installed as root from a build script ... such as when adding security to a bitbake image.  There is no way around the security portion, the script for it must be run as root.  I am hoping this can be automated in Bamboo, but again, Bamboo needs to be able to do things using sudo somehow.  

 

Thanks much, Boris

Whats the error you get when the script tries to sudo? Is it a tty error? 

Brian M. Howard Dec 15, 2017

Yes, specifically:   "sudo: no tty present and no askpass program specified."

While that same script run locally does not require a sudo password.  

The sudoers file did not have a tty requirement, but after failing for some time, I added:  Defaults   !requiretty

However, this addition also does not work.   

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Statuspage

⭐️Would you recommend Statuspage? Leave a (honest!) review. ⭐️

Hi Community friends, We're working on sourcing more reviews on Capterra – a popular software review site –  to help teams like yours make more informed decisions when choosing an inc...

46 views 2 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you