Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UID conundrum



On Sun, Jan 31, 2010 at 9:07 PM, jbk <jbk-SkCWf5sxpj0sV2N9l4h3zg at public.gmane.org> wrote:
> I have a backup server that runs backuppc and the backups are written to
> a set of usb disks that I rotate weekly. The Fedora is the distro. I
> have two partitions set aside so that I can rotate between the distro
> updates. Fedora 10 is currently running and I have installed F12 on the
> other partition.
> Here is the issue. BackupPc as its current UID owns the files and backup
> data on the usb drives. The UID that was assigned to backuppc in F10 has
> been usurped by another program in F12. This is a problem because I
> either have to not test my install and just change the UID on all the
> backup disks to match the new assigned UID, which takes an hour or more
> per disk, or I have to change the UID for the conflicting programs by
> editing the /etc/passwd file and group file entries.
> I have yet to boot into the F12 install.
> So, is it possible to edit the UID's and not effect the ownership of key
> files if I have yet to boot into the system. When do UID's become
> effective?

I'm not entirely sure what you are asking, but I will try my best to help.

When you run "chown" or the equivalent on a file to change its
ownership, the effect on the file is immediate.  Any NEW attempts to
access that file will  be based on the new UID.  Any programs which
already have the file opened will continue to be able to access it as
long as they keep that file open.

When you edit /etc/passwd (or the equivalent  NIS/LDAP database), the
effects will be immediate.  Again, any NEW attempts to login, run 'ls
-l' (gets UID to username matching) will be based on those changes.
Any programs which were already started will still have the same UID
and any new attempts by them to open files will use the previous UID
not anything related to what is currently in /etc/passwd for the
username under which they were started.

BTW, /etc/passwd (or equivalent) and usernames  is just an user
convenience as far as the kernel is concerned. The kernel looks only
at the numbers.   You can have files with UIDs which have no entries
in /etc/passwd as well as multiple entries in /etc/passwd with the
same UID.  Some user applications may get confused by this, but the
kernel neither knows nor cares about this.

You asked:

> So, is it possible to edit the UID's and not effect the ownership of key
> files if I have yet to boot into the system.

If you mean editing /etc/passwd, it will never change the UID of any
files.   Nor will running 'chown' do
anything related to /etc/passwd.    Whether you boot into the system
is irrelevant to the files ownership.  The UID of the file will stay
the same either way.  If you remember  that UID/username are connected
strictly by convention and that files are owned by UIDs not by
usernames, you can probably predict what will happen.

Bill Bogstad






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org