I have, temporarily, two workstations at work, a laptop and a desktop. Since I’m not sure yet if what to do with the desktop one, I’m temporarily using both. The problem with that is my files are scattered on these two stations as I continually use it both – the reason why I have to find a way to sync my files somehow…
This is the plan that I came up with:
in the laptop
- create a shared folder with authentication
in the desktop
- mount the shared folder (this should be easy to do, no mounting using mount command)
- run an app that automatically syncs the folders
Both stations are running Ubuntu 9.10, by the way.
Creating the shared folder using Samba
I use Samba in sharing files and I know it supports authentication. Just run this command to install Samba,
sudo apt-get install samba
I did a little googling to enable authentication and it led me to this site. It’s a pretty straight forward tutorial. Just execute how-to-add-a-user step and how-to-enable-the-share-step.
Following the tutorial, I registered my user name in Samba using smbpasswd and I added these lines in laptop’s /etc/samba/smb.conf
path = /home/pro
read only = no
force user = pro
I restarted the samba daemon after that:
pro@ops-laptop:~$ sudo /etc/init.d/samba restart
* Stopping Samba daemons [ OK ]
* Starting Samba daemons [ OK ]
Mounting the share
To verify that the laptop’s shared folder is really shared, I ran nautilus in the desktop and pointed it to laptop’s samba share:
Double-clicking on the shared folder will open an authentication window, I supplied the user name and password and selected the “Remember forever” option. In this way, I don’t have to type the credentials again every time I mount the shared folder.
Note: If you want to look up the user name/password that you’ve saved, go to Applications -> Accessories -> Passwords and Encryption Keys
To mount the shared folder easily and give other applications access to it, I added this line to the desktop’s /etc/fstab
# my home in ops-laptop
//192.168.0.153/pros-home /media/remote_home cifs credentials=/home/pro/configs/smb_credential,user,noauto,gid=pro,uid=pro 0 0
UPDATE: You need to have the smbfs package installed to mount SMB/CIFS shares, you can install it by running this command, (thanks to MRivera for bringing this up),
sudo apt-get install smbfs
I created a credentials file that contains the user name and password.
pro@pro-desktop:~$ cat /home/pro/configs/smb_credential
I set the permissions also in such a way that it’s not readable by other logged-in users.
pro@pro-desktop:~$ ls -lh /home/pro/configs/smb_credential
-rw——- 1 pro pro 45 2009-10-30 20:22 /home/pro/configs/smb_credential
I also made sure that the mount point does exists and it’s owned by me.
pro@pro-desktop:~$ ls -lh /media/ | grep remote
drwxr-xr-x 42 pro pro 0 2009-11-04 15:05 remote_home
Once the /etc/fstab is configured properly, I can now mount/unmount the shared folder using nautilus. All I have to do now is just click on remote_home to mount it, then click the “eject” icon to unmont it =)
Sync folders using Conduit
Conduit is fairly new application, it’s still in development stage. One thing that I like about it is it’s easy to use. I won’t discuss how exactly I configured it here, you can read the manual online. The example is pretty straight forward.
It’s included in Ubuntu 9.10’s repository, to install it just run:
sudo apt-get install conduit
Here’s a screenshot of my setup in conduit.
For instance, I want to sync my Tomboy notes so I keep these two folders in-sync:
/home/pro/.tomboy <—> /media/remote_home/.tomboy/
So, that’s it. This the set-up that I’m using right now. So far, things are going well =)