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

Bamboo SSH Task - Handle User Input to Change Password

Adam Myatt
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.
September 17, 2012

I'm using the Bamboo SSH Task. I want to connect to a Linux VM using the hostname, username, and password. Once connected I want to use the command field to pass commands that allow me to change the password of the user connecting. In the commands field I tried :

passwd

NEWPASS

NEWPASS

However when this runs it connects fine, then tries the passwd command and halts on it. Is there a way to pass these commands so the NEWPASS is treated as user input to the passwd command?

3 answers

1 accepted

0 votes
Answer accepted
Adam Myatt
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.
September 20, 2012

Ah ha. I was able to actually get this to work.

Using the "SSH Remote Commands" Task I specified the host, username, password and then in the "New Inline Script" field I used this :

echo "MyNewPassword" | passwd --stdin username

Though from the articles I read this is BAD security practice as anyone on that host with access to PS could easily see the command run, however it does prove it is possible.

Thank you for the additional feedback above.

0 votes
Cameron Ferguson
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.
September 17, 2012

I would think the better approach would be to set up the SSH access and RSA tokens to allow password-less SSH from the bamboo agent to the other box for that specific user.

0 votes
LucasA
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.
September 17, 2012

Hi Adam,

I'm afraid that this is not possible using only Bamboo. As a workaround, you can create an Expect script to change the password (or parse the output from another command) and call it via Bamboo task. I'd already created many Expect scripts to automatize tasks and it really works well.

I hope it helps. :)

Best regards,
Lucas Timm

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events