Friday, November 09, 2007

Ubuntu Tracker with SMB shares

If there is one thing that I've struggled with since I switched my desktop to Ubuntu, it is searching the system. I just don't get why I can't just Ctrl + F to search for files the way I did in windows.

So I've been using tracker, which is nice, except that I don't index my entire hard disk, because I don't want to drag it down that much. I only index my home folder. I've been wanting to index my samba shares on my freenas server, but I was having trouble doing it. So I figure this method out - it isn't necessarily pretty, or clever, or even really much of an idea, but it works for me.

First, setup the the smb share to mount on logon (these instructions came from here)

To start, I created the directory /media/NAS
(for my NAS server)

Next I created the file /.smbpasswd in my home folder:

"Create a file in your home directory named .smbpasswd (the period at the start of the filename makes it a hidden file). Modifify the permissions on the file so only you have permission to read and write to it. The only thing in the file is your Windows username and password. Here's the commands you would enter to create the credentials file:
echo username=mywindowsusername > .smbpasswd
echo password=mywindowspassword >> .smbpasswd
chmod 600 .smbpasswd
Substitute your Windows username and password in the commands. No one else except root would be able to read the contents of this file." (again from here)

Then, I set my smb share to be mounted on boot by adding the following line to my /etc/fstab file:

//nas/share /media/NAS smbfs credentials=/home/(USERNAME HERE)/.smbpasswd,uid=(USERNAME HERE),gid=users 0 0

Now, upon boot, "NAS" behaves like a hard disk attached to the system.

The second part is to get Tracker to index NAS. this is simple - go under the system menu, preferences menu, indexing preferences, choose the files tab, and add the /media/NAS locations you want indexed.

if you are getting CIFS errors on shutdown, see this.

No comments: