[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Adduser only one or. two users



On Thu, Aug 04, 2022 at 12:17:54PM -0600, Charles Curley wrote:
> On Thu, 4 Aug 2022 13:23:11 -0400
> Dan Ritter <dsr@randomstring.org> wrote:
> 
> > sudo adduser --shell $USERSHELLPATH --disabled-password --gecos ""
> > $USERNAME
> > 
> > That's your first command line. --gecos expects a value. You are
> > literally supplying no value.
> > 
> > Why don't you leave the --gecos "" out entirely, if you aren't
> > going to populate it with a human-readable name?
> 
> I'll second this one, and add, you should quote variable names in order
> to avoid spaces in the variables screwing things up. So: "$USERNAME",
> not $USERNAME. What happens if the user name is Fred Flintstone?

This is very good advice. The variable values get expanded in-place,
so a white space in the value will wreak havoc.

Folks, always quote your variables :-)

Same goes for $USERSHELLPATH, it should be "$USERSHELLPATH".

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: