Raspberry PI – Easy setup a backup NAS server

A little reminder to configure rasperry as NAS server, to backup and access your file everywhere.

How to?
First of all you need an account on www.no-ip.com or a public ip address.

Next, boot your rasperry, go root (or use sudo), and install Samba:

#apt-get install samba samba-common-bin

Open samba config file (/etc/samba/smb.conf) and edit/add these lines:

security = user

# at the end of file, copy/paste the config
[public]
  comment = My Public Store
  path = /home/shared/usbdisk
  valid users = @users
  force group = users
  read only = no
  writeable = yes
  create mask = 0777
  directory mask = 0777
  browseable = yes
  public = yes

In this way you allow the users to login in on your raspy. You need to add a user…

smbpasswd -a pi
# set password, etc...

Save, exit and restart the service

#/etc/init.d/samba restart

Now, create the shared folder (as configured in early in smb.conf), set permissions and mount the usb disk.

## create folders
$cd /home
$mkdir shared
$chown -R root:users /home/shared/
$chmod -R ug=rwx,o=rx /home/shared/
$mkdir usbdisk

## mount disk
#mount /dev/sda1 /home/shared/usbdisk

Next, you need to mound disk at startup. Open /etc/fstab and add this line:

/dev/sda1 /home/shared/usbdisk auto noatime,user,rw,exec 0 0

Note: if you have a NTFS drive, you need install ntfs package

apt-get install ntfs-config
apt-get install ntfs-3g

Well, first part is done.

Now you need to use no-ip service to connect remotely on your rasperry.

I suggest to use a static ip address on your raspy. Setting static ip is easy and it’s explained here.


Install no-ip service

mkdir noip
cd noip/
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar vzxf noip-duc-linux.tar.gz
cd noip-2.1.9-1/
make
make install

Follow instructions, enter your username/password and go on.

After installation, you need to create a noip service (to run on every boot).
Create the file noip in /etc/init.d/noip

vi /etc/init.d/noip

and copy/paste these lines as explained here:

#! /bin/sh
# /etc/init.d/noip
case "$1" in
  start)
    echo "Starting noip"
    /usr/local/bin/noip2
    ;;
  stop)
    echo "Stopping noip"
    killall noip2
    ;;
  *)
    echo "Usage: /etc/init.d/noip {start|stop}"
    exit 1
    ;;
esac
exit 0

Set permission, start, and reboot everything.

chmod 755 /etc/init.d/noip 
/etc/init.d/noip start
#reboot

Connections to rasperry

Open terminal and try:

ssh pi@192.168.0.115       // the raspy static ip
// or
ssh pi@mydyndnsname.no-ip.org  // the no-ip address

you should be able to connect.

If the output is this, you are in!

host-001:~ albertop$ ssh pi@mydyndnsname.no-ip.org
pi@mydyndnsname.no-ip.org's password: 
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Dec  9 13:30:14 2012 from 95.227.126.188

pi@raspberrypi ~ $

If not… i have no idea 😀. Probably you missed something in the way.

One of the common problems could be the port forwarding. Enable to in your router settings the redirect from ssh port and samba ports. (22 for ssh and 137,138,139 for samba. TCP/UDP).
portforward.com could help you.

On Mac OSX, open finder, press CMD+K and type smb://mydyndnsname.no-ip.org.

Login and use your files remotely.
On Windows/Linux is similar, open My PC and select “Connect to server”. Address should be the same.

You can also use FileZillaWinSCP or others sftp client to access your remote shared folder.

Probably i missed something, but you could be able to solve the issue. 🙂
enjoy.


References:
– http://it.wikipedia.org/wiki/Network_Attached_Storage
– http://www.no-ip.com/
– http://compnetworking.about.com/od/workingwithipaddresses/f/what-is-a-public-ip-address.htm
– http://en.wikipedia.org/wiki/Samba_(software)
– http://www.penguintutor.com/blog/viewblog.php?blog=6306
– http://www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html
– http://portforward.com/
– http://www.google.com

 

[WP7] Install all Nokia apps on LG and other devices

Hi guys,
today a simple tricks to browse Nokia store on your devices.

Read More

 

Rasperry PI – First boot

It’s geek time!

Read More

 

Rasperry PI – Unboxing

Habemus raspy v2! After 5 month of delivery…

Read More

 

[Objective-C] UILabel letters animation

Today, a simple class to make easily an UILabel letters animation, that scroll in “circular” way.

uilabel nsstring animation letters
How is made?

Read More

 

User review on The Last Two

The Last Two – Le recensioni più belle!



Read More

 

[Objective-C] Custom UIActivityViewController icons and text

ios social view controller

The UIActivityViewController class is a standard view controller that you can use to offer various services from your application. The system provides several standard services, such as copying items to the pasteboard, posting content to social media sites, sending items via email or SMS, and more. Apps can also define custom services.

Read More

 

ObjectiveC – Power of “AT Sign” aka “@”

The at sign @ is also commonly called the at symbol or commercial at in English—and less commonly a wide range of other terms.
he fact that there is no single word in English for the symbol has prompted some writers to use the French arobase or Spanish arroba—or to coin new words such as asperand, ampersat—but none of these have achieved wide currency.

Read More

 

[WP7] The Last Two – for Windows Phone

The Last Two


Windows phone 7 apps - albertopasca.it

Sei proprio sicuro di conoscere tutte le parole della lingua italiana?

Read More

 

[Objective-C] Change default status bar content

Power of screenshot!!

Simply, make a screenshot of your app and render the frame f your captured image, adding the UI components that you want.
Very easy.

Read More