Cool things in Ubuntu

I've been playing with some cool stuff that's in Ubuntu: acl's and kio-slaves

ACLs are Access Control Lists, they can give finer control over access to your files than the normal permissions allow.

KIO-slaves are KDE-specific, but can still be useful to GNOME users at times. In particular there are some extra packages buried in the ubuntu repositories.

Read on for more Ubuntu goodness

*note* the packages mentioned might not be available for hoary, or they might require that the universe/multiverse repositories are enabled. I'm using breezy preview with universe/multiverse

ACLs

ACLs can give you more refined access control to your files. Under Ubuntu the ACL extensions are compiled into the kernel by default (for ext3, reiserfs, ...) Want to let the web server access your ~/public_html/ directory but don't want anyone else to access it? here's how...

Note: Please test this on a spare partition first! Using extra features in your filesystem can be a quick way to scramble your data...

Install the acl package

sudo apt-get install acl

Modify /etc/fstab, add the option 'acl' to the right line, like so:

/dev/hda6 /home ext3 rw,auto,acl 0 1

Remount the filesystem so the extra options take effect:

sudo mount /home -o remount

Now we're ready to change to the home directory and set access control lists:

# change to ~
cd

# make public_html if it doesn't exist
mkdir -p public_html

# ensure noone can read your public_html
chmod 700 public_html

# Allow the web server (which uses user www-data) to access the directory (-m means add permissions)
setfacl -m u:www-data:rx public_html

And that's it! now you and the www-data user can access public_html, noone else can! (except root, of course). Very useful on shared PCs.

Note: ACLs are specified in the POSIX standard, so this should work on other POSIX Unices that implement the ACL extension.

Update: This will only work for files in public_html, not for subdirectories. You could set the ACL for all subdirectories like this:

# Allow the web server to access the directory and all subdirectories
find public_html -type d -exec setfacl -m u:www-data:rx {} \;

kio-slaves

kio-slaves are the single biggest thing that keeps me on KDE. I will demonstrate by way of example:

I want to edit a php file that's on a remote ssh server, host.remote.com in my ~/public_html directory. I fire up quanta, File->Open, and in the dialog box enter

fish://username@host.remote.com


I enter my password (or KWallet will do it for me) and navigate to public_html on the remote server, and open the file that i want.

Now every time I hit save, my work is saved back to the file over SSH, without me worrying about where it went.

Not cool enough for you? Now I want to read my email but I'm too lazy to fire up my mail client:

pop3://username@mail.remote.com

Now I can read my mail in quanta! (admittedly quanta doesn't really know what to do with an email message, but you can still read it).

On to some cool kio-slaves that aren't part of the default install:

kio-locate

Install with:

sudo apt-get install kio-locate


Now logout of KDE and back in (or if you're in GNOME just close down KDE).

Type Alt+F2 -> konqueror
You will notice the familiar konqueror welcome page now has a 'locate' search bar in it. Type in a filename and you will get the results from the slocate database.

Alternatively you can type in the URI bar: locate:

The results are sorted by folders, to reduce the amount of crud displayed.

Want to edit finances.kmy from KMyMoney? I don't remember where I put it:
File->Open
In the Folders bar up the top:

locate:/finances


The file will appear and I no longer have to maintain a decent directory structure (only good filenames :)

kio-apt

This one is a front-end to apt. To install:

sudo apt-get install kio-apt


I'm browsing a webpage in konqueror and I read about this cool package called kio-locate.
Open up a new tab and type:

apt:/search?kio locate


I get a list of matches, I can click on any one to find out its install status. With the right packages installed (?) you can install packages directly from konqueror.

Next I hope to cover extended attributes.

Note on formatting: I was playing around with DIV tags in this blog - The blue boxes were made by surrounding sections of text with this:
<div style="padding:20px; border: #336699 1px solid; background-color:#99CCFF">
some text to be boxed
</div>

When using drupal, you will need to set the Input Format to Full HTML.

Cheers!

--

Darren