LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 05-29-2005, 10:20 AM   #1
homesp
Member
 
Registered: Feb 2004
Location: Tianjin,China
Distribution: RedHat9.0
Posts: 32

Rep: Reputation: 15
How can I change a user's uid and gid?


I want to change the only usual user (not root) on my Debian/GNU
How could I do that will take less risk effecting my installed software?
Is it enough that only change the file /etc/passwd ?
 
Old 05-29-2005, 10:32 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Use the usermod command.

man usermod
 
Old 05-31-2005, 02:39 PM   #3
thegeekster
Member
 
Registered: Dec 2003
Location: USA (Pacific coast)
Distribution: Vector 5.8-SOHO, FreeBSD 6.2
Posts: 513

Rep: Reputation: 34
Re: How can I change a user's uid and gid?

Quote:
Originally posted by homesp
I want to change the only usual user (not root) on my Debian/GNU
How could I do that will take less risk effecting my installed software?
Is it enough that only change the file /etc/passwd ?
If you're changing the numbers that identify a user and group, you will have to use the find command to change any files/directories with the old id numbers.....Plus you will need to edit the /etc/group file to change the gid number.....

To do this you will need to remember the old uid/gid numbers, then after making changes in the /etc/passwd file for the user id number, and the /etc/group file for the group id number, find and change any files/directories like so (as root to avoid possible error messages):

Changing user name
find / -uid <old uid number> -exec chown <new uid number or name> {} \;

Changing group name
find / -gid <old gid number> -exec chgrp <new gid number or name> {} \;


Of course, if you're only changing the user and group names without changing the uid/gid numbers, then you only need to make the changes in /etc/passwd and /etc/group and not worry about find any file or directories..........

HTH
 
  


Reply



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 Off
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
vpopmail:- How can we efficiently use uid & gid amit_28oct Linux - Networking 4 09-30-2004 01:02 AM
changing uid, gid zeke1955 Linux - General 4 01-09-2004 11:53 PM
change a user's gid eastj1974 Linux - Newbie 3 12-09-2003 04:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 08:48 AM.

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