Forum
[SOLVED] Samba for External HD - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Software (/forum-6.html)
+--- Forum: Configuration (/forum-17.html)
+--- Thread: [SOLVED] Samba for External HD (/thread-2995.html)



Samba for External HD - gigles13 - 13th May, 2015 06:07 AM

Software
XBian version: 1.0
XBMC/Kodi version: 14.2
Overclock settings: N/A

Hardware
Device type and model (e.g. Raspberry Pi Model A/B 256/512 MB, CuBox-i i4Pro, ...): RPi2
Power supply rating: 2.5A
SD card size and make/type: 8GB Sandisk Ultra
Network (Ethernet or wireless): Wireless
Connected devices (TV, USB, network storage, ...): HDMI, External HD, wireless keyboard, wireless dongle


I have an external hard drive that I have all my media on. I want to be able to leave it connected to my RPi 2 and be able to transfer files from my Mac onto the hard drive. I know I need to use Samba. I have no idea how to set it up, or to even access the terminal. I've been around this forum and around google and see multiple things about editing files and what not, and I'm not entirely sure how to. Do I take the SD card and just put it in my laptop and edit the file from there? Do I edit it on the Pi itself? How do I bring up a terminal? Etc.

I also want to make sure that no one would be able to access it as well; just me. I know there was a security thing I read about somewhere, but I'm not entirely sure if that pertains to this issue.

As you can see, I'm pretty knew to this stuff. Any help would be more than appreciated! Especially links to other threads if I missed something (I'm sure I did). Thank you! Smile


RE: Samba for External HD - deHakkelaar - 13th May, 2015 11:48 PM

Hi gigles13 and welcome.
Its a bit too much your asking.
If not a little bit familiar with Linux, its like a daunting task explaining the steps in details that you have to take.
You cant take out the SD and plug it in your Mac because the SD is formatted with the BTRFS filesystem that your Mac wont be able to read without additional software to support BTRFS.
But you hardly remove your SD from the Pi anyway unless its absolutely necessary (major filesystem crash for example).

As Samba, the Linux software for making windows type of shares available on your network, is already installed and running, it shouldnt be that hard if know a little bout Linux.
Steps you have to take:
1) Connect from Mac to your Pi with an SSH client (the command line thingy);
2) Become the 'root' user so you can manipulate system services (command "su -");
3) Determine mount point on your Pi filesystem for your USB hard drive when it is connected (the "mount" command);
4) Configure Samba to share this mount point (command "nano /etc/samba/shares.conf").

Changes in that "shares.conf" file are almost instant (close all connections and wait a minute to be sure).
And you can copy/paste/alter one of the existing shares in that "shares.conf" file for your purpose first before try to secure that share with a username/pass.
Below some useful BASH commands when connected via SSH:

- Monitor Samba status (CTRL-c to exit):
watch smbstatus

- Monitor network connections on TCP ports 139 and 445 used by Samba (CTRL-c to exit) :
watch "netstat -natp | grep '139\|445'"

- Monitor number of Samba daemons/sessions (CTRL-c to exit):
watch 'ps -e | grep smbd'

- List block devices like your USB hard disk:
lsblk
fdisk -l

- Show mounted filesystems:
mount

- Create new Samba user/pass :
smbpasswd –a <SAMBA_USERNAME>

First see how far you can get Wink


RE: Samba for External HD - gigles13 - 15th May, 2015 03:21 AM

Thanks so much for answering me!

So, I figured out how to connect to the Pi through the terminal window. Success!

And then I figured out the rest of it! Wow! That was actually not bad at all. Thanks so much! Smile

(13th May, 2015 11:48 PM)deHakkelaar Wrote:  Hi gigles13 and welcome.
Its a bit too much your asking.
If not a little bit familiar with Linux, its like a daunting task explaining the steps in details that you have to take.
You cant take out the SD and plug it in your Mac because the SD is formatted with the BTRFS filesystem that your Mac wont be able to read without additional software to support BTRFS.
But you hardly remove your SD from the Pi anyway unless its absolutely necessary (major filesystem crash for example).

As Samba, the Linux software for making windows type of shares available on your network, is already installed and running, it shouldnt be that hard if know a little bout Linux.
Steps you have to take:
1) Connect from Mac to your Pi with an SSH client (the command line thingy);
2) Become the 'root' user so you can manipulate system services (command "su -");
3) Determine mount point on your Pi filesystem for your USB hard drive when it is connected (the "mount" command);
4) Configure Samba to share this mount point (command "nano /etc/samba/shares.conf").

Changes in that "shares.conf" file are almost instant (wait a minute to be sure) and you can copy/paste/alter one of the existing shares for your purpose first before try to secure that share with a username/pass.
Below some useful BASH commands when connected via SSH:

- Samba status:
smbstatus

- Show network connections on TCP ports 139 and 445 used by Samba:
netstat -nat | grep '139\|445'

- Monitor number of Samba daemons/sessions:
watch 'ps -e | grep smbd'

- List block devices like your USB hard disk:
lsblk
fdisk -l

- Show mounted filesystems:
mount

First see how far you can get Wink



RE: Samba for External HD - deHakkelaar - 15th May, 2015 07:52 PM

Good job.
Now your the Samba expert and can help others Wink