eyeball scripts

June 26, 2010 — eyeball scripts
On the #linode channel at irc.oftc.net; you heard it here first…


[09:01am] Tiven: i mean, it happened few days ago with like just 2 users browsing gallery3
[09:01am] gmcharlt left the chat room. (Quit: This computer has gone to sleep)
[09:01am] ssteinerX: does php-cgi limit process ram via php.ini as it does in apache?  should...
[09:01am] Tiven: i have no idea
[09:01am] ssteinerX: sounds like something's getting confused and not being squelched by the ram collar
[09:02am] ssteinerX: was it one process, or a whole bunch
[09:02am] Tiven: its always all of the processes
[09:02am] Tiven: like, 4 children so 4 processes or something
[09:02am] Tiven: each one of them taking a big chunk of memory leading to swap in no time
[09:02am] ssteinerX: that sounds like a flat-out bug to me, but PHP's memory management has never been "stellar"
[09:03am] ssteinerX: are you watching it and restarting php-cgi, or just praying 'till it goes back down, or what?
[09:03am] Tiven: lol
[09:03am] mikegrb: lolz
[09:03am] Tiven: yeah i keep watching it now and then and restarting it
[09:04am] ssteinerX: script handy?
[09:04am] Tiven: otherwise if it goes few days and its going "good", i will later notice it when small stuff will be really slow on the server

[09:04am] ssteinerX: or is this an eyeball script ;-)

[09:04am] Tiven: like, even ssh responsiveness, even mumble lags, etc
[09:04am] Tiven: nah eyeball ^^
[09:04am] ssteinerX: i'll share if I run into the same thing -- too much stuff running for eyeball scripts
[09:04am] Tiven: hehe thanks
[09:05am] cmayo joined the chat room.
[09:05am] ssteinerX: too much eyeball scripts give me a headache, but I haven't tried setting the process limit higher...
[09:06am] snubby: heh @ ssteinerX
[09:06am] snubby: eyeball scripts eh
[09:06am] ssteinerX: snubby: proud to say I just made that up
[09:06am] ssteinerX: i should tweet it or something so i get credit

SSH works, SFTP doesn’t on Ubuntu 10.04

So…

I’m setting up one of my new VPSes (Linode Rocks!) and I was having a weird thing where I could ssh in with root, but not sftp. Other users could do both just fine.

The connection would be made, I tried the usual ssh -vvv type things to get the debugging info, but it looked like the connection was just fine.

Finally, after digging around for a couple of hours and trying every configuration change I (and all the nice people on #linode) could think of, I found this:

OpenSSH FAQ (Frequently asked questions)

2.9 – sftp/scp fails at connection, but ssh is OK.

sftp and/or scp may fail at connection time if you have shell initialization (.profile, .bashrc, .cshrc, etc) which produces output for non-interactive sessions. This output confuses the sftp/scp client. You can verify if your shell is doing this by executing:

ssh yourhost /usr/bin/true

If the above command produces any output, then you need to modify your shell initialization.

I had just added some things to my .bashrc, like, for example:

	bind '"\e[A":history-search-backward'
	bind '"\e[B":history-search-forward'

A quick call to:

	# ssh root@myhost /usr/bin/true

confirmed that those two commands were failing in an SFTP session like so:

	# ssh root@myhost /usr/bin/true
	/root/.bashrc: line 18: bind: warning: line editing not enabled
	/root/.bashrc: line 19: bind: warning: line editing not enabled
	bash: /usr/bin/true: No such file or directory

I couldn’t remember which was which (.bash vs. .bash_profile) so a quick Google search turned up this post.

I moved those two statements to .bash_profile, and sftp now works just fine…

Well, that was fun…