# smbmount ignores uid= and gid=

## Special K

hallo,

i've got 2 gentoo boxes (pc1, pc2). Both providing samba shares, while pc2 is the newer pc. 

/etc/samba/smb.conf is similar on both machines.

when i mount pc1's shares at pc2 i'll get what i expect:

#mount -t smbfs //pc1/share /mnt/smbpc1/share/ -o username=smbuser,gid=specialk,uid=users

#ll /mnt/smbpc1/share/

drwxr-x---    1 specialk  users        0 20. Jun 03:49 Develop

Now the problem:

on pc1: when i mount pc2's shares an pc1 it ignores 'gid=' and displays the gid of specialk from the shares pc (pc2)

#mount -t smbfs //pc2/share /mnt/smbpc2/share/ -o username=smbuser,gid=specialk,uid=users

#ll /mnt/smbpc2/share/

drwxr-x---    1 409  users        0 20. Jun 03:49 Develop

I can try using cifs or other gids it'll always mount with permissions not usable for my local 'specialk' user. I will always get errors depending on having not enough permission.( gid of user specialk is different on pc1 and pc2)  specialk can't access files owned by 409, ok but  why does pc1 need to ignore my gid= ?? this sucks.  :Evil or Very Mad: 

I also updated samba on both machines from 3.0.10 to 3.0.14a but no change.

 :Mad:   what is going on?

----------

## gstrock

I have this exact problem now at work and it's

driving me nuts.  I have a machine running Debian

with a 2.4 kernel and it works.  But it won't work

with the 2.6 kernel.

----------

## WhiteKnight

Same problem here.

I can mount with mount.cifs as normal user and as root.

But I am not able, to mount in a way so my normal user has write permissions...

It always maps the user/groups of the remote system on mine...

Any ideas, folks?  :Smile: 

Cheers,

WK

-edit-

I use this in my /etc/fstab:

```
//cifs-server/share /home/wk/tmp  cifs    umask=000,noauto,user,guest,rw,uid=users 0 0
```

with smbmount it's no problem at all....

----------

## drax_

A uid and a gid are numbers.

----------

## WhiteKnight

Okay, you're right  :Smile: 

so I changed in my fstab 

```
uid=users
```

 ( which was stupid in any case, cause users is a group  :Wink:  )

into: 

```
uid=1000
```

But that didn't change anything... the "remote files / dirs" always get mapped my local apache user and group, cause the uid and gid are the same on my and the remote system.

Any further ideas?

Or does anybody see another mistake I made?

Cheers,

wk

----------

## drax_

I mis-read, I though u were mounting samba shares.

man mount.cifs

 *Quote:*   

> 
> 
>        uid=arg
> 
>               sets the uid  that  will  own  all  files  on  the  mounted
> ...

 

 *Quote:*   

> 
> 
>        gid=arg
> 
>               sets  the  gid  that  will  own  all  files  on the mounted
> ...

 

1. I was wrong. It apparently takes both formats (numbers, and names)

2. It's pointless since parameter  is  ignored when the target server supports the CIFS Unix extensions. which seems to be your case. Am I right?

What you need to do, is somehow share your user database (NIS, LDAP, or copying by hand  :Smile: ). If the uid's on your server and client match, then your mounted share will automagically, have the correct ownership.

----------

## WhiteKnight

Shame on me I didn't read the man page  :Sad: 

And yes you're right, the server I want to mount shares from supports unix CFIS extension, cause it's an actual version of samba server.

And I'm so stupid!!  :Smile: 

I already told above, that those files are mapped to my local apache-user and apache-group.

So.... what kept me from setting my user account into the apache group...?  :Wink: 

I will try this later and report success or failure in.

Thanks for that tipp!

WK

----------

## WhiteKnight

It's really strange...

I finally tried the above mentioned.

I put my user "wk" into the group "apache".

The dir listing shows:

```
 4 -rwxrw-r--  1 apache apache    475 16. Nov 00:25 test.php

  4 -rwxrw-r--  1 apache apache     40 28. Okt 19:15 web
```

So I should have write access. But I don't have!

After changing (as root on my machine, _not_ on the remote) to:

```
 4 -rwxrw-rw-  1 apache apache    475 16. Nov 00:25 test.php

  4 -rwxrw-rw-  1 apache apache     40 28. Okt 19:15 web
```

I have proper write permissions and it's working...

But somehow not really okay, cause my editor tells me every few seconds, that the file has been changed....

And somehow I think it should work, when I'm in the apache group, so I don't need to change the write-permissions for all users!

Any hint's what else could be somehow wrong?

----------

## blixel

 *drax_ wrote:*   

> I mis-read, I though u were mounting samba shares.
> 
> man mount.cifs
> 
>  *Quote:*   
> ...

 

Is there no other way to specify a uid and gid?  My shares get mounted with 440 permissions and there's nothing I can do to change that.  (Meaning, I can't make them 444 instead.)  When I mount the share, it is owned by uid 502 and gid 501 on my system.  Since the permissions don't allow for world access for reading, I have no way to access the files - even though my login credentials allow it.

If I can't set the uid/gid at the time of mount, is there a way I can remap the uid and gid so that my system "sees" them as I want?

----------

