John Blade’s Homepage

One man on one island.

Archive for September, 2004

Symbolic links and Chroot

with 14 comments

Found this awesome little tip in the proftpd manual on how to work around symoblic links issues.

There are two types of links in Unix: hard and symbolic.

A hard link is a file that is, for all intents and purposes, the file to which it is linked. The difference between a hardlink and the linked file is one of placement in the filesystem. Editing the hardlink edits the linked file. One limitation of hard links is that linked files cannot reside on different filesystems. This means that if /var and /home are two different mount points in /etc/fstab (or /etc/vfstab), then a file in /var/tmp cannot be hardlinked with a file in /home:
> pwd
/var/tmp
> ln /home/tj/tmp/tmpfile tmplink
ln: cannot create hard link `tmplink’ to `/home/tj/tmp/tmpfile’: Invalid cross-device link

A symbolic link (also referred to as a “symlink”) is a file whose contents contain the name of the file to which the symbolic link points. For example:
lrwxrwxrwx 1 root root 11 Mar 2 2000 rmt -> /sbin/rmt

The file rmt contains the nine characters /sbin/rmt. The reason symbolic links fail when chroot(2) is used to change the position of the root (/)of the filesystem is that, once / is moved, the pointed-to file path changes. If, for example, if chroot(2) is used to change the filesystem root to /ftp, then the symlink above would be actually be pointing to /ftp/sbin/rmt. Chances that that link, if chroot(2) is used, now points to a path that does not exist. Symbolic links that point to nonexistent files are known as dangling symbolic links. Note that symbolic links to files underneath the new root, such as symlinks to a file in the same directory:
> pwd
/var/ftp
> ls -l
-rw-r–r– 1 root root 0 Jan 16 11:50 tmpfile
lrwxrwxrwx 1 root root 7 Jan 16 11:50 tmplink -> tmpfile

will be unaffected; only paths that point outside/above the new root will be affected.

Filesystem Tricks
When chroot is used symlinks that point outside the new root (the user’s home directory in this case) will not work. To get around this apparent limitation, it is possible on modern operating systems to mount directories at several locations in the filesystem.

To have an exact duplicate of the /var/ftp/incoming directory available in /home/bob/incoming and /home/dave/incoming, use one of these commands:

Linux
mount –bind /var/ftp/incoming /home/bob/incoming

Gets around the symbolic links issue.

Written by JB Hewitt

September 30th, 2004 at 11:37 am

Posted in Linux

Good bye Jessie…

with 25 comments

My dog left us today, born 1988 she lived a long and happy life of sixteen years. Her death was not unexpected at such an old age for a dog; she passed away quietly this morning at my grand parents house this morning where she lived a free life in the country jumping with kangaroo’s and exploring endless scents.

Jessie was a birthday gift for me, and she has been a true mate of mine since the first day we met.

jessie+me-intheday.jpg
Maybe I wasn’t quite ready for the responsibility of a dog of my own, but you couldn’t deny that as both of us grew we learnt a lot from each other. My family treated Jessie as more of a family member then as of a dog, maybe that’s why she thought she could get away with so much mischief.
In the city of Yeppoon we spent the early years together having fun and mucking about. She loved the beach and sprinting next to the waves and to skitch the seagulls.

jessie+me-sleeping.jpg
You could say Jessie was my only running partner. I used to race her in sprints to train for my high school competitions. She’d let me think I was winning to a point before sprinting ahead, probably because she hated to loose.

Even though she was a dog we communicated on many levels and had an understanding. I couldn’t help but think some times that Jessie had walked on this Earth before. She helped me explore the bush land of my grand parents and hunt wild animals. She was there when I was unhappy and made me glad. And she always had a special greeting in the morning to wake me up with a ‘helrooo’ growl as she ran around madly waiting for me to get up. There are so many good things to say about Jessie….

Her life was not without peril though; many many times she had her life almost taken away from her. Killer viruses, mauled by other dogs twice, being thrown out of speeding utes and other incidents, there is no doubt that she is the toughest of the tough to live through it all without affecting her sense of adventure.

Not to forget about the many ‘naughty’ things about her, like how one Christmas she jumped up on the dinner table when everyone was outside to see what exactly was going. There is no doubt she tried to be a part of the family as best she can and we love her so much.

jessie.jpg
I miss Jessie very much, my only regret is not being with her at the end. Every life ends eventually and I am glad that she passed away quickly. Good bye my puppy dog, you’re spirit may be gone but you will not be forgotten.

Written by JohnBlade

September 12th, 2004 at 11:59 pm

Posted in Diary

Mpeg-4 streaming in Java

with 18 comments

I found this awesome creation that is cooking along nicely. It’s a pure JAVA Mpeg4 streaming movie viewer. It allows you to view content without installing a plugin (other then having Java!) so your viewers don’t have to download any other programs/clients!

It’s seemless, it works, and it may soon well going opensource.

Read more here: theprecipice.org and check out the demo.

Written by JB Hewitt

September 11th, 2004 at 1:05 pm

Posted in General, Technical, Web

Expanda Foam Disaster

with 2 comments

My room mate Greg had some fun at work the other day. There was about 800ml left in the bucket as they walked out for smoko… Needless to say the expanda-foam expanded, with nice mushroom effect in the bucket. You can see the stress marks on the plastic as it pushed it’s way out…. I wouldn’t want to put a bucket of it in a car.

Image(010).jpg

Written by JohnBlade

September 3rd, 2004 at 12:14 pm

Posted in Diary