Changing UID & GID for existing user
Hi All,
I just have small query. What will the effect of changing the UID and GID of the existing normal user in Linux. How can I set his new UID & GID to all existing files & folders? The below code will for this? Quote:
Regards, Yogesh |
I don't know why would you want to do this, but anyway: after you change the uid and gid, you will need to use the chown command to change all existing files.
|
Hello,
The usemod command specified will change the id's but only on files within the users home directory by default. If there is a chance that the "user" concerned owns any other files outside of his ~ directory then perhaps the solution would be to use the find command to recursively check the id's of files then make amendments where appropriate. Reasons for changing the id's can vary. I personally have done the same as I have 2 Linux Servers, with 1 of them acting as a backup. I created identical accounts on the backup server with identical uid's and gid's as the original. This way data transferred between the 2 boxes maintains exactly the same permissions... Rawcous! |
Surprised by lack if info online on the impact of usermod -g and -u switch(on permissions)
permissions and usermod -u and -g switch ,OBSERVATIONS WHILE WORKING WITH THESE:
1.ALWAYS COMPARE BETWEEN HOME DIR AND CURRENT USER oN which command being applied 2.COMPARE WHAT?User ONLY NOT Group(EVEN WITH -g switch) IE WHETHER User OWNING HOME DIR MATCHES CURRENT User on which switch being applied (incase of UID change with -u switch HOME DIR owner needs to be either the present user or the new UID user) ONLY THEN DESCEND INTO POINT 3(TOUCHING PERMISSIONS INSIDE DIR) 3.USER/GROUP OWNERSHIP FOR FILES INSIDE DIR CHANGED TO NEW VALUE ONLY IF 'THE USER'S UID(FOR -U SWITCH)/GID(FOR -G SWITCH)' WAS BEING USED BY FILE FILES NOT HAVING THE OLD UID/GID ARE NOT TOUCHED TO REFLECT A NEW UID/GID 4.FILES/DIR OUTSIDE HOME DIR NEED MANUAL INTERVENTION THRU COMMAND !!same principle applies to permission of home dir itself |
Um...probably a typo, but the command is usermod
Yes, changing uid/gid to have consistency between servers is a good idea. |
Quote:
|
All times are GMT -5. The time now is 01:35 PM. |