Shep
Posts: 18
Joined: Sun Nov 03, 2013 1:00 am

Samba issues/alternative for Windows 7+

Wed Feb 25, 2015 11:39 pm

I've found that the Raspberry Pi tutorials out there are mostly self-explanatory, and any trouble I come across can be fixed with a quick Google search. Not so with this one. I have Git running on a Raspberry Pi (Raspbian, latest via sudo apt-get update/upgrade), and would like to back it up with an external hard drive. Long story short, I formatted a 4TB external hard drive to ext4 via gparted, and have it under /media/FilePi . The problem is that I cannot, for the life of me, get Windows 7 nor Windows 8.1 to even see it on the network. Trying both \\GitPi\Files and \\192.168.1.84\Files results in a generic "Windows cannot find what you're looking for" error message.

My /etc/samba/smb.conf is the default except for the following section I added:

Code: Select all

#### Shep Shares ####
[Files]
comment = GitPi Files
path = /media/FilePi
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no
#guest ok = yes
That last line I added but didn't seem to affect the outcome. I've checked the "obvious", and I can't figure out why it won't connect as is. All three computers (both Windows machines and GitPi) are on the same network and workgroup, and the strangest part is that if I do something like this:

Code: Select all

cd /var/log/samba
sudo rm log.*
then the instant I try just "\\GitPi" in Windows, two connection entries show up -- one for the name of the computer, and one for it's IP address, yet both are entirely blank! Trying "\\GitPi\Files" does not show anything however.

I'm at wits end with this, but basically I'd like to just "plug and play" on the Windows side, so I can set this up on other machines without too much hassle. I'd also like to set up user accounts so that some are read-only, preventing the more malware-prone machines from altering any files without my knowledge. Am I missing something in my config settings, or should I be looking for an alternative? I've read a bit about WebDav being an alternative, but quite slow as well. I'm just baffled as to why it won't ever ask for authentication nor recognize that the share is valid. :|

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: Samba issues/alternative for Windows 7+

Thu Feb 26, 2015 10:52 am

Is the comment, GitPi Files, equivalent to GitPi/Files ?

Severian
Posts: 49
Joined: Wed Jul 10, 2013 6:22 am

Re: Samba issues/alternative for Windows 7+

Thu Feb 26, 2015 11:01 am

Howdy,
I would make these changes. I setup server like the following(adding the path parameter). I don't allow Windows on my LAN, so I can't test for you at the moment. But, I have used this setup for Linux samba servers on systems for friends who do run Windows.


guest ok = yes
locking = no
writeable = yes
public = yes
browseable = yes
force user = nobody

Shep
Posts: 18
Joined: Sun Nov 03, 2013 1:00 am

Re: Samba issues/alternative for Windows 7+

Sat Feb 28, 2015 12:09 pm

Tried that, no dice. After some googling around, I came across an alternative that seems to be much better with Windows 7: CIFS. Only problem is, I can't get that to work either.

I added my drive to /etc/fstab like so:

Code: Select all

//192.168.1.84/Files /media/FilePi/Files cifs guest,uid=1001,gid=1004,iocharset=utf8 0 0
(also trying with the server name, GitPi, with identical results)

but when I try sudo mount -a , I get an error:

Code: Select all

pi@GitPi $ sudo chmod -R 777 /media/FilePi
pi@GitPi $ sudo mount -a
mount error: cifs filesystem not supported by the system
mount error(19): no such device
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Debugging steps:

Code: Select all

pi@GitPi $ sudo modprobe cifs
ERROR: could not insert 'cifs': Exec format error
pi@GitPi $ sudo modprobe cifs-utils
FATAL: Module cifs-utils not found.
pi@GitPi $ sudo apt-cache search cifs-utils
cifs-utils - Common Internet File System utilities
samba - SMB/CIFS file, print, and login server for Unix
smbclient - command-line SMB/CIFS clients for Unix
So clearly it's installed (and appears to have been done so by default), but I still can't figure out why nothing will recognize it.

modinfo cifs shows the filename is /lib/modules/3.12.35+/kernal/fs/cifs/cifs.ko , and uname -a shows 3.12.35+ as well. I'm baffled, and have even done multiple sudo apt-get update and sudo apt-get upgrade commands, but everything's up to date. I'm tempted to try sudo rpi-update to see if that fixes the issue, but I already have Git installed and working and don't want to sacrifice that. Anyone have any ideas on this one? I'm stumped.

