Re: Hyphen-minus passwd

2024-03-07 Thread Nicolas George
Greg Wooledge (12024-03-07):
> Looks like you want the -- to separate options from non-option arguments,

Of course.

> What threw me for a
> few moments was that "-salt username" is a single option with argument.
> I wasn't expecting "username" to be the salt.  It looked like a non-option
> argument at first.

Yes, that is super weird, possibly a mistake. All the more reason to
have the original poster clarify their needs.

Regards,

-- 
  Nicolas George



Re: Hyphen-minus passwd

2024-03-07 Thread Greg Wooledge
On Thu, Mar 07, 2024 at 06:59:47PM +0100, Nicolas George wrote:
> ~ $ perl -e 'print crypt("-password", "\$6\$username\$"), "\n"'
> $6$username$FCvGwi21H/uVp89BtnZHWQsL.vZKajZ3lRbfB7Jnjr2C.5qBgx7TB3Ul3PbcyCIArts/C2lfQgYOLp418oH7C0

hobbit:~$ openssl passwd -6 -salt username -- -password
$6$username$FCvGwi21H/uVp89BtnZHWQsL.vZKajZ3lRbfB7Jnjr2C.5qBgx7TB3Ul3PbcyCIArts/C2lfQgYOLp418oH7C0

Looks like you want the -- to separate options from non-option arguments,
where the only non-option argument is "-password".  What threw me for a
few moments was that "-salt username" is a single option with argument.
I wasn't expecting "username" to be the salt.  It looked like a non-option
argument at first.



Re: Hyphen-minus passwd

2024-03-07 Thread Nicolas George
Lee (12024-03-07):
> You're going to rag on him for not copy-pasting EXACTLY when you could
> have just told him the standard way to get a leading hyphen accepted
> on the command line is to backslash escape it!??

Uh, yes, of course. And that would be best even if your answer was not
wrong.

-- 
  Nicolas George



Re: Hyphen-minus passwd

2024-03-07 Thread Nicolas George
Lee (12024-03-07):
> $ openssl passwd -6 -salt username \\-password
> $6$username$7 ..etc..

Wrong answer: this gives the encrypted string for “\-password”, not for
“-password”.

~ $ openssl passwd -6 -salt username \\-password
$6$username$7Vzj6uFI0bs770qb.tIdqyMDbBWCoF93TKbZ7GSmU0ktiCcMu5rxgjpumDUram2ulYhVlWycvUMf1jGKbu8sC1
~ $ perl -e 'print crypt("-password", "\$6\$username\$"), "\n"'
$6$username$FCvGwi21H/uVp89BtnZHWQsL.vZKajZ3lRbfB7Jnjr2C.5qBgx7TB3Ul3PbcyCIArts/C2lfQgYOLp418oH7C0
~ $ perl -e 'print crypt("\\-password", "\$6\$username\$"), "\n"'
$6$username$7Vzj6uFI0bs770qb.tIdqyMDbBWCoF93TKbZ7GSmU0ktiCcMu5rxgjpumDUram2ulYhVlWycvUMf1jGKbu8sC1

-- 
  Nicolas George



Re: Hyphen-minus passwd

2024-03-07 Thread Lee
On Thu, Mar 7, 2024 at 12:50 PM Nicolas George wrote:
>
> Computer Planet (12024-03-07):
> > How can I create this password with a hyphen in front?
> >
> > # openssl passwd -6 -salt username -password
> >
> > This is the response message when I try:
> > passwd: Unknown option: -passwd
>
> Hi. No it is not. Start by copy-pasting EXACTLY what is in your
> terminal.

You're going to rag on him for not copy-pasting EXACTLY when you could
have just told him the standard way to get a leading hyphen accepted
on the command line is to backslash escape it!??

rude



Re: Hyphen-minus passwd

2024-03-07 Thread Lee
On Thu, Mar 7, 2024 at 12:44 PM Computer Planet  wrote:
>
> Hi guys!
> Please, Can someone help me?
>
> How can I create this password with a hyphen in front?
>
> # openssl passwd -6 -salt username -password
>
> This is the response message when I try:
> passwd: Unknown option: -passwd
>
> Thanks for reply!

$ openssl passwd -6 -salt username \\-password
$6$username$7 ..etc..



Re: Hyphen-minus passwd

2024-03-07 Thread Nicolas George
Computer Planet (12024-03-07):
> How can I create this password with a hyphen in front?
> 
> # openssl passwd -6 -salt username -password
> 
> This is the response message when I try:
> passwd: Unknown option: -passwd

Hi. No it is not. Start by copy-pasting EXACTLY what is in your
terminal.

Also, do not be root when you do not need to.

Regards,

-- 
  Nicolas George