Installing Samba on your pogoplug

I know there are a bunch of articles online about installing samba on Pogoplug (or openpogo enabled) devices. I read quite a few of them and still ran into trouble installing it on my appliance so I though I’d do a quick write-up of how I got things rolling.

First, you need to install the OpenPogo base package. Very detailed and effective directions are available here.  A couple of notes about OpenPogo before you go running off though. First, it requires an external USB drive to install on, and run from. Second, if you remove the USB drive (perhaps mistakenly thinking you were done with it) the filesystem that was on there is dismounted and everything running from it stops. And finally, the USB stick will have to be reformatted into a linux ext2 or ext3 format which means you’ll lose any existing data on it. Best to find an older 1GB stick and use that for this as the packages seem rather small.

Ok, so once you’ve installed the OpenPogo software onto your external USB drive, rebooted, mounted, etc, what you’ll need to do is run ipkg to install Samba. You should be able to execute this command to kick it off:

-bash-3.2# ipkg install samba2

This kicks off the download and installation process which I imagine under ideal circumstances should take care of the whole thing for you. If it did, skip this section and see the configuration part below. I’ll warn you though, the downloads were very slow for me, took about twenty minutes to download the seven meg file even though I was able to wget it to my linux box much faster.

The problem I had was an invalid MD5 checksum when using the automatic installer, so I resorted to manually downloading the file, then installing it.

-bash-3.2# cd /root
-bash-3.2# mount -o rw,remount /
-bash-3.2# ipkg download samba2
-bash-3.2# ipkg install samba2_2.2.12-2_arm.ipk

Once the install has completed successfully, you should turn on the server by running this command:

-bash-3.2# /opt/etc/init.d/S80samba start

After which you can verify that the server is running by checking the output of netstat

-bash-3.2# netstat -an | grep ":13[7-9]"
tcp 0 0* LISTEN
udp 0 0*
udp 0 0*
udp 0 0*
udp 0 0*
udp 0 0*
udp 0 0*

Now to verify that samba is working properly, execute this smbclient command:

-bash-3.2# smbclient -L localhost -N
added interface ip= bcast= nmask=
added interface ip= bcast= nmask=
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 2.2.12]

The output is a bit more verbose if you have shares active, and other active workgroups, so I snipped them out of this example. Now we need users! Execute these commands to create a user account on the system:

-bash-3.2# adduser -H User1
-bash-3.2# adduser -H User2

Now run these commands to setup a samba user:

-bash-3.2# smbpasswd -a User1
-bash-3.2# smbpasswd -a User2

Now comes the part of defining the drive mappings. There are a couple of ways to map things out, you can separate each physical disk into a share, or share all disks under one. Just depends on what your requirements are.

For the first method, separating each disk into it’s own share, this is what you need to know:

By default, the external USB drives are mounted in /tmp/.cemnt/sdX1 where X is usually ‘a’ for the first disk, ‘b’ for the second disk, etc. You can look to see how yours are mounted by running the df command:

-bash-3.2# df -h
Filesystem Size Used Available Use% Mounted on
/dev/mtdblock2 32.0M 18.6M 13.4M 58% /
none 125.0M 8.0k 125.0M 0% /tmp
/dev/sdd1 944.6M 57.8M 838.8M 6% /tmp/mnt_opt
/tmp/.cemnt/sda1 465.6G 365.0G 100.7G 78% /tmp/.cemnt/mnt_sda1
/tmp/.cemnt/sdb1 74.5G 53.5G 21.1G 72% /tmp/.cemnt/mnt_sdb1
/tmp/.cemnt/sdc1 149.0G 75.3G 73.7G 51% /tmp/.cemnt/mnt_sdc1
/tmp/.cemnt/sdd1 944.6M 57.8M 838.8M 6% /tmp/.cemnt/mnt_sdd1

As you can see above, we have four external USB drives mounted. /dev/sdd1 is the external USB thumb drive that OpenPogo is installed on, and mounted to the /opt directory. sda1, sdb1 and sdc1 are all external USB drives with user data on them. Make a note of which disk is which, you should be able to tell by the disk size, or at least content.

Next we need to modify the samba configuration file. It should be located in /opt/etc/samba/smb.conf. Using a text editor such as vi or nano, edit this file and add the following text — this part is the global configuration:

#smb.conf begin
# Global Parameters
workgroup = WORKGROUP
netbios name = Samba
log file = /opt/var/log/samba/log.%m
null passwords = yes
guest account = root
security = share
max log size = 50
encrypt passwords = yes

NOTE: If you’re connecting to these shares from a Windows machine, you may need to set encrypt passwords = no in the above example. I’ve seen mixed results for that.

Now, if you chose to define each drive as it’s own share, you could add something like this to the config file. The text within the [] brackets is the name of the share:

path = /tmp/.cemnt/mnt_sda1/
browseable = yes
available = yes
public = yes
writable = yes
printable = no
create mask = 0777
guest ok = yes
browseable = yes

The path - /tmp/.cemnt/mnt_sda1/ is the path to the first external drive. Keep in mind that this configuration has NO SECURITY other than that of your local area network. If you need per user security you will need to modify these directives.

Now, your other option is to share out ALL external disks under on mapping. To do this, use this configuration:

comment = Pogoplug USB disks
path = /tmp/.cemnt
available = yes
public = yes
writable = yes
printable = no
create mask = 0777
guest ok = yes
browseable = yes

Keep in mind that this configuration has NO SECURITY other than that of your local area network. If you need per user security you will need to modify these directives.

Anytime that the samba configuration file has been modified, you must restart the service for the changes to take effect. Do that with a restart command:

-bash-3.2# /opt/etc/init.d/S80samba restart
Stopping smbd:
Stopping nmbd:
Starting smbd:
Starting nmbd:

Now that you’ve completed the configuration and restarted the service you should be able to connect to your pogoplug device directly, upload, download, delete and modify files. I must stress again that this is a very OPEN configuration for samba. If you require additional security for the shares (like on a corporate network) then you should really know more about samba configuration. If anyone wants to post some examples of securing the directories/disks using the accounts created in the beginning please do — I’m no samba expert.

Happy Networking!

Leave a reply below!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s