Categories
PC Nerding

A passwordless NAS using a Rapsberry Pi and Samba 4

Being paranoid about my data, I find it’s always cool to have one more backup device on my LAN. I had a spare 2TB powered USB hard disk and a spare Raspberry PI. So, while I made one for myself, I wrote this guide. Today I want to show you how to get a fully working NAS using Samba, using a passwordless configuration that will allow all your pc to access it without prompts.
IMPORTANT NOTE: being passwordless means that ANYONE on your LAN can access this device. Don’t do such things on shared LANs and make sure your firewall does not allow incoming connections through TCP ports 139 and 445. If you don’t think your network is safe, don’t follow this guide.

I will be using Raspian image (on a 4GB card) for this particular guide because raspi-config utility makes a first steps a little faster, Arch linux should work the same but your mileage may vary. I did everything headless through SSH, you can use a keyboard and monitor, your choice. We do not need more than the command line.

Starting Up

Start by copying Raspbian image to your SD using your favorite method and powering it up.
Do the usual

sudo apt-get update && sudo apt-get upgrade
raspi-config

Now in raspi-config use option 1 to expand filesystem, option 2 to change default password, option 3 to make Pi boot to text console, change PI’s hostname (8 Advanced Option -> A2 Hostname) to something catchy (mine’s called “rpi-backup”) and set GPU memory (8 Advanced Option -> A3 Memory Split) to 16 since we won’t use it. You may want to overclock, but for this setup I value stability over speed.

Hard Disk Setup

Now if you haven’t yet plugged your hard disk, do so now. If you have already formatted your disk continue. If not a little google search will help you.

First thing to do is to create a mount point and change its owner to pi user. Then we will mount our disk in this newly created mount point.

sudo mkdir /media/backup
sudo chown -R pi /media/backup
mount /dev/sda1 /media/backup

Now, to make sure Raspberry does this automatically each boot we must edit the filesystems table file.

sudo nano /etc/fstab

Add this line at the bottom: (NOTE: mine’s filesystem is ext4, if your disk use another filesystem change that value. “auto” will work in most cases)

/dev/sda1   /media/backup    ext4    defaults,user   0   1

Samba Setup

Start this part by installing the required packages

sudo apt-get install samba samba-common-bin

Delete the default configuration file and make a new one

sudo rm /etc/samba/smb.conf
sudo nano /etc/samba/smb.conf

pasting in it those lines:

[global]
   workgroup = WORKGROUP
   guest account = pi
   map to guest = bad user

[storage]
   path = /media/backup
   guest ok = yes
   read only = no

Remember to change workgroup to the one you use.

Now restart your samba server using

sudo /etc/init.d/samba restart

and you are ready to copy/access your files from your Windows, Mac and Linux machines.

Final Notes

I get roughly 10MB/s write and 7MB/s read speed, it could be a little faster while reading but I’m fairly ok with this setup.
As I said in the first lines, this passwordless device is accessible, and writable, by anyone in your LAN. Make sure your LAN is safe before storing critical data.

Categories
PC Nerding

Super Nintendo MacBook Pro

Today my problem was with dd and my MBP 2010.

Not having a linux machine ready I usually use my Mac for Unix commands. I was trying to dd a Raspberry’s image into a fresh SD card, but for some reason the console kept telling me “permission denied”.
By googling a bit I found out that this one is a common problem in MBP 2010: inside the built in SD reader slot there’s a mechanical switch that “reads” the SD’s lock pin and sometimes it gets stuck in lock position.
The solution? Blowing like I was doing a spirometry inside the slot unlocked the pin, like the old day where we all blew into Nintendo’s cartdriges.

Categories
PC Nerding

Iphone funny bugs

I got an iPhone 3gs, cause I wanted to play Clash of Clans.
I never got one until but now I see how beautiful was NOT buying one.

Looks like iOS 6.1.3 has a “charging not allowed with this device” bug on 3GS, 4, 4S and both iPads. Lots of people, including me, have troubles charging the phone using any kind of wall charger, including his own one, or pc usb ports.
But, hear hear, it does indeed charge connected to my Win pc, but only when I have iTunes application open and running. The same goes for my MacBook Pro, the phone won’t charge unless plugged into one specific usb port and with iTunes app running.

A fanboy/hater type would just saying Apple is shit and this kind of stuff. But I’m not the type. I find bugs like this one like entertaining, because those demonstrate how even bigger brands can score an huge fail.
Fun fun apples.