Tag Archives: samba

0) Briefing

USB external storage (Visit Ch05 to see how). Router has limited internal memory, so not much fun to have a share such a small space. But of course, I cannot stop you!

What next

Install Samba server ( 1992 Byte in size )

(Optional) Install luci-app-samba webpage app ( 92 Byte in size )

——————————————————————————–

1) Install Samba server software

Open up your favorite terminal and login into the router

ssh root@192.168.1.1

These commands will update database:

opkg update

Install Samba server (1992 Byte in size):

opkg install samba36-server

If you want to set your Samba via web interface, install (92 Byte in size):

opkg install luci-app-samba

——————————————————————————–

2) Add a user

You do not want everyone connected to your network will be able to see your files, so you need some kind of security to Samba. To have Samba secure, you need to have Samba User Account. To have Samba User Account, you need to have Linux system user account.

2.1) Setup new Linux system group for users account

To add new group, edit the following file:

vim /etc/group

Add the following line

john:x:1001

First field : group_name = john

Second field : group_password = x (I don’t think you can setup any)

Third field : group_id = assign a unique number between 1000 & 65534

2.2) Setup new Linux system user account

To add new user account, edit the following file:

vim /etc/passwd

Add the following line

john:x:1001:1001:John Watson:/var:/bin/false

First field : user_name = john

Second field : user_password = x (Password store in somewhere else)

Third field : user_id = assign a unique number between 1000 & 65534

Forth field : group_id = the group id you have set above

Fifth field : user_info = can be lots of things, Google yourself.

Sixth field : user_home_directory

Seventh field : user_login_startup_program = first program auto startup when login. Usually is a command shell, now we don’t start anything

2.3) Setup user password:

To setup user password:

passwd john

2.4) Setup a Samba user:

To setup a Samba user:

smbpasswd -a john

——————————————————————————–

3) Samba config

Please note :

Do NOT edit /etc/samba/smb.conf , it is a automatically generated file

3.1) Samba global config

Edit the following file:

vi /etc/samba/smb.conf.template

Do not change anything between “|”

The only settings I changed:

null passwords = no

3.2) Add a share folder:

I have setup two type of share folders, one is public read/write allowed, the other one is user login required.