I have added my cat ~/.ssh/id_rsa.pub from my remote server to bitbucket ssh keys.
However when I try connect from my remote server with bitbucket I get:
PTY allocation request failed on channel 0
conq: logged in as hyperrjas.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
I have changed the default ssh port (22) to other port in my remote server. I don't know if this is the problem.
This is the debug when I enter ssh -v git#bitbucket.org from my remote server.
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to bitbucket.org [111.111.111.111] port 22.
debug1: Connection established.
debug1: identity file /home/hyperrjas/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/hyperrjas/.ssh/id_rsa-cert type -1
debug1: identity file /home/hyperrjas/.ssh/id_dsa type -1
debug1: identity file /home/hyperrjas/.ssh/id_dsa-cert type -1
debug1: identity file /home/hyperrjas/.ssh/id_ecdsa type -1
debug1: identity file /home/hyperrjas/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /home/hyperrjas/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
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: /home/hyperrjas/.ssh/id_rsa
debug1: Remote: Forced command: conq username:hyperrjas
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/hyperrjas/.ssh/id_rsa':
debug1: read PEM private key done: type RSA
debug1: Remote: Forced command: conq username:hyperrjas
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([111.111.111.111]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions#openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
PTY allocation request failed on channel 0
conq: logged in as hyperrjas.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow#openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to bitbucket.org closed.
Transferred: sent 3072, received 2904 bytes, in 0.2 seconds
Bytes per second: sent 17083.9, received 16149.7
debug1: Exit status 0
I'm trying make a deploy with capistrano:
cap deploy:setup
* 2013-04-05 00:10:19 executing `deploy:setup'
* executing "mkdir -p /home/hyperrjas/apps/myapp /home/hyperrjas/apps/myapp/releases /home/hyperrjas/apps/myapp/shared /home/hyperrjas/apps/myapp/shared/system /home/hyperrjas/apps/myapp/shared/log /home/hyperrjas/apps/myapp/shared/pids"
servers: ["REMOTESERVERIP"]
connection failed for: REMOTESERVERIP (Errno::ECONNREFUSED: Connection refused - connect(2))
I have changed real bitbucket ip by 111.111.111.111. Also I have added passphrase for security reasons on my remote server
Where have I the error?
As mentioned in the message, you don't have shell access to bitbucket via ssh. The only git commands are allowed.
The problem was in the port. If you change the ssh port on your remote server.
You should not forget that you have to specify the SSH port on your your recipe to deploy with capistrano. Beware of this because I've gone crazy for two hours and apparently everything was correct and can make you lose a lot of time.
You can tell to capistrano the ssh port of the remote server, adding this command to your deploy.rb file:
ssh_options[:port] = 11111 #replace your real ssh port instead 11111
Thank you very much.
Related
I tried to log in/deploy something to a Ubuntu server is my Rails app, but suddenly this morning I ma unable to log in there.
When I run the SSH ssh deployer#IP -p 420 and enter the password, I get a message that the password is incorrect and the message Permission denied, please try again.
When I try to deploy some code with Capistrano, I get:
connection failed for: IP (Net::SSH::AuthenticationFailed: deployer)
Password is, again, correct.
This issue occurred today, yesterday was everything working perfectly.
I double checked the Capistrano set up, but everything is correctly set up there.
How to inspect the issue? Where to start? It simply looks like today it stopped working.
EDIT:
ssh -v XXX.XXX.XXX.XX
OpenSSH_6.9p1, LibreSSL 2.1.7
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to XXX.XXX.XXX.XX [107.170.160.89] port 22.
debug1: connect to address XXX.XXX.XXX.XX port 22: Connection refused
ssh: connect to host XXX.XXX.XXX.XX port 22: Connection refused
EDIT2:
ssh adam$ ssh -v XXX.XXX.XXX.XX -p 420
OpenSSH_6.9p1, LibreSSL 2.1.7
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to XXX.XXX.XXX.XX [XXX.XXX.XXX.XX] port 420.
debug1: Connection established.
debug1: identity file /Users/adam/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/adam/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-3ubuntu1
debug1: match: OpenSSH_6.0p1 Debian-3ubuntu1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 107.170.160.89:420 as 'adam'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64#openssh.com none
debug1: kex: client->server aes128-ctr umac-64#openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:yaXBElIwQJJKsNcGAE8hlDPmD26DyzgZ9ruwtbhs6vo
debug1: Host '[XXX.XXX.XXX.XX]:420' is known and matches the RSA host key.
debug1: Found key in /Users/adam/.ssh/known_hosts:3
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/adam/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/adam/.ssh/id_dsa
debug1: Trying private key: /Users/adam/.ssh/id_ecdsa
debug1: Trying private key: /Users/adam/.ssh/id_ed25519
debug1: Next authentication method: password
deployer#XXX.XXX.XXX.XX's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
when I run ssh -v deployer#XXX.XXX.XXX.XX -p 420
Thank you.
debug1: Roaming not allowed by server
To start with an aside, you should disable roaming or upgrade your ssh client.
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/adam/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/adam/.ssh/id_dsa
debug1: Trying private key: /Users/adam/.ssh/id_ecdsa
debug1: Trying private key: /Users/adam/.ssh/id_ed25519
The above group of lines shows that your ssh client offered the key id_rsa to the server, but the server didn't accept it. The last three lines refer to default key filenames which ssh looks for, but didn't find in this case.
debug1: Next authentication method: password
deployer#XXX.XXX.XXX.XX's password:
debug1: Authentications that can continue: publickey,password
Then, your ssh client prompted you for a password and offered it to the server, but the server didn't accept it.
It's not possible to tell from the client trace why the server is suddenly refusing your key and password. There are probably at least half a dozen things that could cause this. To find out for sure, you'd have to get into the server and check the syslog logs for messages from sshd. These files are normally located in /var/log.
Offhand, here are some of the things that could be causing this:
The account which you're trying to log into has been locked by the administrator (or maybe the password expired).
The account which you're trying to log into doesn't exist; it's been removed, renamed, or you're misspelling it.
Someone with access to the account changed its password and altered the list of authorized keys.
IP addresses have changed, and you're not connecting to the computer which you think you are.
Hackers have gotten into the server and made any of a number of changes.
I've built a Rails app which I want to deploy on heroku. I can run the web application on my local machine.
When I type the command : git push heroku master I get the following error message:
git push heroku master
ssh: connect to host heruko.com port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
It seems to be an connection error. So I tried:
sh -v git#heroku.com
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to heroku.com [50.19.85.156] port 22.
debug1: Connection established.
debug1: identity file /Users/myname/.ssh/id_rsa type 1
debug1: identity file /Users/myname/.ssh/id_rsa-cert type -1
debug1: identity file /Users/myname/.ssh/id_dsa type -1
debug1: identity file /Users/myname/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version endosome
debug1: no match: endosome
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: RSA 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /Users/myname/.ssh/known_hosts:6
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
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: /Users/myname/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to heroku.com ([50.19.85.156]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = fr_FR.UTF-8
PTY allocation request failed on channel 0
shell request failed on channel 0
Here I can see the authentication is successful. I don't understand why I cannot push on heroku and deploy my application.
Here are remote :
git remote -v
heroku git#heruko.com:aqueous-plateau-17182.git (fetch)
heroku git#heruko.com:aqueous-plateau-17182.git (push)
origin git#bitbucket.org:pracede/hubapp.git (fetch)
origin git#bitbucket.org:pracede/hubapp.git (push)
Do you have an idea or a suggestion?
You have a typo in your git remotes:
git#heruko.com:aqueous-plateau-17182.git
It's heroku, not heruko :)
So i have tried everything i can find and im panicing so please help
When i do a fresh heroku create on my app it genirates fine
then i go to git push heroku master.
I get the error
Jacks-MacBook-Air:morph jacksharville$ git push heroku master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
i have tried clear the keys with heroku keys:clear
I have then tried running heroku keys:add
It still comes up with the same error.
if i run ssh -vT git#heroku.com
this is the output
Jacks-MacBook-Air:morph jacksharville$ ssh -vT git#heroku.com
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to heroku.com [50.19.85.154] port 22.
debug1: Connection established.
debug1: identity file /Users/jacksharville/.ssh/id_rsa type 1
debug1: identity file /Users/jacksharville/.ssh/id_rsa-cert type -1
debug1: identity file /Users/jacksharville/.ssh/id_dsa type -1
debug1: identity file /Users/jacksharville/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version endosome
debug1: no match: endosome
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: RSA 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /Users/jacksharville/.ssh/known_hosts:3
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
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: /Users/jacksharville/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to heroku.com ([194.168.4.123]:53).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
shell request failed on channel 0
What happens if you do heroku auth:login and then log in with your credentials?
Do you still get the same error?
There is no way to fix this easily. The way i ended up getting around it is creating a new app and dragging assets across.
I get an error when I run push heroku master:
The authenticity of host 'heroku.com (50.19.85.154)' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
fatal: The remote end hung up unexpectedly
When I run ssh -v git#heroku.com, I get
OpenSSH_5.9p1, OpenSSL 0.9.8y 5 Feb 2013
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to heroku.com [50.19.85.156] port 22.
debug1: Connection established.
debug1: identity file /Users/Sabir/.ssh/id_rsa type 1
debug1: identity file /Users/Sabir/.ssh/id_rsa-cert type -1
debug1: identity file /Users/Sabir/.ssh/id_dsa type -1
debug1: identity file /Users/Sabir/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version Twisted
debug1: no match: Twisted
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: RSA 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad
The authenticity of host 'heroku.com (50.19.85.156)' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
I haven't been able to solve the problem. Any idea?
Looks like your keys might be compromised in some way. Try re-adding them?
run this:
heroku keys:add ~/.ssh/id_rsa.pub
id_rsa.pub might have a different name on your machine. Check out your .ssh dir before running.
I've googled the heck out of this one, and it is still failing me.
ssh: Could not resolve hostname github: Name or service not known
fatal: The remote end hung up unexpectedly
Most of the problems with this seem to do with having the wrong keys being sent to the server,
which isn't the problem. I can SSH into github as stated in github's help pages. I did have this working fine before, but I had wiped out the repository, wiped out my keys, and started fresh.
Here is the output of ssh -v git#github.com:
OpenSSH_5.5p1 Debian-4ubuntu5, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /home/patrick/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/patrick/.ssh/id_rsa-cert type -1
debug1: identity file /home/patrick/.ssh/id_dsa type -1
debug1: identity file /home/patrick/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.5p1 Debian-4ubuntu5
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/patrick/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
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 public key: /home/patrick/.ssh/id_rsa
debug1: Remote: Forced command: gerve blueshift9
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Remote: Forced command: gerve blueshift9
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions#openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.utf8
PTY allocation request failed on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow#openssh.com reply 0
Hi! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Connection to github.com closed.
Transferred: sent 2648, received 2904 bytes, in 0.1 seconds
Bytes per second: sent 37663.4, received 41304.6
debug1: Exit status 1
Thanks!
what exactly are you doing to get this error? it suggests you're trying to connect to git#github, not git#github.com
ssh: Could not resolve hostname github: Name or service not known fatal: The remote end hung up unexpectedly
this means there is nothing wrong with your keys:
debug1: Authentication succeeded (publickey).
...
Hi! You've successfully authenticated, but GitHub does not provide shell access.