# Samba Share with Windows [SOLVED]

## HTS

Hmm, I have an issue with my Samba Shared Folder.

The Windows user (on Win XP pro) is able to browse the folder, to write on it, but gets an "Access Denied" when he tries to open a file.

I've tried every combination of permission masks, I now even have 0777 everywhere but still the user can't open any file.

Any idea? If u need me to post my config files just ask.

Thanks

HTSLast edited by HTS on Thu Mar 02, 2006 2:39 pm; edited 1 time in total

----------

## rsa4046

I assume  security is set as share in [global]? Please post your smb.conf.

----------

## HTS

Yes it is set as share in global, I am still n00b with samba so I don't understand much in the file...

here is my smb.conf:

```

[global]

workgroup = aberdeen

server string = Samba Server %v

#printcap name = cups

#printing = cups

#load printers = no

log file = /var/log/samba/log.%m

max log size = 50

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

interfaces = lo eth0

bind interfaces only = yes

hosts allow = 192.168.1.102 127.0.0.1 192.168.1.1 192.168.1.100

hosts deny = 0.0.0.0/0

security = share

guest account = samba

guest ok = yes

vfs object = vscan-clamav

vscan-clamav: config-file = /etc/samba/vscan-clamav.conf

[public]

comment = Public Files

browseable = yes

valid users = estelle,root,hts

writable = yes

public = yes

create mode = 0777

guest ok = yes

path = /home/samba/public

```

Edit: I am not sure about the valid users line, there used to be samba (my guest account) in it, but it didn't make much of a difference. I also tried to remove it but it didn't change anything.

Cheers

HTS

----------

## rsa4046

I'm no samba expert either, but what are the permissions on /home/samba/public and files therein? Setting security=share, and using your [public] where /home/samba/public has permissions

```
# ls -l /home/samba

total 0

drwxrwxrwx  3 root root 104 Mar  1 12:41 public
```

I can mount \\netbiosname\public from XPpro (whilst logged in as an arbitrary user with no corresponding linux account or permissions), and read and write both to the directory (new files) as well as existing files, provided sufficient permissions exist on those objects. My understanding (  :Exclamation:  limited) is that with security=share (versus user), permissions on each object in \\netbiosname\public is examined anew. If you set permissions (chmod o+w \home\samba\public\*), does that give the user write access?

I deleted the valid users line, BTW, before trying this. Also, it might be convenient in terms of XP access to give your samba server a netbios name (.i.e., netbios name = aberdeen_server) in [global]. Then you can user UNC paths from XP, i.e., \\aberdeen_server\public --

HTH

Edit - remember to restart samba (# /etc/init.d/samba restart) after mucking with smb.conf.

----------

## HTS

Tx, i was out shopping, I'm trying it right now and let you know !

----------

## HTS

In the samba folder:

```
# ls -l /home/samba

total 4

drwxrwxrwx  5 root root 4096 Mar  1 19:26 public
```

In the /home/samba/public folder:

```
# ls -l /home/samba/public

total 12

drwxr-xr-x  2 estelle users 4096 Mar  1 19:30 Created by estelle on WinXP

-rwxrw-rw-  1 estelle users    0 Mar  1 19:30 Created by estelle on WinXP.txt

drwxr-xr-x  2 hts     users 4096 Mar  1 19:29 Created by hts on Gentoo

-rw-r--r--  1 hts     users    2 Mar  1 19:30 Created by hts on gentoo

```

I tried 

```
chmod o+w /home/samba/public/*
```

without any success.

The weird thing is that actually, estelle (the WinXP user) has write access since she can create files and folders in the share, even copy videos in it. The thing is she cannot read any of the files (that she or I created). Trying to open a file on XP always results in an "Access Denied" error.

----------

## rsa4046

Here's what I changed: eliminated guest account = samba in [global] (otherwise my nmbd won't start) and added the following in [public]

```

read only = no
```

Make this change and restart samba, see if it works. I can create/del/read/write anything in the public folder from XP. From the gentoo side, such files look like

```
# ls -l /home/samba/public

total 148

-rwxr--r--  1 nobody nobody 141878 Jan  7 07:11 test.pdf

-rwxr--r--  1 nobody nobody      7 Mar  1 14:03 testfile.dat

-rwxr--r--  1 nobody nobody      6 Mar  1 14:04 testfile.dat.original

```

If this doesn't work, ... maybe this is a windows (not samba) problem (?)

Here's the complete smb.conf, just for ref:

```
[global]

   workgroup = WORKGROUP

   server string = Samba Server %v

   log file = /var/log/samba3/log.%m

   max log size = 50

   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

   interfaces = lo eth0

   bind interfaces only = yes

   hosts allow = 192.168.1.102 127.0.0.1 192.168.1.1 192.168.1.100

   hosts deny = 0.0.0.0/0

   security = share

;  guest account = samba

   guest ok = yes

[public]

   comment = Public Files

   read only = no

   browseable = yes

   writable = yes

   public = yes

   guest ok = yes

   path = /home/samba/public

```

Only trivial changes are those to logfile location and workgroup name

----------

## HTS

Yup, everything looks ok, I don't get it.

The samba config looks really fine.

I tried everything...   :Sad: 

Thank you very much for your help!

It has to be a Windows problem. I will dig that way.

Cheers

HTS

----------

## rsa4046

Sorry--

