Operating System - HP-UX
1752788 Members
6209 Online
108789 Solutions
New Discussion

Re: how to change the root equal id UID in hp-unix

 
rajesh73
Super Advisor

how to change the root equal id UID in hp-unix

we already created the root equal user ID(test) now we need to change the UID (tets) .

 

what is the procedure . if change the UID(test) , if their is any effect in root account. please confirm.

7 REPLIES 7
Patrick Wallek
Honored Contributor

Re: how to change the root equal id UID in hp-unix

>> created the root equal user ID

 

Created what?  What is a "root equal user ID"?  Are you using something like RBAC or something?  Can you please elaborate?

Bill Hassell
Honored Contributor

Re: how to change the root equal id UID in hp-unix

Are you saying that you created another root user (which is a user with UID=0)? If so, this is a very bad idea. It creates many very bad scenarios that you may not have understood. You need to read about the program sudo and how to allow selected users access to specific root commands. Here is a useful discussion about duplicate UID 0 accounts:

https://community.hpe.com/t5/System-Administration/Duplicate-root-user/td-p/3591386



Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: how to change the root equal id UID in HP-UX?

You are trying to remove the root capabilities for user test?

rajesh73
Super Advisor

Re: how to change the root equal id UID in HP-UX?

yes you are right.

we have already created test user . 

now the root and test user have same UID that is 0

so now i want to remove the test user account. if i remove the test user account we can expect any performance issue in server ?

Bill Hassell
Honored Contributor

Re: how to change the root equal id UID in HP-UX?

Your duplicate root user with UID 0 is just an alias to root.
The important question is: how did you remove the extra root user? Whatever you do, NEVER remove a UID 0 user with sam. Early versions of sam would ask you if you want to also remove all the files owned by this user. If you say yes, EVERY file owned by UID 0 will be removed...which destroys the entire computer!
Since you said you have already removed the duplicate root user, I assume that your system has not crashed and is still running.
The UID 0 alias, as mentioned before is a very bad idea, but it seems that you have rectified the situation. So there should not be any performance issue.


Bill Hassell, sysadmin
knowledgebase
New Member

Re: how to change the root equal id UID in hp-unix

You could also use sudo which is a better way to control privileges. As the last commentor mentioned it's bad practice, to have duplicated UID's of zero. You can install sudo via HP-UX Internet Express components for HP-UX 11i v3.

http://bit.ly/2kacPtj

bgwest
Occasional Advisor

Re: how to change the root equal id UID in HP-UX?

This is an example of a "c wrapper" I cobbled together for one of our lp scripts. We don't have sudo installed on our OS and wanted a way to evelvate a user when it is called from our db to modify our printers from a web portal. You could maybe use this idea with setresuid to change it's real ID and remove it in the same process? Hope that helps.. I've never been in that spot before.

/* real uid root wrapper for adding printers */

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <errno.h>

int main( int argc, char *argv[] )
{
  char String[255];
  setresuid(0,-1,-1);
  sprintf(String, "addqueue -i 5 -h %s -q %s -r off -t off -L AUTO -D on -b off", argv[1], argv[2]);
  system(String);
  return 0;
}
Benjamin G. West

"... I pass the hated wasteland with a grin, cause in the end I got my passions." -Aesop Rock