Linux Make samba shares password protected XBMCbuntu frodo RC1
#1
I noticed that on XBMCbuntu frodo RC1 a number of folders are shared with read/write access using a guest account so no password needed. I don't like that, I have all my shares on my network password protected. If you don't mind then skip this and don't read further.
See also https://github.com/xbmc/XBMCbuntu/commit...8bc18a4e9a

So I changed the following:

NOTE: if you are not sure what you are doing make a backup of the files you want to change before changing them. So you can always revert back to the old situation.

First adjust the smb.conf located in /etc/samba

I have one USB drive I want to share and my home folder. I choose to share my entire home folder and not just only Videos, Music etc directories of course you can share what you want. Below is just an example.

Code:
[global]
workgroup = WORKGROUP
server string = %h server (Samba, XBMC)
netbios name = XBMCbuntu
dns proxy = no
name resolve order = hosts wins bcast
security = user
load printers = no
show add printer wizard = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user

[home_maurice]
path = /home/maurice
comment = home Folder
read only = No
create mask = 0600
directory mask = 0700



[1000GbXBMC]
path = /media/1000GbXBMC
comment = USBdrive
read only = No
create mask = 0600
directory mask = 0700

Notice the removal of "guest account = <your name>" in my case "guest account = maurice" and adding "security = user" in the [global] section.

read only = No --> means you can also write to the share
create mask = 0600 --> Created files will be only accessible by the login user.
directory mask = 0700 --> only the login user has access to directories created.

Then I added my user to the password file and created a password which can be done as seen below:

Code:
maurice@XBMC:~$ sudo /usr/bin/smbpasswd -a maurice
[sudo] password for maurice:
New SMB password:
Retype new SMB password:

If you get an error message like below:

Code:
Unable to modify TDB passwd: NT_STATUS_UNSUCCESSFUL!

Then remove or move /var/lib/samba/passdb.tdb and try again.

Now restart the samba server:

Code:
sudo restart smbd

Make the shares accessible on your windows 7 machine:

As you all know windows 7 and samba doesn't work so well atleast in my experience. To make the shares accessible I had to map them as a network drive and use the ip adres instead of the dns name.

  1. Right click computer in explorer and choose map network drive
  2. Type in your network share in my smb.conf for the first it would be "\\<xbmc ip adres>\home_maurice"
  3. check both boxes "Reconnect at logon" and "Connect using different credentials" then click "Finish"
  4. You will be prompted for the username and password, fill them in accordingly
  5. Repeat the above for all your other shares.

Hope this can help some people.

maurice118
Reply

Logout Mark Read Team Forum Stats Members Help
Make samba shares password protected XBMCbuntu frodo RC10