Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-05-2004, 10:54 PM   #1
LQ Newbie
Registered: Dec 2003
Posts: 3

Rep: Reputation: 0
changing uid, gid

I need to change the UID and GID of one user. Is it ok to just change them in /etc/passwd and /etc/group, or does that screw up something, like maybe cause a conflict in /etc/shadow? Thanks!
Old 01-06-2004, 07:50 AM   #2
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
Short answer: I'm not sure.

Longer answer: test it with a new user. Create some username and some files belonging to that user. Change the uid and gid of the user, log in as that user and see what happens.

I think it will probably mess up access to the files created with the old ids, as essentially this will be a different user to the one that created them.

Old 01-06-2004, 05:06 PM   #3
Senior Member
Registered: Dec 2001
Location: 35.7480° N, 95.3690° W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 46
usermod -u uid
usermod -g group

This will be their initial login group and must exist in /etc/groups

For more info
man usermod

Last edited by darthtux; 01-06-2004 at 05:12 PM.
Old 01-09-2004, 02:04 PM   #4
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Rep: Reputation: 30
I think you can just change it in the /etc/passwd file. It should be fine after he relogs in.
Old 01-09-2004, 11:53 PM   #5
LQ Guru
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
usermod is it...

usermod will not allow you to change the name of a user who is logged
in. You must make certain that the named user is not executing any
processes when this command is being executed if the user’s numerical
user ID is being changed. You must change the owner of any crontab
files manually. You must change the owner of any at jobs manually.
You must make any changes involving NIS on the NIS server.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
what is uid and gid rmanocha Linux - Software 9 08-18-2008 11:03 PM
What is my uid/gid? Jeebizz Slackware 2 11-22-2005 11:39 AM
How can I change a user's uid and gid? homesp Debian 2 05-31-2005 02:39 PM
vpopmail:- How can we efficiently use uid & gid amit_28oct Linux - Networking 4 09-30-2004 01:02 AM
Urgent help required for set UID/GID Permission Linux_interest Linux - Newbie 2 09-15-2004 08:27 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:13 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration