Getting around "su : must be run from a terminal"

I killed the sshd daemon from one of our servers by accident today. I wanted to avoid going to the data center, so I was able to upload and run a PHP script to give me a shell..

Problem was, that it would run under the www-data user and trying to su to root gave me the following message:

  1. su : must be run from a terminal

After some googling, I found the solution from Tero's glob. If you have python installed, just run the following from your shell:

  1. echo "import pty; pty.spawn('/bin/bash')" > /tmp/asdf.py
  2. python /tmp/asdf.py

You now have a proper terminal, and things like 'su' will work as usual.

OS/X terminal settings for linux programmers

Updating the keybindings again for the terminal did the track. I now have working home, end, page-up and page-down keys.

If you don't feel like messing around with the settings, you can download my settings here:

Evert.terminal

It also makes it black on white, and a bit of transparency; if you don't like that, you can always put that back to normal. The old behaviour of the mentioned keys can be used by pressing shift along with the key.

Leopard first impressions and problems

I don't want to sound like I'm complaining too much, because I actually really like the new version of os/x. I wanted to cover a bunch of problems so people might know its not just them.

First, my personal favourite improvements.

The terminal

I'm especially happy that some time was spent improving the terminal application. Half my day I spend in that application, and any small improvement is welcome there. The most important being tabs (yessss) and an always running ssh-agent (which integrates with the keychain).

I ran across a bunch of problems as well ..

Flash upload stops working

Since we deal at FileMobile a lot with uploads of large/huge files.. we use a Flash uploader. It completely stopped working in leopard and from what I hear an update of the flashplayer is in the works.

Windows magically disappear using spaces

Spaces is a nice tool and i feel like it could help productivity.. but when you're switching between a few spaces sometimes windows get completely lost and the applications need a restart to re-appear.

Terminal won't change the background color

I'm fairly sure this has to do with the fact that I used a background image for my terminal in tiger; which is a feature that has been removed in leopard. I really dislike the default black-on-white, but I couldn't change my background color anymore. The solution for this was to simply remove:

  1. Library/Preferences/com.apple.Terminal.plist

From my home directory.

My key-bindings for page-up and page-down are lost in the Terminal.

I haven't felt like trying this yet, but I assume I simply have to follow my previous steps, if not.. I'll post about it later..

Airport up and down

Not sure if this is the OS or the airport, but its been shaky.. Hope this gets improved with an update of some sort.

I fixed home and end on OS/X terminal!

Wow, thats a relieve.. I switched to os/x 4 months ago, and everything is just great..

I must say, I needed a little bit time too get used to most of the things shiflet mentions. But after a few weeks, most of the annoyances he mentions are actually quite intuitive. Except not being able to tab to comboboxes, that is!

My biggest issue has been not being able to use 'end' and 'home' as usual.. especially when your ssh-ing into a linux box (I spend at least 75% of time on a given day on remote linux boxes) this is really annoying..

I actually got used to that after a while.. But now! I found the solution to this problem; and it can be found right here.

Next goal: getting page-up/page-down to work in a remote vim window as expected.

 1

About

My name is Evert, and I've been writing semi-regularly on this blog since 2006.

I'm currently available for contract work.

more info.

Subscribe

Dropbox

Dropbox is a simple cross-platform online backup and sync application. The first 2GB of space is free, and both you and me get an extra 250MB extra space if you sign up through this link.