The only other thing I can think of is to make sure you have smbfs/cifs support installed under Network File Systems (loaded in the kernel or as module, although I'm guessing you've got this covered).  Perhaps also check if the share can be accessed from the linux side as well. If you kde's konquerer, you can verify this easily by entering smb:/ as address, then see what pops up. Or try smbclient //<netbiosname>/public (I just hit return when asked for a password):

```

$ touch anothertestfile

$ smbclient //hercules/public

Password:

Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.14a]

smb: \> ls

  .                                   D        0  Wed Mar  1 19:33:30 2006

  ..                                  D        0  Wed Mar  1 13:44:40 2006

  testfile.dat                        A        7  Wed Mar  1 14:03:44 2006

  test.pdf                            A   141878  Sat Jan  7 07:11:10 2006

  testfile.dat.$$$                    A        6  Wed Mar  1 14:04:39 2006

                34765 blocks of size 8388608. 15354 blocks available

smb: \> put anothertestfile

putting file anothertestfile as \anothertestfile (0.0 kb/s) (average 0.0 kb/s)

smb: \> quit

$ ls -l /home/samba/public

total 152

-rwxr--r--  1 nobody nobody 141878 Jan  7 07:11 test.pdf

-rwxr--r--  1 nobody nobody      2 Mar  1 19:33 a

-rwxr--r--  1 nobody nobody      0 Mar  1 19:36 anothertestfile

-rwxr--r--  1 nobody nobody      7 Mar  1 14:03 testfile.dat

-rwxr--r--  1 nobody nobody      6 Mar  1 14:04 testfile.dat.$$$

```

Don't know what to suggest on the XP side, except to verify that the behavior in terms of access (or lack thereof) is consistent from different machines. Cheers --

Rolf

----------

## HTS

Thanks Rolf, I now see a lot clearer !!

I had indeed the smb filesystems in the kernel. However, I had compiled kde-base without the samba USE flag. Which means smb protocol was not recognised by KDE...

I added samba to my USE flags and 

I did a:

```
emerge --newuse kdebase
```

Which explains why I wasn't able to answer straight away   :Razz: 

So now I have access to smb via Konqueror!

I can indeed browse the Samba share from the Linux side, I however have exactly the same restrictions than the XP user: I can't read the files...

I have write access and i can delete the files, but cannot read them.

The good thing is that I can read the Windows shared folders from the Linux side. I even have write access to them  :Razz: 

So this is the proof that it is not an XP based problem !

But what is wrong with my Samba setup ???   :Evil or Very Mad:   :Evil or Very Mad:   :Evil or Very Mad: Last edited by HTS on Thu Mar 02, 2006 1:15 pm; edited 1 time in total

----------

## rsa4046

Hmmm ... maybe it's time to simplify further. Using the example in samba.org anonymous read-only server here, with smb.conf of

```
[global]

   workgroup = ABERDEEN

   netbios name = SAMBA_SERVER

   security = share

[data]

   comment = public

   path = /home/samba/public

   read only = Yes

   guest only = Yes
```

Can you substitute this smb.conf, then add samba_user as a user

```
# useradd -c "samba_user" -m -g users -p samba_password samba_user

# chmod u+rwx,g+rx,o+rx /home/samba/public

# chown samba_user.users /home/samba/public
```

Copy some files in, restart samba, and see if this gives read access?

Edit: fixed typo

Also run testparm just to be sure before restarting samba. If this works in terms of read(only) access, then it should at least serve as a template upon which to build, and then extend permissions to give read/write/delete/etc access to the share.

----------

## HTS

Tx,

I'm trying this right now, I'll let you know!Last edited by HTS on Thu Mar 02, 2006 1:26 pm; edited 1 time in total

----------

## HTS

Dude, WEIRDOOOO this is actually WORKING....

WEIRD though is that when i type smb:/ Konkeror is now unable to resolve the workgroup.

But I can actually read the files from Linux and XP side*

It also changed the name of the share from public to data.

Very GOOD first step, I am almost seeing the end of it   :Very Happy: 

----------

## HTS

Ok i just changed to read only to no and i am able to write the files !

Just Need to solve the issue of the name... (Edit: Stupid the name is defined by ME in the conf file  :Smile: )

Edit: I also found out that:

```

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

interfaces = eth0

bind interfaces only = yes

```

forces a local copy of the file before reading, which I don't want!

Edit: No this is not the case, I tried with a big file and Linux still needs a local copy of the file to read it, which XP does not need...Last edited by HTS on Thu Mar 02, 2006 1:57 pm; edited 1 time in total

----------

## HTS

So everything works now !

Except that I don't see my smbtree... and when i type smb:/ in Konkeror it still returns :

Unable to find any workgroups in your local network

----------

## rsa4046

I believe that when you access shares through konqueror using smb:/ in the address bar, you are actually running a background instance of smbclient, so maybe the problem lies there? Can you access the share from a bash shell, as in 

```
# smbclient -U <samba_user> //<netbiosname>/public
```

or some variation thereof?

----------

## HTS

Yes, that was a KDE problem in fact not a samba one, just a reboot solved the last trick !

It is Working Just as I like!

I can still access my files without going trough samba from the linux platform so the local copy is not an issue.

I am still wondering why windows can directly read the files when linux is forced to have a local copy?

Anyways, this one is solved !

Without you my girlfriend would still ask me to switch back to XP   :Twisted Evil: 

Thanks so much for your help!

HTS

----------

## rsa4046

Excellent!   :Wink: 

Cheers--

----------

