Creating an Admin user After Installation - from the CLI
Tom H
tomh0665 at gmail.com
Mon Oct 14 23:58:54 UTC 2013
On Mon, Oct 14, 2013 at 3:39 PM, Amichai Rotman <amichai at iglu.org.il> wrote:
>
> I would like to manually add a new user to my Ubuntu 12.04 box with admin
> privileges.
>
> This is what I did so far:
>
> adduser <username>
>
> adduser <username> admin, sudo
>
> Edited the sudoers file with visudoers:
>
> # User alias specification
> ...
>
> User_Alias ADMINS = <username>
>
> ...
>
> # User privilege specification
>
> ...
>
> <username> ALL=(ALL) ALL
>
> ...
>
> I then logged in with the new user, but every time I try to run a command
> (like visudoers) it says the command is not found. when I
>
> echo $PATH
>
> the /bin/sbin directory is not in the path.
>
>
> Is there a similar command to adduser but for admin users (so it copies the
> root user skeleton at the end (copy /etc/skel)?
>
> How do I manually create a user like the one I create as the first user when
> installing Ubuntu?
If you've add that user to the "sudo" and "admin" groups (redundantly;
the default sysadmin user created at installation time isn't a member
of the "admin" group), you don't need to add a "<username> ALL=(ALL)
ALL" line. Furthermore, should you want to add something to
"/etc/sudoers" I'd advise you to use "visudo -f
/etc/sudoers/<filename>" in order to take advantage of "#includedir
/etc/sudoers.d" at the end of the "/etc/sudoers" file rather than edit
it.
Have you changed anything else in "/etc/sudoers"? In 12.04 it has
'Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"'
inserted at the top, which sets the path for the run_as user.
More information about the ubuntu-users
mailing list