# SAMBA - Remote Win browsing of local mounted windows partiti

## fusibou

A. THANK-YOU

First, I'd like to say THANK-YOU. While this is the first message I've posted, the documentation and forums have allowed me to install a gentoo system from scratch with gnome, openoffice, mozilla etc. all optimized for my Athlon with AA fonts etc. NICE! 

B. SUMMARY

From my Windows machine, I can't browse windows partitions that are mounted on my Gentoo machine.

C. QUESTION

1. Samba is installed and works. On my Gentoo, I can see and browse shares on my Windows machine (for anyone with trouble browsing samba shares through Nautilus, ensure you've emerged gnome-vfs-extras!!)

2. On my Windows machine, I can see my Gentoo shares. I can enter my [samba] shared directory (/home/samba) and read and write files in it from Windows.

BUT

On the Windows machine, I cannot access two windows partitions that I have mounted on Gentoo, win_c and win_d. I get: "win_d is not accessible, the share name was not found". This occurs regardless of whether root mounts win_d or myself as a user on the Gentoo machine.

MY FSTAB FOR win_c and win_d

# Windows Drives

/dev/hda1		/mnt/win_c	vfat		noauto,users 0 0

/dev/hdb1		/mnt/win_d	vfat		noauto,users 0 0

I am using an smb.conf that worked in redhat 8.1

SAMBA CONFIG:

# This is the main Samba configuration file. You should read the

# NOTE: Whenever you modify this file you should run the command "testparm"

# to check that you have not made any basic syntactic errors. 

#

#======================= Global Settings =====================================

[global]

# 1. Server Naming Options:

# workgroup = NT-Domain-Name or Workgroup-Name

   workgroup = WORKGROUP

# netbios name is the name you will see in "Network Neighbourhood",

# but defaults to your hostname

;  netbios name = LINUXBOX

# server string is the equivalent of the NT Description field

   server string = Samba Server %v

# 3. Logging Options:

# this tells Samba to use a separate log file for each machine

# that connects

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

# Put a capping on the size of the log files (in Kb).

   max log size = 50

# Set the log (verbosity) level (0 <= log level <= 10)

; log level = 10

# 4. Security and Domain Membership Options:

   hosts allow = 192.168.1. 127.

   security = user

   map to guest = bad user

   null passwords = yes

   guest ok = yes

encrypt passwords = yes

smb passwd file = /etc/samba/smbpasswd

# If you have multiple network interfaces then you must list them

# here. See the man page for details.

   interfaces = 192.168.1.100 127.0.0.1

   remote announce = 192.168.1

# set local master to no if you don't want Samba to become a master

# browser on your network. Otherwise the normal election rules apply

   local master = no

# Domain Master specifies Samba to be the Domain Master Browser. This

   domain master = no

# Preferred Master causes Samba to force a local browser election on startup

# and gives it a slightly higher chance of winning the election

   preferred master = no

# 7. Name Resolution Options:

# All NetBIOS names must be resolved to IP Addresses

# 'Name Resolve Order' allows the named resolution mechanism to be specified

# the default order is "host lmhosts wins bcast". "host" means use the unix

# system gethostbyname() function call that will use either /etc/hosts OR

# DNS or NIS depending on the settings of /etc/host.config, /etc/nsswitch.conf

# and the /etc/resolv.conf file. "host" therefore is system configuration

# dependant. This parameter is most often of use to prevent DNS lookups

# in order to resolve NetBIOS names to IP Addresses. Use with care!

# The example below excludes use of name resolution for machines that are NOT

# on the local network segment

# - OR - are not deliberately to be known via lmhosts or via WINS.

; name resolve order = host bcast lmhosts wins

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names

   dns proxy = no 

# 8. File Naming Options:

mangle case = yes

case sensitive = no

default case = lower

preserve case = yes

short preserve case = no

#============================ Share Definitions ==============================

#[share]

#   comment = Dave's Linux Share

#   path = /home/dave/share/

#   public = yes

#   guest ok = yes

#   browseable = yes

#   writable = yes

#   printable = no

#   create mask = 0777

[samba]

	comment = samba share

	path = /home/samba

	public = yes

        read only = no

#[dave home]

#	comment = daves linux home

#	path = /home/dave

#	public = yes

[win_c]

	comment = daves windows c:

	path = /mnt/win_c

	public = yes

[win_d]

	comment = daves windows d:

	path = /mnt/win_d

	public = yes

#[homes]

#   comment = Home Directories

#   browseable = no

#   writable = yes

# You can enable VFS recycle bin on a per share basis:

# Uncomment the next 2 lines (make sure you create a

# .recycle folder in the base of the share and ensure

# all users will have write access to it. See

# examples/VFS/recycle/REAME in samba-doc for details

;   vfs object = /usr/lib/samba/vfs/recycle.so

;   vfs options= /etc/samba/recycle.conf

[printers]

----------

## caffiend

can you see the shares using smbclient on your gentoo box?

what does 

```
ls -ld /mnt/win_{c,d}
```

tell you?

----------

## fusibou

 *caffiend wrote:*   

> can you see the shares using smbclient on your gentoo box?
> 
> what does 
> 
> ```
> ...

 

ok. (note... my smb.conf was updated so the Gentoo system is called Moose_juice and the samba share folder is called share). Moomoo is the Windows machine.

```

 smbclient -L localhost

added interface ip=192.168.1.100 bcast=192.168.1.255 nmask=255.255.255.0

added interface ip=127.0.0.1 bcast=127.255.255.255 nmask=255.0.0.0

Password:

Domain=[WORKGROUP] OS=[Unix] Server=[Samba 2.2.8]

 

        Sharename      Type      Comment

        ---------      ----      -------

        share          Disk      Share on Moose Juice

        win_c          Disk      daves windows c:

        win_d          Disk      daves windows d:

        IPC$           IPC       IPC Service (Samba Server 2.2.8)

        ADMIN$         Disk      IPC Service (Samba Server 2.2.8)

        Laserjet6p     Printer

 

        Server               Comment

        ---------            -------

        MOOMOO               MOO

        MOOSE_JUICE          Samba Server 2.2.8

 

        Workgroup            Master

        ---------            -------

        WORKGROUP            MOOMOO

root@localhost share # ls -ld /mnt/win_d

drwxr--r--   16 dave     users       16384 Dec 31  1969 /mnt/win_d

root@localhost share # ls -ld /mnt/win_c

drwxrwxr-x    2 root     root           72 Mar 26 10:10 /mnt/win_c

root@localhost share #

```

Note that here, win_c is not mounted and win_d is mounted. If win_d is unmounted, its attributes look like win_c and vice versa.

Note that the windows machine can open the win_c directory share UNTIL win_c is mounted on the linux box.

I was wondering if the mounting procedure is what causes the windows machine to be denied access?

Thanks for your reply!

----------

## caffiend

firstly update /etc/hostname and be advised that the underscore is not a valid hostname character, it will cause problems with rfc compliant mail servers.

```
hostname moosejuice
```

```
smbclient -d 3 //moosejuice/win_c
```

and see where that gets you....

----------

## fusibou

 *caffiend wrote:*   

> firstly update /etc/hostname and be advised that the underscore is not a valid hostname character, it will cause problems with rfc compliant mail servers.
> 
> ```
> hostname moosejuice
> ```
> ...

 

Well, it was just a netbios name in smb.conf but I took it back out so it's localhost again.

Your code doesn't parse through smbclient, it rejects it.  I don't know if you meant this instead?

```

root@localhost etc # smbclient -L //localhost/win_d -d3

Initialising global parameters

params.c:pm_process() - Processing configuration file "/etc/samba/smb.conf"

Processing section "[global]"

added interface ip=192.168.1.100 bcast=192.168.1.255 nmask=255.255.255.0

added interface ip=127.0.0.1 bcast=127.255.255.255 nmask=255.0.0.0

Client started (version 2.2.8).

resolve_lmhosts: Attempting lmhosts lookup for name localhost/win_d<0x20>

resolve_hosts: Attempting host lookup for name localhost/win_d<0x20>

resolve_wins: Attempting wins lookup for name localhost/win_d<0x20>

resolve_wins: WINS server resolution selected and no WINS servers listed.

name_resolve_bcast: Attempting broadcast lookup for name localhost/win_d<0x20>

bind succeeded on port 0

Connection to localhost/win_d failed

```

But I get the same result if I use "share" instead of "win_d" and I know that share works fine.

Note: using Nautilus, I can browse my network and go into "share" and "win_c" (as long as it is unmounted) but I cannot get into win_d because it is mounted. This is the same behaviour as the windows box looking over the network.

----------

## joycea

 *fusibou wrote:*   

> Note: using Nautilus, I can browse my network and go into "share" and "win_c" (as long as it is unmounted) but I cannot get into win_d because it is mounted. This is the same behaviour as the windows box looking over the network.

 

You probably need to set the execute bit on the folders.   This required to get directory listings.  This sets it normally,

```
chmod a+x /mnt/win_c
```

however, you will probably want to look at the mode option of mount.  something like 

```
mount /dev/hda1 /mnt/win_c -o mode=022
```

(sorry, can't test to make sure the syntax is absolutely right above, but if should give you a very good starting point).

----------

## fusibou

 *joycea wrote:*   

>  *fusibou wrote:*   Note: using Nautilus, I can browse my network and go into "share" and "win_c" (as long as it is unmounted) but I cannot get into win_d because it is mounted. This is the same behaviour as the windows box looking over the network. 
> 
> You probably need to set the execute bit on the folders.   This required to get directory listings.  This sets it normally,
> 
> ```
> ...

 

You're absolutely right about the x bit. What happens is that when win_c or win_d are mounted, the attributes change so that only the owner can execute and no one else.

Thus: if root mounts, user dave can't access.

if dave mounts, user from windows machine over samba can't access

how do we mount and maintain execute access for everyone else?

note: I followed your code but it's had some nasty side effects... every mount of a filesystem c results in another copy on my desktop!! and umounts don't get rid of them... a reboot may be necessary.

----------

## fusibou

OK!

I fixed it. I needed to add the options umask=000 in the fstab file for each windows drive. Perhaps redhat defaulted to that?

NOW IT WORKS!

Thanks all for your suggestions.

 *fusibou wrote:*   

>  *joycea wrote:*    *fusibou wrote:*   Note: using Nautilus, I can browse my network and go into "share" and "win_c" (as long as it is unmounted) but I cannot get into win_d because it is mounted. This is the same behaviour as the windows box looking over the network. 
> 
> You probably need to set the execute bit on the folders.   This required to get directory listings.  This sets it normally,
> 
> ```
> ...

 

----------

## fusibou

 *fusibou wrote:*   

> OK!
> 
> I fixed it. I needed to add the options umask=000 in the fstab file for each windows drive. Perhaps redhat defaulted to that?
> 
> NOW IT WORKS!
> ...

 

I further decided to change it to umask=002 so remote windows system can read and execute but not right. Cool!

----------

## fusibou

 *Quote:*   

> 
> 
> however, you will probably want to look at the mode option of mount.  something like 
> 
> ```
> ...

 

Ever since I did this it seems that whenever I mount a filesystem I get two copies on my desktop and when i umount I only lose one. Anyone know how to stop this? (reboot didn't help)

----------

## joycea

I don't have too much experience with desktop environments -- prefer fluxbox myself.  It may help to know what you are running though.  It sounds like it is probably KDE?

----------

## fusibou

 *joycea wrote:*   

> I don't have too much experience with desktop environments -- prefer fluxbox myself.  It may help to know what you are running though.  It sounds like it is probably KDE?

 

Gnome 2.2.1. The behaviour happens regardless of whether root logs in or user. I must have changed some flag somewhere. I can't find any discussions on the web of your mount -o mode ### language.

Is there some page I can look at that discusses it? Maybe some flag got switched by mistake? Or it could be a coincidence I suppose but it happened right after.

----------

## HomerSimpson

I am still having problem writing to windows shares.

Where do I put the umask=000?

```
\\home-xpp\backup  /mnt/Backup  smbfs  user,umask=000
```

There?

Doesn't work.

I can mount other Linux drives using samba and they write fine but none of the Windows drives are writeable.

Thx

----------

## joycea

My first thought is have you tried forward slashes instead of backslashes on your SMB share location?  The \ is generally an escape character and while it may not be the specific problem here, it will at least remove one area of uncertainty.

```
//home-xpp/backup  /mnt/Backup  smbfs  user,umask=000
```

This looks like the correct format.  What does a 

```
ls -al /mnt/Backup
```

 return after mounting?

Second, do you have write permission to the Windows share in the first place?  Linux will pretend that it has the correct permission to write, but Windows will sometimes deny it at write time.  Is there a way you can check the operation from a Windows machine to just confirm that the Windows end is properly configured?

----------

## HomerSimpson

Thanks for the feedback. I have been using webmin to do the mounting for me and it writes the slashes this way \\

Of course I could manually edit the fstab file.

In webmin I had set the the fmask and dmask to 777. So my actual fstab line is:

```
\\home-xpp\shareddocs  /mnt/home-xpp  smbfs  user,fmask=777,password=my_password,dmask=777,username=my_username  0  0
```

I will experiment with the slashes going the other way but I did get it to work with the combination of fmask, dmask and messing with the Windows registry.

On the Windows XP computer I could not get rid of the read only flag on the directories I was sharing. It turns out Windows XP uses the read only flag to tell the OS that the folder view is customized. I found out that there is an entry in the registry that you can create to tell Windows to use the system flag instead of the read only flag. After creating, setting this registry flag and then rebooting and then from the command line running: 

```
attrib -r +s <directory>
```

 I can now write to my Windows shares. Doh!

This seems like a lot of work just to be able to write to a Windows share!

When I was running Windows 98 and Windows XP I did not have any problems so I suspect there is some other setting somewhere that was messing things up.

Strange thing is though if Windows was setting the read only flag and that was keeping the share for being writeable, why wouldn't the directory be read only from local access? That is the read only flag is set but locally it is not read only? What is up with that? I guess it is just another Windowsism.

Thanks

----------

## joycea

Glad to hear you worked it out.

Getting Windows and Linux to talk can be quite fun at times...

----------

## CrunchyB

 *fusibou wrote:*   

> OK!
> 
> I fixed it. I needed to add the options umask=000 in the fstab file for each windows drive. Perhaps redhat defaulted to that?
> 
> NOW IT WORKS!

 

Thank you  :Smile: 

I had the same problem, I knew it had something to do with rights after mounting, I just wasn't sure how to fix it.

----------

## sumanjay

 *fusibou wrote:*   

>  (for anyone with trouble browsing samba shares through Nautilus, ensure you've emerged gnome-vfs-extras!!)

 

Thanks a bunch for this! Finally fixed that irritating situation where I couldn't play shared files.

----------