java
Posts: 226
Joined: Mon Jul 21, 2014 9:41 am

Re: Samba issues/alternative for Windows 7+

Sat Feb 28, 2015 1:31 pm

Well, "sudo apt-get update" "sudo apt-get upgrade", and "sudo rpiupdate" will update your system, and will not affect your git installation or delete it.

Possible new version of git might get installed that requires config update, but I consider this not likely.

Some caution the use of rpiupdate as it updates your RPi's firmware ...

But overall should not cause you issues.

Shep
Posts: 18
Joined: Sun Nov 03, 2013 1:00 am

Re: Samba issues/alternative for Windows 7+

Sat Feb 28, 2015 3:18 pm

java wrote:Well, "sudo apt-get update" "sudo apt-get upgrade", and "sudo rpiupdate" will update your system, and will not affect your git installation or delete it.

Possible new version of git might get installed that requires config update, but I consider this not likely.

Some caution the use of rpiupdate as it updates your RPi's firmware ...

But overall should not cause you issues.
Will try sudo rpi-update when I get a chance. Do you think that'll solve the issue? I've already run apt-get update and apt-get upgrade without success. Not sure why it won't recognize CIFS as a valid filesystem (is that built into Raspbian or do I need to install extra software?)

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Samba issues/alternative for Windows 7+

Sat Feb 28, 2015 4:19 pm

Samba is a pain to get set up no matter what linux device your using (so I promise this isn't just a Pi thing ;-) )

Here's the samba configurations I'm using for my network share. A couple words of warning about it first. This is a wide open share. Once someone is actually on my network, I don't care if they can read, modify, or delete files on this share. It's just a share in my house and doesn't need ultra security on it. I do all my security worries at the entrance to the network and then make sure only authorized people can get onto it. So while I can 100% say that these settings work, it's a wide open door and I'm not sure if that will fit your needs. This is my entire smb.conf file.

Code: Select all

[global]
netbios name = Hermes
server string = The Pi File Center
workgroup = ***********
security = share
hosts allow =

socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536

remote announce =
remote browse sync =

[Everything]
path = /media/Everything
comment = No comment
browsable = yes
read only = no
valid users =
writable = yes
guest ok = yes
public = yes
create mask = 0777
directory mask = 0777
force create mode = 0777
force directory mode = 0777
hosts allow =
guest account = pi
Of particular interest to you might be the 5th line "security = share" I believe the default is "security = user".
Dear forum: Play nice ;-)

andrum99
Posts: 1259
Joined: Fri Jul 20, 2012 2:41 pm

Re: Samba issues/alternative for Windows 7+

Sat Feb 28, 2015 10:48 pm

The CIFS stuff you add in /etc/fstab is for connecting things in the opposite direction - i.e. connecting your Pi to a directory that is located on another computer, and is shared out over the network.

I have written a blog post that explains how I got Samba working on the Pi, along with a link to my smb.conf file. My smb.conf file simplifies things compared to the stock debian version, and also sets things up a bit more sensibly for a basic standalone server. You can find it here:

http://andrum99.blogspot.co.uk/2014/01/ ... ry-pi.html

Cheers

Andrew.

Shep
Posts: 18
Joined: Sun Nov 03, 2013 1:00 am

Re: Samba issues/alternative for Windows 7+

Sun Mar 01, 2015 12:35 pm

andrum99 wrote:The CIFS stuff you add in /etc/fstab is for connecting things in the opposite direction - i.e. connecting your Pi to a directory that is located on another computer, and is shared out over the network.

I have written a blog post that explains how I got Samba working on the Pi, along with a link to my smb.conf file. My smb.conf file simplifies things compared to the stock debian version, and also sets things up a bit more sensibly for a basic standalone server. You can find it here:

http://andrum99.blogspot.co.uk/2014/01/ ... ry-pi.html

Cheers

Andrew.
Thank you VERY much Andrew! Copied your config file over, made a few minor changes, and I got it functional! Hopefully I can make the necessary tweaks from here, but here's what I'm looking for:

I have two shares, "Files" and "Private". I want "Files" to be visible publicly so that anyone can see and read the files. In order to add files however (or even edit them), they need to log on as "shep". For the other share, I want to force them to log in in order to even see it. Right now, if they log in as "shep", they can see both shares. I tried a different computer, and even trying \\GitPi\ required a login, which is fine. However so did \\GitPi\Files -- clicking "Cancel" on that dialog resulted in a "cannot connect" error, basically telling me I need to authenticate to even see it. Ditto for \\GitPi\Private (although that one is intentional and functioning as far as I can tell).

