System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

changing UID of user sshd tftp and hpsmh

SOLVED
Go to solution
Ahmed_58
Regular Advisor

changing UID of user sshd tftp and hpsmh

Hi,
we upgrade the server to OS 11.23 and noticed the UID which was assign to other users now takin by "sshd" "tftp" and "hpsmh" users which are been created by OS. Can I change those UID?
14 REPLIES
Kapil Jha
Honored Contributor

Re: changing UID of user sshd tftp and hpsmh

you upgraded from 11.11 or 11.00,
anyways you can change the ids, just shutdown the subjected services and change the ID and restart the service.

check passwd again for any duplicate UID.

BR,
Kapil+
I am in this small bowl, I wane see the real world......
Ahmed_58
Regular Advisor

Re: changing UID of user sshd tftp and hpsmh

are you sure will not cause any problem, as some files belong to hpsmh already assign as owner

example below
drwxr-x--- 2 hpsmh hpsmh 96 Nov 11 14:08 logs
drwxr-xr-x 3 hpsmh hpsmh 96 Nov 11 14:08 session
dr-xr-x--- 2 root hpsmh 96 Nov 11 14:08 sslshare
drwxr-x--- 2 hpsmh hpsmh 96 Nov 11 13:23 tmp
Dennis Handly
Acclaimed Contributor

Re: changing UID of user sshd tftp and hpsmh

>are you sure will not cause any problem, as some files belong to hpsmh already assign as owner

That's why you change your existing users and not the reserved system UIDs.
Ahmed_58
Regular Advisor

Re: changing UID of user sshd tftp and hpsmh

will my existing user must use the sam UID as it is our DR and must match the production.
Dennis Handly
Acclaimed Contributor

Re: changing UID of user sshd tftp and hpsmh

>as it is our DR and must match the production.

You may have to schedule some time to change them.
James R. Ferguson
Acclaimed Contributor
Solution

Re: changing UID of user sshd tftp and hpsmh

Hi:

Unfortunately, HP-UX has long considered "user" UIDs to begin at 100 leading to the annoying conditions you describe.

You can change the UID of an account by editing '/etc/passwd' (using 'vipw' to be safe) and then changing the ownership of the directories and files that belong to the *old* UID to the new UID. You might want to first create a file of the old UID like this (by example):

# find / -user 100 -print > /tmp/olduid_100

Then, for example, if you were changing UID 100 to UID 200, edit '/etc/passwd' to change UID 100 to UID 200 and do:

while read NAME
do
chown 200 ${NAME}
done < /tmp/olduid_100

As noted, you may need to schedule some downtime if there are active processes (daemons, etc) associated with the changing UID.

Regards!

...JRF...


Dennis Handly
Acclaimed Contributor

Re: changing UID of user sshd tftp and hpsmh

>JRF: while read NAME; do chown 200 ${NAME}

If you want performance, you should use xargs:
xargs -tn80 chown 200 ${NAME} < /tmp/olduid_100

Kapil Jha
Honored Contributor

Re: changing UID of user sshd tftp and hpsmh

usermod is the command which would do it seemlessly.

#usermod -u new_id user

man usermod

BR,
Kapil+
I am in this small bowl, I wane see the real world......
Kapil Jha
Honored Contributor

Re: changing UID of user sshd tftp and hpsmh

plus you do not need to do any chown

BR,
Kapil+
I am in this small bowl, I wane see the real world......
Dennis Handly
Acclaimed Contributor

Re: changing UID of user sshd tftp and hpsmh

>Kapil: plus you do not need to do any chown

It isn't documented that usermod(1m) performs the chown(1) operation, so I would assume it doesn't.
Kapil Jha
Honored Contributor

Re: changing UID of user sshd tftp and hpsmh

it does not change files outside user's home directory, but it does whatever inside home directory.

BR,
Kapil+
I am in this small bowl, I wane see the real world......
James R. Ferguson
Acclaimed Contributor

Re: changing UID of user sshd tftp and hpsmh

Hi (again):

> Dennis: If you want performance, you should use xargs

Yes, of course. In fact, we can eliminate the intermediate file and its attendant I/O and do:

# find / -user 100 -print|while read NAME;do echo ${NAME};done|xargs -t chown 200

As Dennis inferred, using the '-t' option with 'xargs' gives you a trace of the command and its arguments that are being executed.

Regards!

...JRF...

Dennis Handly
Acclaimed Contributor

Re: changing UID of user sshd tftp and hpsmh

>JRF: we can eliminate the intermediate file and its attendant I/O and do:

You may want that file for your records, or to do the chmod in chunks.

>using the '-t' option with 'xargs' gives you a trace of the command

Oops, that should have been -tn80 (or an even larger number).
Dennis Handly
Acclaimed Contributor

Re: changing UID of user sshd tftp and hpsmh

># find / -user 100 -print | while read NAME; do echo ${NAME}; done | xargs -t chown 200

 

Hmm.  If you eliminate the file, there is no need for that while and xargs:

fine / -user 100 -exec chown 200 {} +