Blog/content/posts/2024/bash/password-generator.md

58 lines
929 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "🔑 Генератор паролей в виде однострочника на Bash"
date: 2024-08-17T22:33:12+03:00
draft: false
tags: [shell, linux, tips, security]
---
Пост [Cyrus](https://stackoverflow.com/a/44377013) на **SoF**.
Команда:
```sh
tr -dc 'A-Za-z0-9!?%=' < /dev/urandom | head -c 20
```
Выхлоп:
```text
7sixuvfqbFRAj4g=3v7Y
```
## Другие варианты
### OpenSSL
Команда:
```sh
openssl rand -base64 20
```
Выхлоп:
```text
c+EtG4VK/0JLR6tWrneAlP4bHmQ=
```
### Версия Cyrus с улучшенной энтопией
```sh
for i in $(seq 1 5); do echo $(tr -dc 'A-Za-z0-9!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~' < /dev/urandom | head -c 20); done
```
```text
Q@2^u\U3.:%|{yGY@SMl
T8WVte55AggJ{WxElqDi
vG%+Gr"jp#x@f46YBj>m
|>Wd,|S>w)jwe|:))eLU
m`nSde+o,:vn\1JpJ1j3
```
## Дополнительно
Пожалуй добавлю в `alias`.