October 9th, 2008 cmsj
If you’re playing with the excellent new ChrootDirectory and internal-sftp options in recent OpenSSH releases (such as 5.1 which is in Ubuntu 8.10 Intrepid), you may have hit an error like:
fatal: bad ownership or modes for chroot directory
You may also have searched on Google for what to do about it and come away with very little useful information.
Well no more! I did the same thing and got bored of reading mailing list posts, so read the source code instead. The relevant section is in session.c:
if (stat(component, &st) != 0)
fatal("%s: stat(\"%s\"): %s", __func__,
component, strerror(errno));
if (st.st_uid != 0 || (st.st_mode & 022) != 0)
fatal("bad ownership or modes for chroot "
"directory %s\"%s\"",
cp == NULL ? "" : "component ", component);
This is quite simple really, it’s stat()ing the directory specified for “ChrootDirectory” and all its parents up to / and checking that they are:
- owned by root
- not group or other writable
- (it also checks they are actually directories, but I’m going to assume you’re not stupid enough to try and chroot into a file ;)
Note my emphesis that these checks apply to the chroot directory itself and its parents and /, so if you are chrooting users into /srv/chroot/ then you need to ensure that /, /srv and /srv/chroot are owned by root and not writable by the group (even if it’s root, bizarrely) or other users.
Sorted.
Posted in FOSS, Techie, Ubuntu | 10 Comments »
October 9th, 2008 cmsj
I have a laptop with some USB stuff built in. Some devices (such as Bluetooth) can be made to entirely disappear from the USB bus, however, the fingerprint reader and webcam can’t, but they sit on the USB bus and draw power.
Fortunately the USB specs allow devices to be put to sleep if they’re not being used and support that feature. Unfortunately many devices advertise they support it when they really don’t, so Linux is unable to automatically put every USB device to sleep.
Fortunately you can control the setting by hand, and this is how. Firstly, start off with a Terminal and run the command “lsusb”:
cmsj@kodachi:~$ lsusb
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 17ef:4807 Lenovo
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
cmsj@kodachi:~$
You can ignore the “root hub” entries, the interesting two are “SGS Thomson Microelectronics Fingerprint Reader” (guess which device that is ;), and “Lenovo” (this is the webcam).
So now we need to poke at those devices to enable their autosleeping. If we look at the entry for the webcam:
Bus 004 Device 002: ID 17ef:4807 Lenovo
I’ve highlighted “4807“. This is the Product value for this USB device (if you’re curious, the “17ef” part is the Vendor value and uniquely identifies the maker of this device).
Now we need to find out where abouts the webcam lives in the /sys/ filesystem (which is something the kernel provides to give applications lots of information about the hardware in your system).
The following command will put us on the right path:
grep 4807 /sys/devices/*/*/usb*/*/idProduct
Which, on my laptop, returns:
/sys/devices/pci0000:00/0000:00:1d.7/usb4/4-5/idProduct:4807
Take that information you get, and chop the “idProduct:4807” bit off the end, just leaving “/sys/devices/pci0000:00/0000:00:1d.7/usb4/4-5/” (yours will look a little different to this) and add “power/level” to the end.
You should now have something that looks pretty much like “/sys/devices/pci0000:00/0000:00:1d.7/usb4/4-5/power/level” and if you get the current setting:
cmsj@kodachi:~/Desktop$ cat /sys/devices/pci0000:00/0000:00:1d.7/usb4/4-5/power/level
on
cmsj@kodachi:~/Desktop$
you can see it is “on”, which means it will not be automatically put to sleep. To change that, run:
echo "auto" | sudo tee /sys/devices/pci0000:00/0000:00:1d.7/usb4/4-5/power/level
and test if your device still works (so if it’s a webcam, fire up “cheese“, or if it’s a fingerprint scanner that you use, test if it still accepts your finger). If everything is good then you can put something in /etc/rc.local so the power saving will be set up every time you reboot your computer:
echo "auto" > /sys/devices/pci0000:00/0000:00:1d.7/usb4/4-5/power/level
and that’s it! Repeat this for all the USB devices in your laptop and enjoy the power saving (run “powertop” about 10 minutes before you start doing this so it has time to get a good average of your power usage, then see how much difference this makes. It could be up to 0.5Watts per device). Note that this won’t work particularly well for external USB devices you plug in, becuase the /sys/ path won’t exist until you plug the device in, so you’d need to do the above steps every time you connect it.
Hopefully HAL will start whitelisting devices which can be suspended, but I don’t know of any work in this direction at the moment.
Posted in FOSS, Techie, Ubuntu | No Comments »
September 21st, 2008 cmsj
Head over to the Terminator Homepage to get the goodness that is version 0.11. Mostly just bugfixes this time, for things which hurt 0.10 users. Also present is support for X Session Management, although until we have proper profiling support, this is of limited use.
The source tarball is up, of course, and the Hardy/Intrepid PPAs should have packages by the time you read this.
Posted in FOSS, Techie, Terminator, Ubuntu | No Comments »
September 18th, 2008 cmsj
I just uploaded a script that I’ve been using and refining for some while, with help from a variety of people too numerous to mention.
Basically the deal is that when you ssh somewhere from inside a GNU Screen session, the screen’s title is set to the hostname you ssh’d to. Simple.
The page for the script is here
Posted in FOSS, Techie, Ubuntu | No Comments »
August 28th, 2008 cmsj
It’s been a week or so shy of two months since we pushed 0.9 out of the door and originally we planned on following up with a 0.9.1 release shortly after to clear up some bugs, but for a variety of not particularly good reasons this never happened.
Instead we’ve got a new release for you… 0.10.
It doesn’t have any shiny whizz-bang features like 0.9 had, but it does bring a bunch of bug fixes and the groundwork necessary for our 1.0 release.
As usual, head over to the homepage, or Launchpad to get the goodness.
Posted in FOSS, Techie, Terminator, Ubuntu | 3 Comments »
August 1st, 2008 cmsj
Update: It has been suggested that it is not productive or collaborative to talk negatively about some developers releasing software for unixy operating systems without really trying to integrate it with the versions of widely deployed software available in those operating systems.
It is a fair point. It’s not productive or collaborative. It may be true, but ranting about it doesn’t help anyone but me.
More productive and collaborative would be to nicely ask these ISVs to establish a less isolated packaging process with our communities and companies (but I don’t mean LSB or a new package format). Clearly some people won’t work with them on ethical grounds, but a more pragmatic position will accept that commercial software exists, so it might as well not make our lives unnecessarily hard. And the companies shifting Linux are hot on ISVs.
Jorge: No, I don’t like having multiple JVMs, but I have been in corporate situations before where it has been necessary because specific applications have required different versions :(
Posted in FOSS, Rant, Techie, Ubuntu | 1 Comment »
July 27th, 2008 cmsj
There’s no doubting that the iphone is a hugely capable machine. It’s powerful yet easy to use, but it’s not perfect. Here are some things which I think are missing:
* DAAP – it would be great to be able to play music via wifi since the thing is a bit low on storage.
* Background apps – I understand the huge problems implied by this, but certain apps could be blessed with the ability. Either that or the excellent last.fm client should be integrated with the iPod app. Not everything can be made a push app (the api for which isn’t even available yet)
* IMAP subscriptions – I have loads of mail folders I don’t want to see, which is dead easy in most mail clients, because of the ability to only subscribe to certain mailboxes. I would like to see this in the iPhone mail client.
* IMAP new mail checking – I don’t have all my new mail go to my inbox, some gets filtered to other folders an I would like to be able to tell the mail client to check these too.
Posted in Techie | No Comments »
July 27th, 2008 cmsj
Still liking this excellent toy. I have now had most of the commonly seen bugs, and a couple of crashes, which sucks, but my N95 was pretty unstable too, and not even slightly as nice!
Posted in Techie | 2 Comments »
July 26th, 2008 cmsj
I picked up an iPhone a couple of days ago, and other than having to replace it already because the button didn’t work properly, I really like it. I’m writing this from a wordpress app on it.
Mostly it means I have a decent web browser in my pocket. Rock.

Posted in Techie | 1 Comment »
July 7th, 2008 cmsj
It’s been far too long, but here it is. Terminator 0.9.
As usual, head over to the home page to get all the links and information you need.
“So what’s new in this release?” Well let’s have a little look at the ChangeLog:
* Tab support
* Drag & Drop support
* Added support for ~/.config/terminator/config
* Switch the meanings of “horizontal” and “vertical” wrt splitting,
after extensive user feedback. Added context menu icons to try and
make the meaning clearer.
* Added keybindings for terms size and scrollbar manipulation. Thanks
Emmanuel Bretelle.
* Completely revamped config system which now transparently makes use
of gconf settings if they are available, falls back to sensible
defaults if not, and can be overridden entirely by ~/.config/terminator/config
* Support terminal zooming – now you can quickly hide all terminals apart
from one and either scale the fontsize or not.
* New application icon from Cory Kontros
* FreeBSD support (thanks to Thomas Hurst)
and a whole heap of bug fixes. Rock on!
Posted in FOSS, Techie, Terminator, Ubuntu | 1 Comment »