create new user

roger peppe roger.peppe at canonical.com
Thu Jun 11 17:06:04 UTC 2015


One thing I noticed: although the ubuntu user
is only in /var/lib/extrausers/passwd, that
user is made a part of the sudo group in /etc/group
which is read-only.

I tried adding an extra entry for the sudo group
to extrausers/{group,gshadow} with the new user
in, but that doesn't seem to do the trick.

Does this mean it's not possible to add new users
to existing groups in snappy?

FWIW I succeeded eventually in granting sudo access by adding
a new file in /etc/sudoers.d allowing sudo access to my new user.

(To start with I tried to add a the new user to a new group defined in
/var/lib/extrausers/group, but for some reason the extra group didn't
seem to be picked up when I sudo'd or logged in)

On 11 June 2015 at 17:18, Sergio Schvezov <sergio.schvezov at canonical.com> wrote:
> On Thu, Jun 11, 2015 at 03:51:25PM +0100, roger peppe wrote:
>> On 11 June 2015 at 15:27, Sergio Schvezov <sergio.schvezov at canonical.com> wrote:
>> > On Thu, Jun 11, 2015 at 03:13:01PM +0100, roger peppe wrote:
>> >> I'd quite like to make a new user on my snappy instance (so that I don't
>> >> need to use "ssh ubuntu at ..." every time), but I get this response:
>> >>
>> >> ubuntu at localhost:~$ sudo adduser rog
>> >> Adding user `rog' ...
>> >> Adding new group `rog' (1001) ...
>> >> groupadd: cannot lock /etc/group; try again later.
>> >> adduser: `/usr/sbin/groupadd -g 1001 rog' returned error code 10. Exiting.
>> >> ubuntu at localhost:~$
>> >>
>> >> What am I doing wrong?
>> >
>> > Nothing, /etc/group and /etc/passwd are read only.
>> >
>> > Someone needs to teach adduser to look at lib-nssextrausers
>>
>> So is there an accepted way of adding a new user, or
>> should I just live with ubuntu for now?
>>
>> Presumably you mean libnss-extrausers there? Interesting,
>> and not something I'd come across before. Perhaps I can
>> just manually add a line to
>> /var/lib/extrausers/{password,group,shadow,gshadow} ?
>
> Yes, it should work,
> http://bazaar.launchpad.net/~ubuntu-core-dev/livecd-rootfs/trunk/view/head:/live-build/ubuntu-core/hooks/01-setup_user.chroot
>
> I guess you will have issues with all the snappy commands and $HOME
> afterwards, but it's a good thing to start testing/instrumenting if
> you are up to it.



More information about the snappy-devel mailing list