Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

A few days ago, SSH stopped working.

  1. Can someone help me get SSH to work (it used to)
  2. Help me understand the UNIX dev folder
  3. Are there any PUTTY like Mac clients.

When I try logging in with SSH I get the following message:

PTY allocation request failed on channel 0
stdin: is not a tty
fatal: unrecognized command ''
Connection to 74.52.61.194 closed.

Web searches have shown me that there might be something wrong with /dev/std/ folder.
But I have revealed hidden folders and cannot find the /dev/ folder (There is an alias to dev, but Mac claims it is a broken link) ditto when I search for it with other tools such as Houdini. I could cd into it though, so am confused what is up with this folder.

Are there any tools that can save my SSH preferences so that I don't have to, each time, type out the username@adrees, password, path all of which are long and complex?

Not looking for a Filezilla type client, there are many of those. Looking for a command line like putty, that lets me use bash on the remote client.

Am on Macbook Pro, latest version of Tiger.

EDIT: Have tried to SSH with -v, here is the output, if it can help a knowledgeable super user?

OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to 74.52.61.194 [74.52.61.194] port 22.
debug1: Connection established.
debug1: identity file /Users/me/.ssh/identity type -1
debug1: identity file /Users/me/.ssh/id_rsa type 1
debug1: identity file /Users/me/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
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 '74.52.61.194' is known and matches the RSA host key.
debug1: Found key in /Users/me/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
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,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/me/.ssh/identity
debug1: Offering public key: /Users/me/.ssh/id_rsa
debug1: Remote: Forced command: perl -e 'exec qw(git-shell -c), $ENV{SSH_ORIGINAL_COMMAND}'
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 277
debug1: read PEM private key done: type RSA
debug1: Remote: Forced command: perl -e 'exec qw(git-shell -c), $ENV{SSH_ORIGINAL_COMMAND}'
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: Entering interactive session.
PTY allocation request failed on channel 0
stdin: is not a tty
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
fatal: unrecognized command ''
debug1: channel 0: free: client-session, nchannels 1
Connection to 74.52.61.194 closed.
Transferred: sent 2448, received 2856 bytes, in 0.4 seconds
Bytes per second: sent 6027.2, received 7031.8
debug1: Exit status 0
share|improve this question
    
You cannot cd /dev/ in Terminal on Mac OS X? Really? –  Daniel Beck Jan 10 '11 at 21:01
    
No, I could. Hadn't tried. Now am truly confused. Tried now with Houdini, got an Applescript Error. Tried with the open files dialog of TextWrangler, it did not succeed either. So, totally confused, will update question to be clearer. –  SamGoody Jan 10 '11 at 22:36
    
As a matter of interest, have you tried connecting to more than one ssh host? –  Slomojo Jan 11 '11 at 1:22
    
If you know a bit of Unix, you also see no /bin, /etc, etc.. These are simply hidden. Press Cmd-Shift-. in open file dialogs to show hidden files and folders and mess up your system if you don't know what you're doing. –  Daniel Beck Jan 11 '11 at 6:03
add comment

2 Answers

up vote 3 down vote accepted

You should use the Terminal.app to do SSH, and for hosts that you regularly connect to, you create aliases and set up encryption keys so you can do faster logins.

To create an alias:

alias gohost='ssh [email protected]'

Of course, call the alias something useful to you, instead of gohost.

To create a ssh key, you do:

ssh-keygen

Then follow the prompts, accept defaults unless you know what you're doing. Leave the pass-phrase blank if you want password-less login, if you want to retain password login, just skip the ssh-keygen and use gohost to connect to your host.

