« Installing Nvidia drivers on FedoraHOWTO: Work with Services, auto start, stop, start »

HOWTO:Change the UID and GID on files

23/12/10

Permalink 05:24:37 pm, by richard Email , 174 words   English (GB)
Categories: Ubuntu Linux, Fedora, File systems

HOWTO:Change the UID and GID on files

Changing ownership of files when the UID/GID is obsolete or you need to change it for some other reason.

If you have changed or removed a UID for a user or GID a group, you must also change the flags set on the files belonging to these IDs. Otherwise you will have orphaned files.

Use find to locate and change the ownership of files. This command-line finds all files on the system owned by user UID and changes ownership to user newuser:

find / -user UID -print | xargs -t chown newuser

This variation changes the group ownership:

find / -group GID -print | xargs -t chgrp newgroup

NOTE: These examples assume a search of the entire system (including all mounted filesystems whether local or imported). To restrict the search to a single filesystem, use a top level path name instead of / (root). You may also want to skip mounted filesystems by including the -mount option.

Do not run this command when the old or new user is in use. Better still drop down to single user mode.

No feedback yet

Here are a collection of Mini-HOWTOs some of which are too short even for that grand title. I keep them around as it is easier to remember where to look these up that to remember the content of the mini-HOWTO

Search

Contents

open source blog