Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Gentoo Chat
  • Search

'passwd' password generator

Opinions, ideas and thoughts about Gentoo. Anything and everything about Gentoo except support questions.
Post Reply
  • Print view
Advanced search
25 posts • Page 1 of 1
Author
Message
one_red_eye
n00b
n00b
Posts: 42
Joined: Sat May 21, 2005 7:18 pm
Location: North Dakota

'passwd' password generator

  • Quote

Post by one_red_eye » Fri Jul 08, 2022 7:37 pm

I like using the passwords generated by 'passwd'. Is there a way to use this mechanism to generate passwords without having to SSH into a linux machine?

Code: Select all

You can now choose the new password or passphrase.

A valid password should be a mix of upper and lower case letters, digits, andother characters.  You can use a password containing at least 7 characters
from all of these classes, or a password containing at least 8 characters
from just 3 of these 4 classes.
An upper case letter that begins the password and a digit that ends it do notcount towards the number of character classes used.

A passphrase should be of at least 3 words, 11 to 72 characters long, and
contain enough different characters.

Alternatively, if no one else can see your terminal now, you can pick this asyour password: "Gun6urge5isaac".

Enter new password:
"99% of the people in this world are fools, and the rest of us are in great danger of contagion."
Top
alamahant
Advocate
Advocate
Posts: 4033
Joined: Sat Mar 23, 2019 12:12 pm

  • Quote

Post by alamahant » Fri Jul 08, 2022 9:38 pm

[Administrator edit: As reported down thread, the mechanism in this post is not suitable for quality passwords, and should not be used. Readers should refer to later posts in the thread for stronger mechanisms of generating passwords. -Hu]

Hi

Code: Select all

date | md5sum
Should work in powershell also.
Maybe mac.
:)
Top
Hu
Administrator
Administrator
Posts: 24395
Joined: Tue Mar 06, 2007 5:38 am

Re: 'passwd' password generator

  • Quote

Post by Hu » Fri Jul 08, 2022 9:46 pm

one_red_eye wrote:I like using the passwords generated by 'passwd'. Is there a way to use this mechanism to generate passwords without having to SSH into a linux machine?
You can use this when logged in locally, too. There is no need to ssh to a remote machine to run this command. Do you mean you are using some non-Linux system which lacks this command, and you want to run the command anyway?
Top
one_red_eye
n00b
n00b
Posts: 42
Joined: Sat May 21, 2005 7:18 pm
Location: North Dakota

  • Quote

Post by one_red_eye » Fri Jul 08, 2022 10:05 pm

I use an Android device to SSH to a computer. There is no end to password generator websites and apps. I want to generate passwords based on the pattern above because I can actually remember them.

{word} {number or special character} {word} {number or special character} {word}
"99% of the people in this world are fools, and the rest of us are in great danger of contagion."
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4693
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Sun Jul 10, 2022 6:30 am

That shouldn't be too hard to script.
You need to have some dictionary file to parse and the hardest part is done.
..: Zucca :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Sun Jul 10, 2022 3:46 pm

Dealing with special characters can cause some issues with output, but maybe that's my limitation.

Anyway, a basic start from which you can choose your own special characters: shuf -n 3 /usr/share/dict/words
Quis separabit? Quo animo?
Top
Hu
Administrator
Administrator
Posts: 24395
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sun Jul 10, 2022 3:53 pm

The requirements still seem strange to me. You want to use neither a website nor an Android app, and you want to do this from an Android smartphone, so you don't have access to a proper Linux environment where you could just run passwd. Given those constraints, what can you run that could produce any output, while being local, not a website, and not an Android app?

If we set that aside and say you just need a Linux script, then this should do it:

Code: Select all

#!/bin/bash

