HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Useradd for creating system user

 
kumar_chandel
Occasional Contributor

Useradd for creating system user

I'm trying to create a user with root privileges. I'm trying to assign "/" as the home directory for the duplicate root user roota. Already the existing root user also has "/" as the home directoy.Is it possible to assign "/" as home directory for two users with same uid?

 

Please let me know whether the below command works or not:

 

useradd -ou 0 -g 0 -s /bin/ksh -d / roota

 

4 REPLIES
Hiren N Dave
Valued Contributor

Re: Useradd for creating system user

Yes, it will surely work.

I am an HP Employee

Was this post useful? - You may click the KUDOS! star to say thank you.
rariasn
Honored Contributor

Re: Useradd for creating system user

Hi:

 

Better to share the root password...

 

rgs,

Re: useradd for creating system user

If you are doing something as dangerous having two root users, you might as well use vipw(1m), especially if using the same home directory.

That way you use vipw(1m) to remove that user.

James R. Ferguson
Acclaimed Contributor

Re: Useradd for creating system user


kumar_chandel wrote:

I'm trying to create a user with root privileges.


Why?  As noted, using 'vipw' to replicate the root account as a renamed one is the easiest way.

 

*However* this is a very bad idea.  You should be using SUDO or RBAC to confer the privileges you apparently need to someone or something.  There are other ways, too, that are far less hazdardous then what you are trying to do. 

 

Audits and auditors aside, what happens one day when you or your sucessor, or even a colleage, decides to delete the account, named "kumar"?   Think what happens if I would do something like:

 

# find / -type f -user kumar -exec rm {} +

 

If my point isn't clear, would you do this?

 

# find / -type f -user 0 -exec rm {} +

 

Do you like rebuilding systems?

 

Regards!

 

...JRF...