Re: Adduser only one or. two users
On Thu, Aug 04, 2022 at 01:24:04PM -0400, Cindy Sue Causey wrote:
> On 8/4/22, Ishaan Mahajan <ishaanamahajan@gmail.com> wrote:
> > Hi,
> >
> > This is the line I have got - RUN sudo adduser --shell $USERSHELLPATH
> > --disabled-password --gecos "" $USERNAME && \
> > echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USERNAME && \
> > chmod 0440 /etc/sudoers.d/USERNAME
> > However, I keep getting the error,
> > adduser: Only one or two names allowed.--
> > How do I get around this?
> > Have a great day ahead!
>
>
> Does this line:
>
> chmod 0440 /etc/sudoers.d/USERNAME
>
> Need to continue using "$" as part of its variable?
>
> That stood out as different. If that's not it, I'm totally out on a
> very thin limb (beyond my payscale) here. :)
You're correct. That's one error, but not the one causing the message.
In order to find the other errors, we would need to know the contents
of the $USERSHELLPATH and $USERNAME variables.
Also, those should be "double quoted". "$USERNAME" in every instance.
Finally, this thing is using sudo to run adduser, but afterward it's
attempting to write to /etc/sudoers.d/$USERNAME without using sudo.
So, either that write is going to fail, or the sudo wasn't needed in
the first place.
Reply to: