PINE64
Guide - Setting up a SMB(Windows) file server - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: ROCK64 (https://forum.pine64.org/forumdisplay.php?fid=85)
+--- Forum: Rock64 Tutorials (https://forum.pine64.org/forumdisplay.php?fid=90)
+--- Thread: Guide - Setting up a SMB(Windows) file server (/showthread.php?tid=4983)



Guide - Setting up a SMB(Windows) file server - Ptheven - 08-21-2017

This quick and easy tutorial will show you how to set up a shared folder on your Rock64 and host it via SMB/CIFS to share it amongst Windows/Mac/Linux Clients. 

I will also show you how to connect to it using Googles Android client. 
_____________________

Prerequisites: 

Rock64 Board running Linux , Connected via Ethernet or Wifi

Know the IP address/Hostname of your board, SSH access. 

Basic knowledge of how to use the linux terminal


Suggested:


An external drive to host the Shared Directory

Basic understanding of how linux handles USB drives and File Permissions



____________________

I will continue this tutorial off from the last one, and I will set up the shared directory in the Flash drive. 


Firstly, you'll need to update your repositories and install any pending updates. This is good practise before installing software on any linux system. Debian/Ubuntu use the "apt" package management tool. You'll need superuser access for this. 


Code:
sudo apt update && sudo apt upgrade 


Type in your password when prompted and 'y' when prompted to install updates. 


After that, you'll need to invoke apt to install the samba server: 


Code:
sudo apt install samba samba-common-bin


[Image: t8pJbWu.png?1]

Depending on your distro, samba-common-bin may already be installed. However, allow the other supporting software to be installed. 

The next step is to create a directory to host the network share. In this senario, I will be placing it in the Flash drive mentioned in the tutorial listed at the top. 

Navigate to your mounted FS location. Following the previous tutorial, for me it is: 

Code:
cd /media/USB-test3/


Make a new directory which will act as the shared location. We will create it with Use/Write/Execute permissions for everybody inside the folder: 


Code:
sudo mkdir -m 1777 RockShare



Now we can edit Samba's configuration file to create a new share based on the directory we just set up: 


Code:
sudoedit /etc/samba/smb.conf



[Image: ZB2fLBd.png?1]

Use the Up/Down or PageUp/Down keys to navigate to the bottom of the file to create a new entry.

Code:
[share]
Comment = Rock64 Share
Path = /media/USB-test3/RockShare
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes



[Image: 7hKk4mK.png?1]


These options means that anybody can read, write or execute files in the share, either with a samba user or as a guest. To forbid guest access, simply omit the "guest ok" line. 


Now we can create a specialized user for samba, if you'd like to have your share accessible only with the proper credentials. 

First of all, you need to make a new linux user. In this case, I will be making a new user "rocksmb": 


Code:
sudo useradd rocksmb


After that, you can create a new samba user, and you'll be prompted to type in a password too. This is a unique password, independent to your linux user password: 


Code:
sudo smbpasswd -a rocksmb
New SMB password:
Retype new SMB password:
Added user rocksmb.
 

Now you restart the samba service: 

Code:
sudo /etc/init.d/samba restart
[ ok ] Restarting nmbd (via systemctl): nmbd.service.
[ ok ] Restarting smbd (via systemctl): smbd.service.
[ ok ] Restarting samba-ad-dc (via systemctl): samba-ad-dc.service.

Now your Samba share will be visible and accessible! 

There are many guides about how to access smb shares using Windows: 

https://www.howtogeek.com/176471/how-to-share-files-between-windows-and-linux/

http://www.techrepublic.com/article/how-to-connect-to-linux-samba-shares-from-windows-10/

https://www.linux.com/news/using-samba-share-files-between-linux-and-windows

Mac OS: 

https://support.apple.com/en-au/HT204445

Ubuntu: 

https://help.ubuntu.com/stable/ubuntu-help/nautilus-connect.html


In all cases, replace the hostname/IP in the guide with the ones you have. 



_________________

If you want to access the drive using mobile apps, there are many apps available on both Android and iOS. 


iOS: https://itunes.apple.com/us/app/fileexplorer-file-manager-for-computer-and-nas/id510282524?mt=8

Android: https://play.google.com/store/apps/details?id=com.google.android.sambadocumentsprovider&hl=en


I dont have an iphone, so I'll do a quick rundown using the android app: 


Download it and upen it to be greeted to a very simple credential screen. Simply fill in the details like:

Code:
smb://HOSTNAMEORIP/SHARE



In our case: 

[Image: ZBN8LZA.png]

Assuming you've put in the right credentials, it will immediately open up the share using the default android file selector: 

[Image: uW5A7bx.png]

However Google's app is VERY rudimentary and barebones. I was able to open image files, but video and audio files gave me problems unless I copied them to internal memory. 

If you need something more full featured, I highly recommend solid explorer: 

https://play.google.com/store/apps/details?id=pl.solidexplorer2&hl=en