How do you do this when using a non-standard port? I have tried 'ssh -p 2200' and no luck, no matter what i do it still try's to connect on port 22 which is disabled on our server.
My current script: ( Please point out any potential errors that I may have)
(running as inline-script)
15-Jul-2015 15:02:33 | Could not create directory '/home/Bamboo/.ssh'. |
15-Jul-2015 15:02:33 | Host key verification failed. |
15-Jul-2015 15:02:33 | rsync: connection unexpectedly closed (0 bytes received so far) [sender] |
15-Jul-2015 15:02:33 | rsync error: unexplained error (code 255) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [sender=3.0.9] |
Sorry, it won't let me respond anymore with comments (it says I'm over the 24 hour limit for new users)
Is there a way to disable the cause of Host key verification failed.
Also since I'm doing a script where am I supposed to actually input the credentials? Will the shared credentials on bamboo be enough so that I can connect?
@David - No offense taken. My issue is that everything is ran through Atlassians Bamboo website so I have no way to access the server. The build servers are one of many on amazon S3. Maybe I'm missing something but I am not bridging the gap between where I can get the key to sit and how to pass those things into the script that I'm running during my build process.
Try
--rsh='ssh -p 2200'
I also do this for my own deployments, though you could just put the private key somewhere bamboo can access, instead of embedding them as a script line. The sed stuff at the end just reformats the single line string of the private key, into the acceptable format file that SSH expects.
echo "-----BEGIN RSA PRIVATE KEY----- MIIa...== -----END RSA PRIVATE KEY-----" | sed -e "s/- /-\n/" | sed -e "s/= /=\n/" | sed -e "2s/ /\n/g" > ${bamboo.working.directory}/tmpkey chmod 0600 ${bamboo.working.directory}/tmpkey --rsh='ssh -p 22022 -i ${bamboo.working.directory}/tmpkey'
Ahhh... you're using the cloud instance version. Well, that may change how you handle it. I'm only using Atlassian software on my own servers, hence my answers before are from that viewpoint. The method I'm using in my answer below *may* work for you, but it relies on being able to save a file somewhere so that command line ssh can read it. You may want to send a request to support to find out what read/write abilities you have as the bamboo user of a cloud instance. Make sure you reference this question here so they have a good idea of what you're trying to do. I'm sure you aren't the first to attempt to do this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm glad the port issue is solved for you now. Regarding host key verification, ssh attempts to save the host's identity in a file called known_hosts in the hidden .ssh directory of the user running the command. For bamboo, its the bamboo user, hence the /home/Bamboo reference. The quickest way to get this going is to log into the bamboo server as the bamboo user, and ssh to the machine you want to deploy to. If you can do that, then just replicate the switches you need into the rsync command. If you can't do that, you'll have to use additional ssh command line switches to disable the host key verification and other possible checks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
did you change the 'ssh -p 2200' part so the command looks more like: rsync -avv --delete --rsh='ssh -p 2200' ./ user@destination:/home/user/p.... ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
15-Jul-2015 14:37:08 | ssh: connect to host 162.248.50.177 port 22: Connection timed out |
15-Jul-2015 14:37:08 | rsync: connection unexpectedly closed (0 bytes received so far) [sender] |
15-Jul-2015 14:37:08 | rsync error: unexplained error (code 255) at /usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [sender=3.0.9]
|
It still shows port 22 even with the flag to change the port to 2200
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.