How to create a user account with the same permission as "root" ?

Lars Eighner luvbeastie at larseighner.com
Thu Oct 11 06:15:33 PDT 2007


On Thu, 11 Oct 2007, williamkow wrote:

> Finally, I manage to setup X.org and then KDE 3.5.4 running on FreeBSD 
> 6.2-Release.

> I created a user account named "william" and do not assign any group as I
> do not know what are the list of group name for me to select. To start
> KDE, i use command "kdm" but I can only logon using the newly created user
> name "william", but it do not have same permission/access rights as "root"
> account.

> Please show on how to enable this user account, with the same permission
> as root ?

You cannot do exactly what you say you want to do.

What you can do is create an alias for root that has its own home
directory, choice of shells, etc.  Look at how toor is set up in
master.passwd.  You can set up william like toor by editing master.passwd
(always use vipw to edit master.passwd -- not a naked text editor -- but you
can use the editor of your choice if you set the EDITOR environmental
variable).  But this makes william an alias of root, not another user with
root permissions.  (That is william must be UID=0, etc.)

for example:

william:<encrypted password omitted>:0:0::0:0:Bourne-again \
       Superuser:/usr/home/william:/usr/local/bin/bash

in master.passwd will take you to /usr/home/william when you log in as
william, and your shell will be bash, but if you whoami, the answer is root.
Everything that goes by UID will identify you as root.  Basically because
you are root.

There are tons of reasons why this is a very bad idea, and you will probably
hear most of them, but they boil down to this:  You should not run as root.
You should should be acutely aware of when you are doing something as root,
and you should do as little as you possibly can as root.  You can put an
ordinary user william in the wheel group so he can assume root-like powers
when necessary, but when unnecessary he shouldn't.

There are also some okay reasons such as wanting a different shell or home
directory for your root alias.

-- 
Lars Eighner
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266



More information about the freebsd-questions mailing list