Here's my config file changes from Andrew's:

Code: Select all

[Files]
path = /media/FilePi/Files
read only = yes
valid users = shep
nt acl support = no

[Private]
path = /media/FilePi/Private
read only = no
valid users = shep
nt acl support = no
Layman's terms, the Private share works. I'd like however for the Files share to be publicly visible and read-only, both in terms of contents and the share itself (although I'm not sure if "hiding" the Private share is possible -- if not, preventing access without a login works just as well). What changes do I need to make to enable this?

DirkS
Posts: 10390
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Samba issues/alternative for Windows 7+

Sun Mar 01, 2015 1:35 pm

Layman's terms, the Private share works. I'd like however for the Files share to be publicly visible and read-only, both in terms of contents and the share itself (although I'm not sure if "hiding" the Private share is possible -- if not, preventing access without a login works just as well). What changes do I need to make to enable this?
Try

Code: Select all

[Files]
path = /media/FilePi/Files
read only = yes
valid users = users
browsable=yes
public=yes

[Private]
path = /media/FilePi/Private
read only = no
valid users = shep
browsable=no
IIRC if you add 'browsable=no' then a share will not show up, even if you're logged in with the correct user.

I use the following config. The first two are two shares pointing to the same directory on the server. The first is public & read only. The second is for the same storage and read/write, but the share is not visible.
The 3rd one is private storage, accessible only for logged on users.

Code: Select all

[public]
  comment = Public Storage
  browsable = yes
  path = /data/public
  read only = yes
  public = yes
  force group = users

[publicrw]
  comment = Public Storage rw
  browsable = no
  path = /data/public
  read only = no
  valid users = @users
  create mask = 0775
  directory mask = 0775

[private]
  comment = Private Storage
  browsable = no
  path = /data/private
  valid users = @users
  create mask = 0775
  directory mask = 0775
  read only = no

Shep
Posts: 18
Joined: Sun Nov 03, 2013 1:00 am

Re: Samba issues/alternative for Windows 7+

Sun Mar 01, 2015 1:45 pm

No dice, but I do see a "force group = users" entry in your public one that may be relevant. Is there a way to allow the "shep" user to log in, but if no login is performed, to force it to use a user named (for example) "readonly"? Then I can set that user's permissions to be (as the name implies) read only.

EDIT: To clarify, by "no dice" I mean all scenarios remain unchanged from last post.

Shep
Posts: 18
Joined: Sun Nov 03, 2013 1:00 am

Re: Samba issues/alternative for Windows 7+

Tue Mar 03, 2015 1:59 am

Made progress on my own, but am now stuck again. When I go to \\GitPi\, it now shows the "FIles" share as intended. Double-clicking this however immediately asks for a username and password. Ditto for trying to directly type in the path of any folders. If I provide correct credentials, then it gives me read/write/create permissions, exactly as I want. The problem is that I'd like for guest browsing to be enabled for read-only operations on this one. How do I change the config file to go about doing that?

Here's my current smb.conf file:

Code: Select all

[global]
log level = 2
map to guest = bad password
workgroup = WORKGROUP
server string = %h Samba host
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = user
encrypt passwords = true
passdb backend = tdbsam
unix password sync = no
socket options = TCP_NODELAY SO_KEEPALIVE SO_RCVBUF=65536 SO_SNDBUF=65536
deadtime = 15
#
# Ignore printing
printing = bsd
printcap name = /dev/null
#
# Ignore address family errors
bind interfaces only = yes
interfaces = lo eth0 wlan0

[Files]
comment = Shared Files
path = /media/FilePi/Files
browseable = yes
guest ok = yes
valid user = shep
writeable = yes
public = yes
Removing the "private"-specific settings to avoid confusion. Is there an easy setting change to allow guest browsing of the share? Odd how it doesn't work right now.

Shep
Posts: 18
Joined: Sun Nov 03, 2013 1:00 am

Re: Samba issues/alternative for Windows 7+

Thu Apr 02, 2015 4:43 pm

*Bump*

Still facing the same issue. Anyone?

zatz
Posts: 7
Joined: Wed May 20, 2015 5:53 am

Re: Samba issues/alternative for Windows 7+

Fri May 22, 2015 8:03 am

I used http://www.howtogeek.com/139433/how-to- ... ge-device/ to set up Samba and had no problems getting a Windows 7 PC to see it.

Return to “General discussion”