While at work I had a client call who was unable to SSH to their SunOS server (5.10 Generic_147440-23 sun4v sparc sun4v).

I try to Putty to username@10.10.10.10:

|-----------------------------------------------------------------|
| This system is for the use of authorized users only.            |
| Etc, etc, not for you				                  |
|-----------------------------------------------------------------|

Using keyboard-interactive authentication.
Password:
Server refused to allocate pty

Crap, no shell. Using WinSCP I can connect and see there is 0KB free in /. There are also no files owned by my username and no world WRX files anywhere to rm (nothing, not even a tmp file on that mount!)

Neither myself nor anyone else around (it was after hours) could locate the console to this machine to try logging in there (which I am not sure would have made a differance) so that option is out. I installed Cygwin on my Windows work desktop to get a real SSH client so I could try sending commands to the server to be executed, which worked. No other users were logged in so the error was not to do with any ssh limits.

After a little googling I found I could:

localuser@desktopPC ~
$ ssh username@10.10.10.10 "echo 'mahsudopassword' | sudo -S id"

Password:
uid=0(root) gid=0(root)
Password:

Ah, sudo will accept a password from standard input with -S flag meaning that I can now remotely execute commands as root.

localuser@desktopPC ~
$ ssh username@10.10.10.10 "echo 'mahsudopassword' | sudo -S find /var/ -size +20240k -exec ls -l {} \;"

After backing up the file below I then:

localuser@desktopPC ~
$  ssh username@10.10.10.10 "echo 'mahsudopassword' | sudo -S rm /var/tmp/some-big-random.tar"

And after that shell access with SSH was restored :)

Don’t let your Unix boxes run out of space, parition properly and setup alerting!