Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

bamboo instance setup script

I've got an AMI that can only be logged in with a user named "centos". This user has "sudo" access as well. How can I configure Bamboo to use the "centos" user to run the "Instance setup script"? It seems the "Instance setup script" will only work if the AMI is configured to login as the "root" user. Can someone shed some light on this for me, i've looked at the documentation and only see comments here or there about the matter.



My AMI has the root login disabled. Therefore it seems as if the "instance setup scripts" don't run at all. Which would make sense if it's trying to login as root. (Although I don't see any failed logs about this) Per the documentation "It's a script that gets run as root user before the agent is started." Therefore is it possible to configure Bamboo to run the "instance setup script" as another user other than root?

1 answer

1 accepted

0 votes
Answer accepted
Marcin Oles Atlassian Team Aug 18, 2015


yes, the startup scripts on Linux images are executed as root user. I'm not sure if root user can be disabled completely to such extent that it'll cause the script to stop working, but it usually isn't.

If you really need to use other user than root, then you may try switching the user using e.g. sudo. Didn't test it, but something like this might work:


# code as root here
# ...
# ...

exec sudo -u centos /bin/sh - << EOF

  # code as centos here
  # ...
  # ...


Although be careful with some variables, they might not be set correctly (e.g. $HOME, $USER). Maybe adding -H to sudo command will help.

Or, you could try doing it command by command. Just be careful with single and double quotes. E.g.


sudo -u centos -H sh -c 'echo $HOME'    # out: /home/centos
sudo -u centos -H sh -c "echo $HOME"    # out: /root


=== EDIT ===

The user 'root' is not logging in via SSH. It's just the user that launches the startup scripts. I think it's impossible to disable this user. You can disable logging in as root, but it wouldn't disable startup scripts.

So in your case I'd rather look for another source of error, not in the user calling the scripts. There may be some errors in the scripts in the first place. Or, even more probable, if it's not an AMI build based on an existing Bamboo stock image, the startup script might not be registered to run at startup.

Make sure that your /etc/rc.local executes startup scripts from agent installation directory. This is how it looks like for Bamboo stock images:

File: /etc/rc.local
if [ $? -eq 0 ]; then
    echo "Starting Elastic Bamboo Agent..."
    echo "Elastic Bamboo Agent not started."


Thanks for the response. I added a clarification to my question stating that the root account is disabled via SSH completely. (I can still run "sudo" and "sudo su -" but wouldn't be able to SSH into the root account) Therefore how can I configure Bamboo to run the "instance setup script" as a user other than root?

Marcin Oles Atlassian Team Aug 19, 2015

Hey, I've updated my answer after your clarification, hope it helps.

You're my hero! I indeed was building from scratch with packer and never knew to run /opt/elastic-bamboo-agent/bin/! This has solved my problem, thank you so much for the help!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

587 views 1 6
Read article

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