When I want to tướng connect to tướng my server lượt thích this
ssh -a [email protected] -p 22
it gives bủ two error messages:
PTY allocation request failed on channel 0
shell request failed on channel 0
When I use the parameter -T
the first error message goes away.
But how to tướng fix the second one?
I can't connect. To other servers I can connect without any problems.
I'm on MAC OS 10.9.
The parameter -v
shows bủ this debug output:
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 tướng xxx.your-server.de [188.40.3.15] port 22.
debug1: Connection established.
debug1: identity tệp tin /Users/xxx/.ssh/id_rsa type -1
debug1: identity tệp tin /Users/xxx/.ssh/id_rsa-cert type -1
debug1: identity tệp tin /Users/xxx/.ssh/id_dsa type -1
debug1: identity tệp tin /Users/xxx/.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 mod_sftp/0.9.8
debug1: no match: mod_sftp/0.9.8
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 55:f5:ca:ca:01:45:0f:7b:71:0a:1f:ba:9e:25:17:fb
debug1: Host 'xxx.your-server.de' is known and matches the RSA host key.
debug1: Found key in /Users/xxx/.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,password
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/xxx/.ssh/id_rsa
debug1: Trying private key: /Users/xxx/.ssh/id_dsa
debug1: Next authentication method: password
After I enter the password, I get this:
debug1: Authentication succeeded (password).
Authenticated to tướng xxx.your-server.de ([xxx.xxx.3.15]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = de_DE.UTF-8
shell request failed on channel 0
publicdomain
1,7224 gold badges23 silver badges39 bronze badges
asked Nov 19, năm trước at 16:15
user1895268user1895268
1,6793 gold badges14 silver badges24 bronze badges
6
PTY allocation request failed on channel 0
There is a limit of 256 pseudo terminals on a system. Maybe you have an application that is leaking pseudo terminals. Use
lsof /dev/pts/*
to see what processes have open pseudo-terminals
shell request failed on channel 0
I was getting this error (without PTY allocation error). It turns out that one of my applications (QtCreator 3.0.?) was leaking Zombie processes. Other users were able to tướng log in ví I might have been hitting my per user process quota (if there is such a thing). I've updated to tướng QtCreator 3.3. So far ví good.
answered Jan 23, năm ngoái at 18:55
vharronvharron
1,19711 silver badges20 bronze badges
3
I had the exact same error trying to tướng connect via ssh to tướng my server. As I can see you're using a server provided by Hetzner connecting to tướng it on port 22:
debug1: Connecting to tướng xxx.your-server.de [188.40.3.15] port 22.
The offical wiki/documention from Hetzner says:
Protocol for encrypted remote diagnostics for servers/computers(consoles). The SSH port to tướng be used is 222.
So you have to tướng connect via port 222:
ssh -p 222 [email protected]
answered Jan 1, 2018 at 14:37
ThreeCheeseHighThreeCheeseHigh
1,4985 gold badges24 silver badges41 bronze badges
3
shell request failed on channel 0
mean you don't have shell or remote commands access, fix your user permission on server to tướng have shell access or if you just want tunneling use -N
and -T
options
answered Jul 31, 2018 at 10:19
ewwinkewwink
19.1k2 gold badges48 silver badges56 bronze badges
3
I solved a similar problem with one of our users who was used only for ssh port forwarding ví he don't need to tướng have access to tướng PTY and it was prohibited in .ssh/authorized_keys file:
no-pty ssh-rsa AAA...nUB9 someuser
So when you tried to tướng log in to tướng this user, only message
PTY allocation request failed on channel 0
was returned. So kiểm tra your user's authorized_keys tệp tin.
answered Feb 7, 2017 at 11:48
1
Try this:
vi /etc/security/limits.d/20-nproc.conf
* soft nproc 4096 # change to tướng 65535
root soft nproc unlimited
answered Aug 2, 2018 at 3:59
xmduhanxmduhan
1,01513 silver badges14 bronze badges
1
Just add these lines to tướng your /etc/mtab
and /etc/fstab
, and reboot the system.
none /dev/pts devpts defaults 0 0
Rudie
53.7k42 gold badges134 silver badges175 bronze badges
answered May 12, năm ngoái at 12:41
6
It's an old question, but if someone gets here lượt thích bủ...
This might be result of a wrong date in the server. If you are working with an embedded system this might be the cause... So kiểm tra your date:
$ date
answered Jul 12, 2018 at 18:42
just found out, what was the problem in my case (provider strato): I had the same problem with output "shell request failed on channel 0" in the over.
I have to tướng use the master password with the web-domain name as login. (In German www.wunschname.de, where wunschname is your web-address.)
A ssh login with sftp-user names and the corresponding passwords is without success. (Although scp and sftp works with these sftp users!)
answered Mar 17, 2019 at 9:54
feli_xfeli_x
1661 silver badge8 bronze badges
If you come to tướng this Q&A for sftp
while ssh
is working, and you are getting:
subsystem request failed on channel 0
make sure /etc/ssh/sshd_config
contains the following line(s):
# override mặc định of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server
They are there by mặc định, but might have been removed for hardening purposes.
answered Apr 7, 2022 at 9:51
stackprotectorstackprotector
13.2k5 gold badges59 silver badges86 bronze badges
I also faced the same issue. Just restarting my servers solved the issue.
answered Jun 7, 2019 at 7:32
Vivek GargVivek Garg
2,3351 gold badge21 silver badges17 bronze badges
In my case, my sshd_config contained the value
PermitTTY No
I have to tướng change this to
PermitTTY yes
To log in, I used ssh user@address /bin/bash -i
This gives bủ a shell without PTY. I then used sed to tướng edit the file:
sed -e '/PermitTTY.*/PermitTTY yes/' < /etc/ssh/sshd_config > sshd_new
Then
sudo -S cp sshd_new /etc/ssh/sshd_config
answered Aug 29, 2022 at 20:58
DAmannDAmann
1947 bronze badges
rebooting the instance from AWS console worked for bủ. There was a service that was leaking tệp tin connections that lsof
helped find.
answered Jan 15, 2018 at 6:09
This is what which helped bủ from the various answers provided.
- Try logging in as root, that will get you in most of the times
- Try logging in as a different user, it successful, it means that the problem is with a specific tài khoản và it implies that there are some process(es) already started by the problematic tài khoản which are consuming resources preventing login(most likely no of processes)
- Increase the limit in /etc/security/limits.d/20-nproc.conf as mentioned by xmduhan above
- Try to tướng ssh again, it should work
answered Apr 17, 2020 at 0:33
AejazAejaz
1108 bronze badges
I encountered this error while using my git bash. I was able to tướng solve this by re-installing git for windows. More details in this answer.
answered May 22, 2019 at 20:48
user3885927user3885927
3,5032 gold badges28 silver badges44 bronze badges
This was happening when I was trying to tướng use sudo on ssh -t [email protected]
after adding my local user's public key to tướng github
Just a head's up to tướng the google happy people lượt thích me
answered Oct 28, 2019 at 13:52
JonJon
2,1085 gold badges25 silver badges51 bronze badges
1
Just rebooting a AWS instance works for bủ to tướng clear the error shell request failed on channel 0
answered Mar 27, 2020 at 12:03
remounting /dev/pts works for bủ. you can vì thế this remotely via ssh if you lập cập ssh lượt thích this against the affected machine. ssh doesn't request a tty when running commands lượt thích this and therefore this will allow you to tướng remount /dev/pts remotely
ssh user@host -- 'mount -o remount,rw /dev/pts'
answered Feb 15, 2019 at 14:58
1
I occasionally see this when spinning up a VM. Our automation system starts applying updates, ví depending on timing can hit an update to tướng critical packages.
Upshot - this might happen if ssh or other related packages are being updated on the destination machine.
answered May 8, 2019 at 2:36
CriggieCriggie
2737 silver badges15 bronze badges
Should a person find themselves reading this QA while they are trying to tướng ssh
into a NetGear ReadyNAS device, be sure that the "rsync only" checkbox is unchecked in the dialog box for the ssh service in the admin interface.
answered Sep 26, 2019 at 18:03
Krista KKrista K
21.8k3 gold badges33 silver badges44 bronze badges
As you already found the -T flag that create a PTY, I will just respond to tướng the second part:
shell request failed on channel 0
You should pass a command:
ssh [email protected] -p 22 help
After reading back the manual here: https://www.jenkins.io/doc/book/managing/cli/, I find it not really clear that it would not work without a command. But as stated by @U.V., the ssh interface is not a console interface, rather a connection utility. So you need to tướng pass a command...
If someone from the "jenkins" team pass accross this post, it would be great that if we pass no command, the help would show up :-)
answered Feb 24, 2021 at 14:27
jehonjehon
1,61818 silver badges27 bronze badges
try with option -NT
ssh -NT ...
answered Sep 26, 2020 at 16:42
3