Need help on "net ads join" fails when we have "%" in the username - 2nd Try........

Richard Sharpe realrichardsharpe at
Mon Aug 31 15:07:01 UTC 2015

On Mon, Aug 31, 2015 at 4:07 AM, Rowland Penny <repenny241155 at> wrote:
> I do not think it will, I think the username/password will get expanded to
> 'test%user%password' and it will be read as the user test with a password of
> user%password or just user.
> I would never use '%' in a username, samba & windows both use it as a
> delimiter, but if you must use it, then this *may* work:
> net ads join -U test\%user%password

Unfortunately, that won't work. The shell is not doing the delimiter
separation. So, the net command will see two '%' chars and will
separate on the first.

What is needed is a change to the net command code.

Unfortunately, it is hard to tell customers that they are stupid.

If the OP cares to he can look at the code in source3/utils/net.c
around line 992 in the current master and he can see the parsing of
the -U parameter. It is pretty simple and could be modified to handle,
say \% as not a delimiter.

However, in bash/sh you would have to use \\% or enclose the string in
single quotes.

Another approach might be to allow the specification of a different
delimiter, like, say + or ^ etc.

Ahhh, the power of open source software.

Richard Sharpe

More information about the samba-technical mailing list