# Samba UID question

## Nicias

Lets say I am running a samba server, and a file on the share is owned by uid:gid 1000:1000, which has username joe. If someone mounts the share from a different machine with uid:gid: 2000:2000 and username joe, what happens?

What would be wonderful is if they saw the files as 2000:2000 but on the server they were really 1000:1000. Is that correct?

----------

## gerdesj

 *Nicias wrote:*   

> Lets say I am running a samba server, and a file on the share is owned by uid:gid 1000:1000, which has username joe. If someone mounts the share from a different machine with uid:gid: 2000:2000 and username joe, what happens?
> 
> What would be wonderful is if they saw the files as 2000:2000 but on the server they were really 1000:1000. Is that correct?

 

Short answer: Sorry, no.

The uid/gid are the only metadata stored by the filesystem.  The username to uid mapping belongs to the system doing the displaying of information.

The system mounting the share will display the username belonging to uid 1000 if it exists on that system - it does not know that uid 1000 is called joe on the server.  

That is why NIS was invented  - it provides a way of synchronizing user id to username mappings across multiple systems.  Without something like NIS or AD, LDAP n PAM or whatever you will have to do the job yourself.

Samba does have a manual mapping facility or two as well if you need that.  If you have a small set up, then moving uids is not too hard using find and chmod.

Cheers

Jon

----------

## Nicias

O well, I think I might still be ok. The samba server is a new machine, so I'll be able to make its uid's match the one client machine's uids no problem. The gids are a bit harder. It looks like the default gid for my users on the clients (Macs) are 20, which is way low, and will probably be grabbed in the install process by some sort of system group. But setting the setgid bit on all the directories should take care of that.

----------

## Nicias

I've been playing with samba on the machines I have now, and I doesn't do what you say it does. I have two users right now, with different uids on the two systems. 

Currently when I mount the share, it looks like all the files are owned by the username I mount the share with, with the permissions modified in some what that doesn't really make sense to me. I think maybe it just copies the relevant cluser (o,g,a) over three times if the file isn't owned by me.

Is there a way to just transparently pass on the unix permissions? I don't care if they are uid or username based. I will make the numbers match up on my new machine.

----------

