Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
usermod -u new_uid -g new_gid user_name
Regards,
Yogesh
Last edited by yogesh_attarde; 02-06-2014 at 05:13 AM.
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.
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...
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.
There are lots of good reasons for wanting to do this.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.