1847411 Members
2600 Online
110264 Solutions
New Discussion

Re: grp question

 
SOLVED
Go to solution
subhashni
Regular Advisor

grp question

Hi,
What is the quality procedure to change the uid or username in hp.userdmod seems to work fine for users home directory.but what happens to the dir and files that are owned by the user - will it be affected.Is there any option to usermod command that can take care of all the dir,files owned by the user who's uid is changing.thanks in advance .
unix4me
4 REPLIES 4
RAC_1
Honored Contributor

Re: grp question

If you change user name and keep same uid, then you don't need to do chown on files. But if you change uid, you need to do chown on files afterwards. usermod or SAM is OK in doing this.
There is no substitute to HARDWORK
Bill Hassell
Honored Contributor
Solution

Re: grp question

HP-UX (and all Unix systems) only know about the UID (user ID number) and that is what is stored in the filesystem for each file. You only see a username when using ll (ls -l) because this command searches /etc/passwd for a match to the UID number. So the only situatin where ownership would be a problem would be in changing the UID. The username can be changed at anytime. NOTE: never edit /etc/passwd to change the username unless you know the system is NOT Trusted and is NOT using shadow passwords.

If you do indeed change the UID, then you'll need to manually change the ownership of the affected files and directories. This is difficult to automate since you'll have to search /home, /var/tmp and /tmp plus any other user-writable directories on your system.


Bill Hassell, sysadmin
James R. Ferguson
Acclaimed Contributor

Re: grp question

Hi:

In cases like this, you may want to search more than just the user's home directory, as Bill notes. You will find these variations helpful:

# find /home /var /tmp -xdev -user 50
# find /home /var /tmp -xdev -user jrf
# find /home /var /tmp -xdev -nouser
# find /home /var /tmp -xdev -user 50 | xargs chown jrf

See the 'find' manpages for more information.

Regards!

...JRF...
Peter Nikitka
Honored Contributor

Re: grp question

Hi,

I want to add, that manual (re)setting of ownership IS required if
- you have NIS(+) AND
- there data with the previous userid on remote hosts, esp. not under automounted directories

Something like
find mydir -xdev -user | xargs chown

will do it.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"