set -eu
declare -a w n
w=( $( shuf -n3 /usr/share/dict/words ) )
n=( $( shuf -n2 -e \! \" \# \$ \% \& \' \( \) \* \+ \, \- \. \/ \: \; \< \= \> \? \@ \[ \\ \] \^ \_ \` \{ \| \} \~ ) )
printf '%s%s%s%s%s\n' "${w[0]}" "${n[0]}" "${w[1]}" "${n[1]}" "${w[2]}"
The most time consuming part turned out to be getting the special characters, because I wanted bash to generate those from a brace expansion. Once I gave up and listed them out, the rest was easy.
Top
spica
Guru
Guru
Posts: 382
Joined: Fri Jun 04, 2021 6:12 pm

Re: 'passwd' password generator

  • Quote

Post by spica » Sun Jul 10, 2022 4:10 pm

one_red_eye wrote:I like using the passwords generated by 'passwd'. Is there a way to use this mechanism to generate passwords without having to SSH into a linux machine?
app-admin/pwgen

Code: Select all

$ pwgen -c -n -s -y 32
zhGTcx900.`CmSY12P=O8gtZSH=Uo&JL `0.K]Zt6k{gh2J^l"Lx$yv7f"4HPdy^P
e8RJ<)7=2[fCu`2[`G!lsis^{s@j1:tg nz;PW6ZXQKs>3V#>S)x*~z@ob=Oije9>
di0>>#OmPivnQ3ru#P./Fe%Mv?uE!JBZ $Nwv:e$C2$;m!KWw4MAletHkKBj0_F;;
Q'u[`=2Ev"J|)x:fx4KXF]K9LUD[+!S| |Xg_|\:m[g,G7x1zSlO<OH")8C>cHl}I
!$ChDY_'%+Jp@/IGV*75;E{58:%azWJY .fS8ss6o5G+^v_QRVq}7}\$V]g'D;V?1
GcgV;6A./yMy^y3[h#||5BF\a~[lsXvl *R_@gNL,g=y7Nz0AX?q*6jF4U22/Gtg`
Upd: man 1 pwgen - generate pronounceable passwords
The pwgen program generates passwords which are designed to be easily memorized by humans

Code: Select all

$ pwgen 12
soaShoh1fae0 thuTo0xae7Ki uMo4iac1meid IePhais2voph gu2chaigoCah aiK5eixieY6u
oox9ooB9Wei6 shaeHoon7zah oi3Ahfo9zore eg9ahPhaesee EiGhae8om3ie aoyoh8eeKo5u
Dee7Fah0Mooh ongaebohVo3o fie1chohShi6 hee1eecei5Sh ceiXu8ooqu3l la1eiSh3ahng
aif4eiZ2xae3 veiToh2dohz0 Iehagoe5eigu loo2ahgaiw1S tohLeaX9aihu ong5eYu9Eing
Last edited by spica on Thu Jul 14, 2022 11:03 am, edited 1 time in total.
Top
one_red_eye
n00b
n00b
Posts: 42
Joined: Sat May 21, 2005 7:18 pm
Location: North Dakota

  • Quote

Post by one_red_eye » Sun Jul 10, 2022 4:21 pm

Hu wrote:The requirements still seem strange to me. You want to use neither a website nor an Android app, and you want to do this from an Android smartphone, so you don't have access to a proper Linux environment where you could just run passwd. Given those constraints, what can you run that could produce any output, while being local, not a website, and not an Android app?

If we set that aside and say you just need a Linux script, then this should do it:

Code: Select all

#!/bin/bash

set -eu
declare -a w n
w=( $( shuf -n3 /usr/share/dict/words ) )
n=( $( shuf -n2 -e \! " \# \$ \% \& \' \( \) \* \+ \, \- \. \/ \: \; \< \= \> \? \@ \[ \\ \] \^ \_ \` \{ \| \} \~ ) )
printf '%s%s%s%s%s\n' "${w[0]}" "${n[0]}" "${w[1]}" "${n[1]}" "${w[2]}"
The most time consuming part turned out to be getting the special characters, because I wanted bash to generate those from a brace expansion. Once I gave up and listed them out, the rest was easy.
That's awesome! One question, how do I randomly capitalize the first letter of the words before it goes to output?
"99% of the people in this world are fools, and the rest of us are in great danger of contagion."
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Sun Jul 10, 2022 4:26 pm

Hu wrote:Once I gave up and listed them out, the rest was easy.
Interesting. I didn't think I had useful results with shuf's -e option. The only reference I see in my history seems to have worked, so I too must have wanted to avoid listing them all out. Which I ended up doing a different way (that didn't work), so I must have forgotten about -e. Avoiding arrays adds some extra stimulation.
Quis separabit? Quo animo?
Top
Hu
Administrator
Administrator
Posts: 24395
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sun Jul 10, 2022 4:57 pm

one_red_eye wrote:That's awesome! One question, how do I randomly capitalize the first letter of the words before it goes to output?
The randomness comes from shuf, and shuf does not seem to offer that. However, you could fake it by having bash transform the results before printing. If you wanted to always capitalize a word, use "${w[0]^}". To do it randomly, you would need bash to flip it.

Code: Select all

#!/bin/bash

set -efu
declare -a w n
w=( $( shuf -n3 /usr/share/dict/words ) )
n=( $( shuf -n2 -e \! " \# \$ \% \& \' \( \) \* \+ \, \- \. \/ \: \; \< \= \> \? \@ \[ \\ \] \^ \_ \` \{ \| \} \~ ) )
for i in {0..2}; do
	if [[ $(( $RANDOM % 2 )) = 0 ]]; then
		w[$i]="${w[$i]^}"
	fi
done
printf '%s%s%s%s%s\n' "${w[0]}" "${n[0]}" "${w[1]}" "${n[1]}" "${w[2]}"
This also fixes a bug in the earlier version that allowed * to expand as a file glob.
Top
figueroa
Advocate
Advocate
User avatar
Posts: 3032
Joined: Sun Aug 14, 2005 8:15 pm
Location: Edge of marsh USA
Contact:
Contact figueroa
Website

  • Quote

Post by figueroa » Thu Jul 14, 2022 4:26 am

BTW, sha1pass generates a pretty good password, but you definitely won't remember it. sha1pass comes from sys-boot/syslinux.
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi -wayland
Top
forrestfunk81
Guru
Guru
User avatar
Posts: 567
Joined: Tue Feb 07, 2006 12:33 pm
Location: münchen.de

  • Quote

Post by forrestfunk81 » Tue Jul 19, 2022 12:19 pm

Use Keepass.
Its available for Linux (KeepassXC) and Android (Keepass2), it can generate passwords in many configurable ways and helps you remember your passwords. Just share the encrypted kdbx file via Nextcloud or something similiar between your devices.
# cd /pub/
# more beer
Top
figueroa
Advocate
Advocate
User avatar
Posts: 3032
Joined: Sun Aug 14, 2005 8:15 pm
Location: Edge of marsh USA
Contact:
Contact figueroa
Website

  • Quote

Post by figueroa » Tue Jul 19, 2022 3:27 pm

My encrypted passwords and other secrets file is NOT going to be placed on any company's storage on the internet.
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi -wayland
Top
forrestfunk81
Guru
Guru
User avatar
Posts: 567
Joined: Tue Feb 07, 2006 12:33 pm
Location: münchen.de

  • Quote

Post by forrestfunk81 » Tue Jul 19, 2022 5:15 pm

figueroa wrote:My encrypted passwords and other secrets file is NOT going to be placed on any company's storage on the internet.
Mine neither! You can host NextCloud or similiar file exchange services by yourself
# cd /pub/
# more beer
Top
figueroa
Advocate
Advocate
User avatar
Posts: 3032
Joined: Sun Aug 14, 2005 8:15 pm
Location: Edge of marsh USA
Contact:
Contact figueroa
Website

  • Quote

Post by figueroa » Tue Jul 19, 2022 5:30 pm

forrestfunk81 wrote:
figueroa wrote:My encrypted passwords and other secrets file is NOT going to be placed on any company's storage on the internet.
Mine neither! You can host NextCloud or similiar file exchange services by yourself
Within my network(s) I just use SFTP and NFS. I only use common Unix/Linux software in order to not be dependent on ever changing 3rd party applications. I am, admittedly, old-school and lightly paranoid.
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi -wayland
Top
spica
Guru
Guru
Posts: 382
Joined: Fri Jun 04, 2021 6:12 pm

  • Quote

Post by spica » Fri Nov 03, 2023 5:07 pm

These fancy passwords are generated by a code from sys-auth/passwdqc, see man 1 pwqgen
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Fri Nov 03, 2023 11:50 pm

Again going to the password strength meter one liner:

Code: Select all

$ echo $(egrep '^[a-z]{4,7}$' /usr/share/dict/words|shuf -n4)|tr -d ' '
I chose to remove the words with too many or too few characters, words with apostrophes, hyphens, or capitalization, and I think this should still be be in the spirit.
Removing the spaces is optional of course.

I just wonder how long it would take the above script to generate correcthorsebatterystaple....
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
Hu
Administrator
Administrator
Posts: 24395
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sat Nov 04, 2023 12:52 am

I see ~48k words that match your filter[1]. I think this is an N-choose-R problem. Since we care about order, the probability of hitting the right choice on any given try is ~.00000000000000000018 (1 / (48458 * 48457 * 48456 * 48455)).

You could avoid the use of tr with a careful printf: printf '%s%s%s%s\n' $(grep -E '^[a-z]{4,7}$' /usr/share/dict/words|shuf -n4). If you want it to work regardless of the shuffle count, you could use { printf '%s' $(grep -E '^[a-z]{4,7}$' /usr/share/dict/words|shuf -n4); echo; } This relies on printf to discard the whitespace (newlines), then uses a bare echo to emit a newline at the end.

[1]:

Code: Select all

)$ grep -E '^[a-z]{4,7}$' /usr/share/dict/words -c
48458
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Sat Nov 04, 2023 2:52 am

These no-numbers xkcd password generators, one could salt them by just appending or prepending your birthday or year and would make it even worse to guess, no real need to intersperse the digits. Jury's still out on spaces or not. Either way to take advantage of it, one would have to know you did omit them or not, and that's another bit of entropy!
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
flexibeast
l33t
l33t
Posts: 682
Joined: Mon Apr 04, 2022 4:15 am
Location: Naarm/Melbourne, Australia
Contact:
Contact flexibeast
Website

  • Quote

Post by flexibeast » Sat Nov 04, 2023 6:28 am

(As an aside, to get a Linux environment on one's Android device, without root, there's Termux.)
Top
Leonardo.b
Guru
Guru
Posts: 314
Joined: Sat Oct 10, 2020 9:24 pm

  • Quote

Post by Leonardo.b » Sun Nov 05, 2023 6:32 pm

I always try to genetate strong passwords and keep them safe, even for crappy sites.
Then I've tried to open a bank account, and the last step of onboarding requested me a password of MAXIMUM lenght 6 chars, no symbols allowed.
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Sun Nov 05, 2023 7:17 pm

technically speaking your account username for banks is a kind of password since there's no real need to share that information (unless you use it on other sites, which is also a "bad idea"). So a bit of entropy is there too to prevent hacking as long as account lists don't get disclosed...

Granted a stored hash of a password is more secure than plaintext account names.

This doesn't apply for un*x account names as it's typically shared for email or ls -l ...
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
Leonardo.b
Guru
Guru
Posts: 314
Joined: Sat Oct 10, 2020 9:24 pm

  • Quote

Post by Leonardo.b » Tue Nov 07, 2023 11:56 am

Said bank relies on phone authentication by SMS, password is in top of that. But I don't consider it safe enough for my moneys.
By the way, I know they store passwords in plain text too.
Top
b11n
Guru
Guru
User avatar
Posts: 303
Joined: Wed Mar 26, 2003 8:15 am
Location: New Zealand

  • Quote

Post by b11n » Fri May 30, 2025 4:01 am

alamahant wrote:

Code: Select all

date | md5sum
It seems like it generates a strong password, but it really doesn't. Cryptographically, it's barely any better than just using the output of `date` itself. If an attacker suspects targets are using such a method to generate passwords, it drastically reduces the effort to mount brute-force attacks.

Sorry to dig up an old post, but this is a Bad Idea that shouldn't be left unchallenged. Could an admin please flag it as such for anyone who might find it?

[Administrator response: I thought the later posts were sufficient, but adding a warning is easy enough, so done. -Hu]
Top
Post Reply
  • Print view

25 posts • Page 1 of 1

Return to “Gentoo Chat”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic