- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Changing UID and GID will affect files from owners...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 11:06 AM
тАО05-14-2009 11:06 AM
I will change some UID numbers and some GID numbers too, If I do it will affect all the files owned by those users?
Is there anything I have to do to avoid a mess?
Thanks for your help.
PS OS is hpux 11.11
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 11:21 AM
тАО05-14-2009 11:21 AM
Re: Changing UID and GID will affect files from owners?
Ownership is based on the _number_ and hence if you simply change an account's uid/gid you must 'chown' the corresponding uid/gid of any file or directory that you want to remain associated with the account.
For example, if user "nancy" has a uid=500 and you want to chanage that uid to a value of 100, you could edit '/etc/passwd' or you could use 'usermod' against the account named "nancy".
Now, having changed your uid from 500 to 100 you would need to do:
# find / -user 500 -exec chown -R nancy {} +
You could find any orphaned (unowned) files too by doing:
# find / \( -nouser -o -nogroup \) -exec ls -l {} +
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 11:50 AM
тАО05-14-2009 11:50 AM
Re: Changing UID and GID will affect files from owners?
I should hasten to add, that recursive 'chown' operations can be dangerous unless you know the target contents.
I wrote:
# find / -user 500 -exec chown -R nancy {} +
You could find a _directory_ that met the criterion of uid=500 but that had _files_ within it that should remain owned by (for example) by 'root' or 'lp' that should NOT be chowned to "nancy"!
Be very careful! It would be better to do:
# find / -user 500 -exec ls -l {} + > /var/tmp/my500stuff
...and then edit /var/tmp/my500stuff to 'chown' each individual file or directory appropriately.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 11:57 AM
тАО05-14-2009 11:57 AM
Re: Changing UID and GID will affect files from owners?
That sounds like a lot of fun!!!
This users have like 1TB of info acroos the server :S
Any other suggestion to do it faster and safety?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 09:07 PM
тАО05-14-2009 09:07 PM
Re: Changing UID and GID will affect files from owners?
The size isn't important, it's the number of files and how many times you go through them.
>Any other suggestion to do it faster and safety?
I'm not sure there is anything wrong with one of JRF's suggestions, without -R:
find / -user 500 -exec chown nancy {} +
If there are multiple users/groups to change, you may want to find them all first, then change them later.
find / \( -user 500 -o -user 501 -o group 1000 -o -group 1000 \) -exec ll -d + > /var/tmp/files_to_change
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 09:25 PM
тАО05-14-2009 09:25 PM
Re: Changing UID and GID will affect files from owners?
As per JRF's post if you change any uid manually means you open passwd file and made a change then you need to run find command for changing the new uid for the old files
or else you change uid with the command "usermod" then no need to run the find command it will automatic take care of your file and directory.
# usermod ├в o -u 101 user01 # change the user├в s UID
If I am wrong please somebody correct it.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 10:07 PM
тАО05-14-2009 10:07 PM
Re: Changing UID and GID will affect files from owners?
here is the command
#usermod ├в o -u 101 user01 #change the user├в s UID
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-14-2009 10:09 PM
тАО05-14-2009 10:09 PM
Re: Changing UID and GID will affect files from owners?
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2009 12:44 AM
тАО05-15-2009 12:44 AM
SolutionSimple solution is do it through SAM. When you modify the UID for the users, SAM will give you a option like this,
=============================================
You are changing the UID for user "user1" from "149" to "1111". The
password file will be updated to reflect this change.
The UID is used to determine user file ownership. Would you like to
run a background task on this system to update all files owned by
this user to the new UID?
=============================================
Just give yes. SAM will change the ownership of all the old files with new uid.
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2009 09:08 AM
тАО05-15-2009 09:08 AM
Re: Changing UID and GID will affect files from owners?
Yes you're right! The SAM option was the faster way to do the changes.
Thank you all guys for your quick response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2009 09:10 AM
тАО05-15-2009 09:10 AM
Re: Changing UID and GID will affect files from owners?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2009 09:12 AM
тАО05-15-2009 09:12 AM
Re: Changing UID and GID will affect files from owners?
> The SAM option was the faster way to do the changes
Perhaps, but knowing how to use commands yourself is far superior. GUI stuff is fine for occassional use, but when you have repetitive tasks or want to automate an installation, etc. there's nothing like a CLI.
At the least, if/when you use tools like SAM, look at the logfiles it generates to *see* what commands were generated by your "clicks".
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-15-2009 01:28 PM
тАО05-15-2009 01:28 PM
Re: Changing UID and GID will affect files from owners?
True.
There are several definitions of "faster".
1) You have have more important things to do or learn.
2) You have a deadline. Also see 3).
3) You don't care how long it takes, just on how much time it takes to find and push a button.
4) How many times you are doing it.
5) And how long will it take to design and implement an optimal solution for massive similar requests.
(I.e. my suggestion on how to fix lots of UIDs and GIDs on a large filesystem(s).)