You are not logged in.

#1 2008-01-13 17:22:32

JTD
Member
From: Port Moody,BC
Registered: 2006-06-26
Posts: 27

NFS share and user id's

I'm experiencing some UID 'weirdness' on a NFS share on my server.
My user name on my Arch client is james and I created a user 'james' on the server.  It received a uid of 1004.
Now when I rsync my /home to the server, the owner is 1004 and not 'james'.

Should 'james' from the Arch client not be the owner of the directory and associated files?

The nfs share is mounted from /mnt/public on the server, with the appropriate r/w permissions but rsync isnot allowed to change the time/date stamp of the files.

Thanks in advance.

jtd

Offline

#2 2008-01-15 11:17:53

FUBAR
Member
From: Belgium
Registered: 2004-12-08
Posts: 1,029
Website

Re: NFS share and user id's

User ID's are mapped to numbers rather than usernames. If your user 'james' has uid 1004 on your Arch client, but on your server there's a user 'notjames' with uid 1004 then the files you copied to the NFS share as 'james' will be owned by 'notjames' on the server.

You need to keep the ID's in sync with each other on both server and client to prevent this. Write down / remember the uid of james on the server first.
Modify the uid of 'james' on the server to 1004 using

usermod -u 1004 james

. Then do a chown of all the files owned by james using

find / -uid ${olduid} -exec chown james {} \;

.


A bus station is where a bus stops.
A train station is where a train stops.
On my desk I have a workstation.

Offline

#3 2008-01-15 16:56:44

JTD
Member
From: Port Moody,BC
Registered: 2006-06-26
Posts: 27

Re: NFS share and user id's

FUBAR wrote:

User ID's are mapped to numbers rather than usernames. If your user 'james' has uid 1004 on your Arch client, but on your server there's a user 'notjames' with uid 1004 then the files you copied to the NFS share as 'james' will be owned by 'notjames' on the server.

You need to keep the ID's in sync with each other on both server and client to prevent this. Write down / remember the uid of james on the server first.
Modify the uid of 'james' on the server to 1004 using

usermod -u 1004 james

. Then do a chown of all the files owned by james using

find / -uid ${olduid} -exec chown james {} \;

.

FUBAR, thanks for the reply.  Before I do this I would like to clarify something.
'james' on Arch client has uid=1000 (primary user), whereas 'james' on server uid=1004.  I have another account on server that has uid=1000.
Therefore, if I do the chown as you pointed out, will the primary user on the server have its uid=1000 change automatically to something else?
Can I then chown 'james' on server from uid=1004 to uid=1000 to match the uid on the Arch client?

Basically donot want to screw up the permissions on the server end of things.

Thanks,

jtd

Offline

#4 2008-01-16 11:44:50

FUBAR
Member
From: Belgium
Registered: 2004-12-08
Posts: 1,029
Website

Re: NFS share and user id's

JTD wrote:
FUBAR wrote:

User ID's are mapped to numbers rather than usernames. If your user 'james' has uid 1004 on your Arch client, but on your server there's a user 'notjames' with uid 1004 then the files you copied to the NFS share as 'james' will be owned by 'notjames' on the server.

You need to keep the ID's in sync with each other on both server and client to prevent this. Write down / remember the uid of james on the server first.
Modify the uid of 'james' on the server to 1004 using

usermod -u 1004 james

. Then do a chown of all the files owned by james using

find / -uid ${olduid} -exec chown james {} \;

.

FUBAR, thanks for the reply.  Before I do this I would like to clarify something.
'james' on Arch client has uid=1000 (primary user), whereas 'james' on server uid=1004.  I have another account on server that has uid=1000.
Therefore, if I do the chown as you pointed out, will the primary user on the server have its uid=1000 change automatically to something else?
Can I then chown 'james' on server from uid=1004 to uid=1000 to match the uid on the Arch client?

Basically donot want to screw up the permissions on the server end of things.

Thanks,

jtd

It's probably easier and safer to change the uid on the Arch client from 1000 to 1004. That only implies one chmod and find command. On the server, you'll have to change the uid 1000 to something else (1005) and chown all his files, afterwards you can usermod uid 1004 to 1000 followed by the chown of his files.

usermod will complain if the new uid you try to give already exists, so it won't change the uid automatically.


A bus station is where a bus stops.
A train station is where a train stops.
On my desk I have a workstation.

Offline

#5 2008-01-17 15:02:26

JTD
Member
From: Port Moody,BC
Registered: 2006-06-26
Posts: 27

Re: NFS share and user id's

FUBAR, thanks man, that did the trick.  I also changed the group to 1004 and now when rsync'ing it shows up as 'james' like it should.

Cheers,

JTD

Offline

Board footer

Powered by FluxBB