Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Rails application that is on a virtual machine (RHEL 6) and it's database is on dedicated hardware (also RHEL 6).

The app server has an NFS directory from the db server mounted and accessible. It needs to write images to that server that are uploaded via the app.

Background processes on the db server need to read and write to the same directory, as they perform resizing operations on the uploaded files.

Right now none of this is working, because the user ids are different between the two systems. I only need this to work for this one application, so it is way too much overhead to put an LDAP system in place.

Can I simply change the user id of this one user in one of the systems, or will that cause mass chaos?


The fix worked, at least on local devices. Unfortunately the device I have mounted to the main db server still thinks my user id is 502 instead of 506. Do I need to remount that device, or is there an NFS daemon I can stop and restart to refresh it?

share|improve this question
up vote 2 down vote accepted

Changing the user IDs to match should work. Make sure the ID that you switch to is not already in-use on the system. Also make sure you update the ownership of the users home directory and files to reflect the new userid.

If you are using NFS a lot, then ideally you should also be using some kind of centralized authentication system like LDAP, or NIS.

share|improve this answer
Seems we both had the same idea. You just beat me to it. – Tonny Oct 5 '12 at 19:31
hiss NIS is the evil. Trust me. I've been supporting that mess for years. – Magellan Oct 5 '12 at 19:49
@Adrian Been there, done that. 3 Years dealing with YellowPages between Solaris, Ultrix, Aix, Sco Openserver and Intergraph (that last one being the worst SystemV abomination I have ever seen). When some PHB returned from a Microsoft sales-talk and insisted to integrate NT4 with "Unix Services for Windows" in that mess I completely lost it. It took 3 colleagues to stop me from hitting him over the head with a keyboard. Was a Model-M, would have been really ugly. If it hadn't been for my own boss and my colleagues who stood up for me, I would have been fired and likely charged with assault. – Tonny Oct 8 '12 at 21:31
Hilarious. I thought you were talking to me. My name is Adrian. And yet I'm user76177 ;-) What are the odds? – AKWF Oct 11 '12 at 3:47

I presume you mean editting the passwd file to change the numerical UID for that user so it matches the numerical value of the UID on the other system.

It's doable, if the set of files/folders belonging to this user is relatively small and well-defined. Bear in mind that all existing files/folders have their permissions currently set to the original UID. You will need a lot of chown:chgrp command to make sure everything point to the correct id's.

I'm not entirely sure how ACL's would react to this. Never had reason to try it.

It is best to do the changes to the passwd file while in single-user mode and then reboot the system. That will prevent possible issues with running software getting the carpet yanked from under it.

share|improve this answer
Going to singe-user mode just to change a UID seems a bit overly cautious. Just run lsof -n -u username make sure nothing is running. Then use usermod, or vipw to safely edit your password file. A command like find / -uid oldid would help you quickly find the old IDs you need to fix. – Zoredache Oct 5 '12 at 19:35
Zoredache: You are right. But if you can the afford the single-user downtime doing it that way may just be as easy. Should have mentioned the find command myself. – Tonny Oct 5 '12 at 19:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.