Ruby on Rails at June's AgileNorth meetup

Tonight was June's AgileNorth meetup and the topic was Ruby on Rails. It was hosted by David Draper who did an excellent job of introducing Rails in an easy to digest way even though he has very little Rails experience himself. Just shows what a good trainer can do!

He demo'ed a shortened version of Curt Hibbs's Recipe Cookbook tutorial using the RadRails plugin for Eclipse as his IDE. David started by creating the database in mysql (note: just the database - no tables) and then used RadRails to create the initial 'cookbook' application environment. He used the 'migration' feature of rails to create the database tables which were auto-generated by ruby code - this was one feature of rails that I was not aware of and was particularly impressive (for me at least!).

A great Ruby on Rails bookHe used the scaffolding tools of rails to auto-generate the recipe & category models, the cookbook and category controllers and all the associated views. All of this was done in little steps so that he could show the changes that were made to the code at each stage. I lot of this I had seen before as I ran through the 'Four Days on Rails' last Christmas but it was a nice refresher on the power of Rails.

Following David's walk-through we had a thirty minute discussion around the benefits of Rails and how to introduce Rails to systems with an existing database structure - could it be used to map onto this schema rather than creating a Rails-friendly one from scratch?

I really enjoyed this evening's talk, David did an excellent job if giving a brief overview of how to get kick-started with Rails, and it has re-energised me to think about how I can introduce it in some aspect at work.

Note: I've tagged quite a few of the items discussed with the 'agilenorth' tag over on

Technorati Tags: , , , ,

Solving Ubuntu permission problems when mounting a Windows SAMBA drive

After using Ubuntu desktop for a while I decided that a backup of my files would be a good idea and so went about attempting to mount and copy a whole host of files.

I attempted to mount the SAMBA drive running on my Windows fileserver as myself:
smbmount //backups/andrew.beacock shares/backups -o username=andrew.beacock,password=********
but was told that I didn't have permission to, only root can mount to SAMBA drives. So I popped the word 'sudo' in front of the command and tried again. This time it connected successfully and I was able to browse around the shared directories.

I then attempted to use rsync to back up my important folders but ran into problems again. It complained that I didn't have permission to delete files off my share, so again I popped the sudo command in front of the rsync command and thought it was me being stupid.

I then ran into a really strange problem where even though I was running as root and the files on the server were owned by root I didn't have permission to delete some of the files and directories!

After wiping the problem files from the fileserver as root (the problem was due to the share being mounted as root rather than as me), I was advised to set the 's bit' of smbmount and trying again. I did that and Ubuntu just complained that smbmount was not allowed to run with the 's bit' set!

So I went off to Google and found the answer on the forum.

Although smbmount cannot be setuid root, smbmnt (a program used by smbmount) can. This means that you can run smbmount as your own user and it will setuid to root when connecting to the SAMBA mount point.

Here's what I did to get it all working:

Change the permissions of /usr/bin/smbmnt to be setuid root:
cd /usr/bin
sudo chmod u+s smbmnt

Check that the s bit is set:
abeacock@ab100:/usr/bin$ ls -l smb*
-rwxr-xr-x 1 root root 1588348 2006-05-17 11:05 smbcacls
-rwxr-xr-x 1 root root 775340 2006-05-17 11:05 smbclient
-rwxr-xr-x 1 root root 512332 2006-05-17 11:04 smbcontrol
-rwxr-xr-x 1 root root 1493884 2006-05-17 11:05 smbcquotas
-rwxr-xr-x 1 root root 1551224 2006-05-17 11:05 smbget
-rwsr-xr-x 1 root root 8488 2006-05-17 11:05 smbmnt
-rwxr-xr-x 1 root root 709888 2006-05-17 11:05 smbmount
-rwxr-xr-x 1 root root 1500284 2006-05-17 11:05 smbpasswd
-rwxr-xr-x 1 root root 700872 2006-05-17 11:05 smbspool
-rwxr-xr-x 1 root root 498860 2006-05-17 11:04 smbstatus
-rwxr-xr-x 1 root root 4896 2006-05-17 11:04 smbtar
-rwxr-xr-x 1 root root 705704 2006-05-17 11:05 smbtree
-rwxr-xr-x 1 root root 6108 2006-05-17 11:05 smbumount

Mount the Windows SAMBA share as yourself (no sudo required):
smbmount //backups/andrew.beacock shares/backups -o username=andrew.beacock,password=********

You can now copy files over as yourself and all the permissions remain correct!

Technorati Tags: , , , , , , , ,