The good thing about ssh keys, is that you can do scp (secure copy) and rsync over ssh, without having to re-enter your password all the time, of course you want to make sure your account on the Mac is secure, so that only you can use these keys, (they're linked to your account, and stored in the ~/.ssh folder.)

If you create a ssh-key you need to copy the public key to your home on server, so let's copy the public key to the clipboard.

cat ~/.ssh/id_rsa.pub | pbcopy

(pbcopy takes standard input and places it in the mac clipboard, pbpaste does the opposite, and sends the contents of the clipboard to standard output, but only text.)

Then connect to the ssh host, and then do:

cat >> ~/.ssh/authorized_keys

Paste the key from the clipboard, press Enter and Ctrl-D, exit from the host, and then try connecting again, if all has gone well, you'll just find yourself at the host prompt again, without needing a password.

Why isn't your ssh working?

Looking at your debug output there's a couple of things that aren't clear. First of all, it looks like your ssh installation is ok.

The error message also suggests that /dev/pty doesn't exist, check it does (not in Finder) ...

But this looks like it's a server error, have you tried ssh to another server?

Dev folder

If you can't do sudo ls /dev then something is badly wrong with your system.

To explain what /dev is, Unix (which OS X is built on top of) uses /dev to access devices, standard input, standard output, hard disks, cd/dvd drives, etc.

This allows Unix to access devices as part of the file system, to communicate with them.

In general use, you should leave the /dev folder alone, some GUI tools (Backup software for example, or in your case Houdini) will occasionally report some error or another about it, because it isn't a folder they will understand. (Ideally they should ignore it.)

share|improve this answer
    
Thanks. SSH from a Windows computer using Putty works fine, so I don't think its the server. I did sudo ls /dev, and it worked, thanks. And there is no dev/pty folder. Am I supposed to create it, and if so how? (sorry, noob here. But am learning quick). Also, where does it put the alias created by the above command? Cannot find it. –  SamGoody Jan 11 '11 at 23:32
    
Well, IF the /dev/pty device/folder is the problem, it would need to be mounted, so you could do mkdir /dev/pty, add it to fstab and then do mount -a (mounts everything in fstab). However, I think it's worth figuring out why this broke in the first place - I'd like to try this (I'm away from Mac's today, but can look in a few hours.) –  Slomojo Jan 11 '11 at 23:36
    
Have used sudo mkdir to make the folder, but it hasn't changed the errors at all. I guess something should go inside said folder? Thanks very much. EDIT: Oops didn't see your comment. OK, how do I go about figuring out whats wrong? –  SamGoody Jan 11 '11 at 23:37
    
You can try looking up fstab use on the Mac in the meantime. –  Slomojo Jan 11 '11 at 23:37
    
alias commands should be in your shell startup, if you use bash, ~/.bash_profile is the place to put them. Just edit/create it and put your aliases at the end. More info on alias here - ss64.com/bash/alias.html –  Slomojo Jan 11 '11 at 23:39
show 16 more comments

The following is what worked for me.
It is being written to help others who run into the same issue, but is not the "correct" answer, as I am pretty sure it should not have worked. Read the thread on slomojo's answer to get the whole rundown.

  1. Symptom: SSH on the Mac stopped working to my Site5 hosted server. I was able to SSH to other servers without an issue.
    Issue: SSH will automatically send any key(s) in the .ssh/id_rsa or .ssh/id_dsa files.
    When setting up GitHub accounts it is common to create these files.
    Site5 was getting and borking on the unrecognized GitHub keys.
    Solution: I moved the GitHub private key from .ssh/id_rsa to another file (eg .ssh/GitHub) and added a config file to direct SSH to that key. Once the GitHub key was not being pushed to the site5, everything worked.
    From a security standpoint this sounds like a big deal, as otherwise it would seem easy to have my keys stolen. (I don't understand SSH, so may be missing something obvious.)

  2. The dev folder had nothing to do with my issue, which was server side.
    Nonetheless, the dev folder is best explained here:
    http://www.mackb.com/Uwe/Forum.aspx/macintosh/3883/That-mysterious-dev-folder

  3. To create Aliases, Slomojo writes:

alias commands should be in your shell startup, if you use bash, ~/.bash_profile is the place to put them. Just edit/create it and put your aliases at the end. More info on alias here - ss64.com/bash/alias.html

Good luck all!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.