# mixed network smb/nfs problems

## thecooptoo

I want to set up our gentoo router as a file server so that I can access web pages from either win98 or gentoo/mandrake linux. (Dreamweaver/html-kit from windows - doesnt run under wine last tiem I tried)

Im happy sorting out apache to configure a virtual host.

directory  on server to share /home/paul/public_html/index.html etc etc

                                                             /cgi-bin/ etc etc etc

server /etc/exports

/home/paul/                  *(rw,no_all_squash,sync)

/etc/smb/conf

encrypt passwords = yes ( samba compiled without ldap)

security = share

[paul]

comment =web server stuff

read only =no

writeable=yes

the only wa y i can write to the mounted filesystem from linux  and also from windows  is to chmod it to 777 ( not happy with this)

the problem I suspect is to do with user IDs

server 

router root # id paul

uid=1003(paul) gid=100(users) groups=100(users)

router root #

client :

[paul@dads paul]$ id paul

uid=501(paul) gid=501(paul) groups=501(paul)

[paul@dads paul]$

ive tried all sorts of things to make the share accessible without chmod 777 but havent managed it.

Not keen on wading my way through LDAP ( ive had a read and then had to go and have a lie down!)

I suppose NIS is also an option but ditto above on reading it.

Any other solutions so Im not chmodding to 777 on a network server/router??

----------

## easykill

yeah, you can map UID/GID files with nfs

you can stick lines such as the following in:

```

/home/paul    192.168.1.0/24(map_static=/etc/nfs/paul.map,rw,root_squash,sync)

```

then in /etc/nfs/paul.map:

```
uid 501    1003    #Map UID 501 on remote to 1001 on server

gid 501     100   #map GID 501 on remote to 100 on server

```

There are other things you can do (uid 500-999    1000 #map 500-999 to 1000-1499)  and htis is just an example.

As far as samba goes, I'm not sure.  The only things that I share writeable with any of my samba servers is my global scratch directory /repository on the file server, that IS chmod 777 because nothing important is ever in it.  It's simply a dedicated 20GB disk that any machines can write to for any reason.

You can try stuff like

[paul]

  comment=web server stuff

  browsable=yes

  writable=yes

  create mode=0777

  hosts.allow=192.168.1.

or something along those lines...i'm not sure if that will help

I recommend a search of samba/nfs docs for more info on this stuff.

That should get you going in the right direction though, I hope.

[edit]I noticed you said your gentoo router...I assume you have it connected directly to the internet

you definitely want to restrict clients to your LAN with NFS...it's always a bad idea to have any NFS/samba open to the internet, much less a writable one.  Make SURE you do that.

[/edit]

----------

## thecooptoo

NFS file sharing - doesnt

when I mount a share from the router it 'appears' to mount but I cant write to it , even though its exportsed with rw option and chmodded to 777

Something to do with UIDs

server

router root # id paul

uid=1003(paul) gid=100(users) groups=100(users)

router root #

client :

[paul@dads paul]$ id paul

uid=501(paul) gid=501(paul) groups=501(paul)

[paul@dads paul]$

not keen on wading through NIS for two users ( others are OK with SAMBA

trying nfs mapping:

# /etc/exports: NFS file systems being exported. See exports(5).

/home 192.168.1.0/24(map_static=/etc/nfs/paul.map,rw,root_squash,sync)

router logs # exportfs -ra

exportfs: /etc/exports:2: unknown keyword "map_static=/etc/nfs/paul.map"

does gentoo support map_static??

 changed /etc/passwd uid to 501 on server - still cant save to directory :-((

changing the UID to 1003 ( the server id) on the client and X wont start.

this is getting to be a real muddle.

the full story:

ive set up an apache webserver

and want to edit the webserver files from my machine.

I can SSH to the server as root and with nano and joe can edit/create files but id prefer to use quanta(and dreamweaver/wine eventually)

I mount the server tree (in /mnt/router) and can get to the apache directory(home/httpd/public_html)

- ie /mnt/router/home/httpd/public_html

could the fact that the apache server files are owned by 'nobody' (set within apache2.conf)

do i need to make a group comprising of

'apache', paul with a UID of 501( client), paul with a UID of 1003(server) )?

can anyone make sense of this - and sort it out?

router public_html # ls -la

total 58

drwxrwxrwx 4 root root 296 May 15 23:47 .

drwxrwxrwx 5 root root 160 May 15 23:18 ..

drwxrwxrwx 3 root root 72 May 13 16:43 admin

-rwxrwxrwx 1 nobody nobody 5165 May 14 21:55 cv1.htm

drwxrwxrwx 2 nobody nobody 280 May 14 22:49 img

-rwxrwxrwx 1 501 501 3192 May 15 23:47 index.html

-rwxrwxrwx 1 nobody nobody 2895 May 14 10:38 index2.htm

-rwxrwxrwx 1 nobody nobody 2264 May 14 08:16 que

----------

## usingloser

I am having the exact same problem.  I want to access my web files on my windows box too.

----------

## easykill

something to do that I don't particularly care for would be this

```

/home/paul         192.168.1.0/24(rw,all_squash,anonuid=1001,anongid=100)

```

but that will map all requests from your lan for /home/paul to make that user paul

that might be what you want

for more info, check out 

```

man exports

```

I'm not sure what to do about the samba thing.  I don't use samba for anything special. since I'm down to 1 windows machine in the house, and it's a laptop that can barely play movies.

----------

## ARC2300

Really stupid, but I just noticed it up above, is that your files are only for user root, group root.  That means they would have to be 777 for you to write to them (unless you can log in as root through Samba, but that's a bad idea).

I could be totally wrong though.

----------

## RosenSama

problem w/ anonuid and anongid is that it's a one way mapping.  when mounted on a client they will be permissioned with uid/gid from the server.

----------

## jice

There was some discussion of the use of map_static in /etc/exports.  Maybe the original poster can verify on his system, but as far as I can tell, gentoo's exportfs does not support it:

exportfs: /etc/exports:16: unknown keyword "map_static=/etc/export.map"

----------

## RosenSama

From what I've googled, map_static is an NFS v2 setting and current kernels offer v3 or v4.

----------

