bitbucket on aws - ssh fails with error: "shell request failed on channel 0"

Trolled the web, cant seem to find a solution. 

Setup: 

Bitbucket installed on AWS using the Bitbucket ami. I've setup the ssh keys.

The problem:

Testing ssh access (ssh -T ...) fails after authentication with the error: shell request failed on channel 0".

How / what:

Here's the command I run from gitbash on my Windows 7 PC. I've also tried with the option (-o ForwardX11=no), and same results: 

$ ssh -T -v git@my.awshost.com -p 7999

Here's the output on the Windows PC:

OpenSSH_7.1p2, OpenSSL 1.0.2d 9 Jul 2015

debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to my.awshost.com [52.204.172.23] port 7999.
debug1: Connection established.
debug1: identity file /c/Users/user1/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version SSHD-CORE-0.14.1-ATLASSIAN-01
debug1: no match: SSHD-CORE-0.14.1-ATLASSIAN-01
debug1: Authenticating to my.awshost.com:7999 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha2-256 none
debug1: kex: client->server aes128-ctr hmac-sha2-256 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
debug1: Host '[my.awshost.com]:7999' is known and matches the RSA host key.
debug1: Found key in /c/Users/user1/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/user1/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to my.awshost.com ([52.204.172.23]:7999).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
shell request failed on channel 0

 

 

1 answer

0 votes

Hi @Sreeram Ramanathan,

Bitbucket Server's SSH built-in SSH server does not allow interactive SSH sessions. If you want to log into your Amazon EC2 instance, you will need to connect via port 22, and use the AWS EC2 Key Pair you specified when creating the instance.

The SSH server running on port 7999 will only accept certain whitelisted commands to allow interacting with the SCM via SSH. 

Any git command should work. Ie. you should be able to git clone via SSH from Bitbucket Server. 

I hope that helps, 

Felix 

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

672 views 0 4
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot