システム環境構築に関する記事を掲載していきます!
  • トップ
  • サイト案内
  • お問い合わせ
  • サイトマップ
  • ランキング
SEARCH
LAB4ICT
  • トップ
    Top
  • ブログ
    Blog
  • システム
    System
  • サービス
    Service
  • 応用技術
    Tech
  • アート
    Art
SEARCH
LAB4ICT
  • トップ
    Top
  • ブログ
    Blog
  • システム
    System
  • サービス
    Service
  • 応用技術
    Tech
  • アート
    Art
  • トップ
    Top
  • ブログ
    Blog
  • システム
    System
  • サービス
    Service
  • 応用技術
    Tech
  • アート
    Art
Topics ライブカメラによる動画配信を開始しました!(横浜から富士山を眺める!/YouTube)
  • ホーム
  • OS - Linux
  • Commands
  • Account
  • Linuxでパスワードを自動生成する!(pwgen)
Account
Linux
コマンド
パスワード
生成
自動生成
pwgen

Linuxでパスワードを自動生成する!(pwgen)

2023-01-22 2023-07-20
  • Webmaster
  • Webmaster
Linuxでパスワードを自動生成する!(pwgen)

Linuxでpwgenコマンドでパスワードを自動生成します。パスワードポリシーは、引数で指定するので、様々な用途のパスワード生成に使用できます。

記事の目次

  • 1 pwgenパッケージをインストールする!
    • 1.1 RHELでpwgenパッケージをインストールする!
    • 1.2 Ubuntuでpwgenパッケージをインストールする!
  • 2 pwgenコマンドのヘルプを表示する!
  • 3 パスワードを自動生成する!
  • 4 おわりに
  • 5 関連記事
  • 6 関連書籍(Amazon)

pwgenパッケージをインストールする!

pwgenコマンドは、通常デフォルトではインストールされていないので、パッケージのインストールを行います。

RHELでpwgenパッケージをインストールする!

RHELでは、EPELリポジトリを有効化されている必要があります。EPELリポジトリを有効化していない場合は、EPELリポジトリを有効化して、pwgenコマンドをインストールします。

$ sudo dnf install epel-release
$ sudo dnf install pwgen

Ubuntuでpwgenパッケージをインストールする!

Ubuntuでpwgenパッケージをインストールします。

$ sudo apt install pwgen

pwgenコマンドのヘルプを表示する!

pwgenコマンドのヘルプを表示して、使用方法を確認します。

$ pwgen --help
Usage: pwgen [ OPTIONS ] [ pw_length ] [ num_pw ]

Options supported by pwgen:
  -c or --capitalize
	Include at least one capital letter in the password
  -A or --no-capitalize
	Don't include capital letters in the password
  -n or --numerals
	Include at least one number in the password
  -0 or --no-numerals
	Don't include numbers in the password
  -y or --symbols
	Include at least one special symbol in the password
  -r <chars> or --remove-chars=<chars>
	Remove characters from the set of characters to generate passwords
  -s or --secure
	Generate completely random passwords
  -B or --ambiguous
	Don't include ambiguous characters in the password
  -h or --help
	Print a help message
  -H or --sha1=path/to/file[#seed]
	Use sha1 hash of given file as a (not so) random generator
  -C
	Print the generated passwords in columns
  -1
	Don't print the generated passwords in columns
  -v or --no-vowels
	Do not use any vowels so as to avoid accidental nasty words

パスワードを自動生成する!

英小文字、英大文字、数字、記号を含み、混同しやすい文字を除いた10文字のパスワードを5個を1列の表示形式で、生成してみます。

$ pwgen -c -y -B -1 10 5
eV3ziu/cie
Aa=maex3To
aa3eiT"e4o
nai:sa)W4f
Aiceeza<w7

おわりに

パッケージの追加は必要になりますが、大量のランダムなパスワードを生成する必要がある場合は、pwgenコマンドが役立つと思います。

関連記事

【記事一覧】Linuxでユーザアカウントと権限を管理する!
【記事一覧】Linuxでユーザアカウントと権限を管理する!
Linuxのユーザアカウントを管理するための記事一覧を掲載します。...

関連書籍(Amazon)

N/A


 

Facebook postはてブLINEPocketFeedly
関連キーワード
Linux
pwgen
コマンド
パスワード
生成
自動生成
Accountの関連記事
  • Linuxでrootユーザにスイッチする!(sudo -i)
    Linuxでrootユーザにスイッチする!(sudo -i)
    2023-05-03
  • Linuxでアカウントを管理するファイルの内容を検証する!(pwck/grpck)
    Linuxでアカウントを管理するファイルの内容を検証する!(pwck/grpck)
    2023-02-15
  • Linuxのグループの情報を変更する!(groupmod)
    Linuxのグループの情報を変更する!(groupmod)
    2023-02-03
  • Linuxのユーザの情報を変更する!(usermod)
    Linuxのユーザの情報を変更する!(usermod)
    2023-02-03
  • Linuxでディレクトリに対してSGIDを設定する!(chmod g+s)
    Linuxでディレクトリに対してSGIDを設定する!(chmod g+s)
    2023-02-03
  • Linuxでユーザアカウントに関する設定ファイルを修正する!(vipw/vpgr/visudo)
    Linuxでユーザアカウントに関する設定ファイルを修正する!(vipw/vpgr/visudo)
    2023-02-02
記事の検索(システム)
Generic selectors
完全一致
タイトル検索
本文検索
Post Type Selectors
関連記事(システム)
  • 【記事一覧】Linuxでユーザアカウントと権限を管理する!

    2022-04-18

  • sudoコマンドが使用できない!(gpasswd)

    2022-04-18

  • sudoコマンドの設定を行う!(visudo)

    2022-04-20

  • Linuxでrootユーザにスイッチする!(sudo su -)

    2023-01-16

  • Linuxでrootユーザにスイッチする!(su -)

    2023-01-16

  • LinuxでOSログイン用のパスワードを自動生成する!(pwmake)

    2023-01-22

  • Linuxでパスワード変更期限に関連する情報を確認する!(chage -l)

    2023-01-22

  • Linuxでパスワードに関する操作を行う!(passwd/chpasswd)

    2023-01-22

  • Linuxでパスワードを自動生成する!(pwgen)

    2023-01-22

  • Linuxでユーザの追加と削除を行う!(useradd/userdel)

    2023-01-28

  • Linuxでグループの追加と削除を行う!(groupadd/gpasswd/groupdel)

    2023-01-28

  • Linuxでユーザアカウントに関する設定ファイルを修正する!(vipw/vpgr/visudo)

    2023-02-02

  • Linuxでディレクトリに対してSGIDを設定する!(chmod g+s)

    2023-02-03

  • Linuxのユーザの情報を変更する!(usermod)

    2023-02-03

  • Linuxのグループの情報を変更する!(groupmod)

    2023-02-03

記事の閲覧数(システム)
  • 493今日の閲覧数:
  • 246昨日の閲覧数:
  • 372今日の訪問者数:
  • 157昨日の訪問者数:
カテゴリー(システム)
  • Admin - Config 15
    • Tools 8
      • Ansible 8
    • VCS 6
      • Git 5
      • GitLab 1
  • Admin - Monitor 18
    • Hinemos 6
    • Logwatch 1
    • Prometheus 5
    • Zabbix 5
  • Admin - Remote 29
    • Cockpit 8
    • SSH 9
    • VNC 8
    • Wake on LAN 3
  • AI 13
    • Anaconda 1
    • PyTorch 5
    • Stable Diffusion 3
    • TensorFlow 3
  • App - Desktop 5
    • Document 2
    • Mail 1
    • Web Browser 1
  • App - Server 38
    • Bitnami 6
    • WordPress 12
  • Cloud 104
    • AWS 98
      • AWS Network 8
      • AWS Topics 10
      • Certification 10
      • Computing 5
      • Monitoring 3
      • Operation 25
      • Organization 3
      • Start Using 13
      • Storage 1
      • VDI 19
    • Azure 3
    • GCP 2
  • Container 17
    • Docker 10
    • Kubernates 6
  • Database 57
    • DB Server 51
      • Db2 14
      • MariaDB 10
      • MongoDB 12
      • PostgreSQL 15
    • DB Tools 5
      • A5M2 2
      • DBeaver 3
  • Development 13
    • IDE 9
      • Android Studio 6
      • Eclipse 2
    • Language 4
      • Java 1
      • JavaScript 2
      • TypeScript 1
  • Hardware 15
    • 3D Printer 3
    • GPU 5
    • PC 6
      • Firmware 6
  • IoT 14
    • Raspberry Pi 13
  • Network 26
    • Cisco 13
    • Voice Over IP 5
    • VPN 6
      • OpenVPN 6
  • OS - Debian 120
    • Debian 6
      • Debian 12 4
    • Ubuntu 113
      • Ubuntu Desktop 16.04 5
      • Ubuntu Desktop 18.04 20
      • Ubuntu Desktop 20.04 15
      • Ubuntu Desktop 22.04 48
      • Ubuntu Server 4
      • Ubuntu Topics 20
        • Ubuntu Packages 6
        • Ubuntu Security 3
  • OS - Linux 247
    • Commands 210
      • Account 17
      • Analyze 3
      • Configurations 12
      • Data Processing 45
      • Devices 5
      • Files 24
      • Filesystem 12
      • Login Session 22
      • Memory 4
      • Monitoring 10
      • Network 24
      • Performance 4
      • Process 8
      • Scheduler 4
      • Systemd 10
      • Text Editor 5
    • Hardware 4
    • Linux Topics 5
    • Shell Script 27
  • OS - RHEL 59
    • CentOS Stream 8 1
    • RHEL 8 12
    • RHEL 9 5
    • RHEL Topics 40
      • RHEL Packages 24
      • RHEL Security 3
      • RHEL Support 9
  • OS - Windows 99
    • Windows Desktop 80
      • Windows 10 23
      • Windows 11 50
      • Windows 7 7
    • Windows Server 3
    • Windows Topics 15
      • Account 1
      • Information 1
      • PowerShell 4
      • Tools 3
  • Security 18
    • CIS Benchmarks 3
    • Network Security 2
    • PKI 12
      • GnuPG 11
      • OpenSSL 1
  • Test Tools 6
    • JMeter 1
    • Test Data 3
  • Topics 16
    • Lab4ict 12
  • Virtualization 54
    • VM Desktop 41
      • Hyper-V Desktop 17
      • virt-manager 3
      • VirtualBox 15
      • VMware Player 5
    • VM Server 12
      • Hyper-V Server 5
      • VMware vSphere 6
アーカイブ(システム)
<
5月 2025
  • 5月 2025
  • 3月 2025
  • 10月 2024
  • 9月 2024
  • 8月 2024
  • 4月 2024
  • 2月 2024
  • 1月 2024
  • 12月 2023
  • 10月 2023
  • 9月 2023
  • 8月 2023
  • 7月 2023
  • 6月 2023
  • 5月 2023
  • 4月 2023
  • 3月 2023
  • 2月 2023
  • 1月 2023
  • 12月 2022
  • 11月 2022
  • 10月 2022
  • 5月 2022
  • 4月 2022
  • 3月 2022
  • 1月 2022
  • 12月 2021
  • 10月 2021
  • 6月 2021
  • 5月 2021
  • 4月 2021
  • 3月 2021
  • 2月 2021
  • 1月 2021
  • 12月 2020
  • 11月 2020
  • 5月 2020
  • 4月 2020
  • 3月 2020
  • 2月 2020
  • 1月 2020
  • 12月 2019
  • 11月 2019
  • 10月 2019
  • 6月 2019
  • 5月 2019
  • 3月 2019
  • 9月 2018
  • 8月 2018
  • 1月 2018
  • 12月 2017
▼
>
月火水木金土日
   1234
567891011
12131415161718
19202122232425
262728293031 
       
     12
3456789
10111213141516
17181920212223
24252627282930
31      
 123456
78910111213
14151617181920
21222324252627
28293031   
       
      1
2345678
9101112131415
16171819202122
23242526272829
30      
   1234
567891011
12131415161718
19202122232425
262728293031 
       
1234567
891011121314
15161718192021
22232425262728
2930     
       
   1234
567891011
12131415161718
19202122232425
26272829   
       
1234567
891011121314
15161718192021
22232425262728
293031    
       
    123
45678910
11121314151617
18192021222324
25262728293031
       
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
    123
45678910
11121314151617
18192021222324
252627282930 
       
 123456
78910111213
14151617181920
21222324252627
28293031   
       
     12
3456789
10111213141516
17181920212223
24252627282930
31      
   1234
567891011
12131415161718
19202122232425
2627282930  
       
1234567
891011121314
15161718192021
22232425262728
293031    
       
     12
3456789
10111213141516
17181920212223
24252627282930
       
  12345
6789101112
13141516171819
20212223242526
2728293031  
       
  12345
6789101112
13141516171819
20212223242526
2728     
       
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
   1234
567891011
12131415161718
19202122232425
262728293031 
       
 123456
78910111213
14151617181920
21222324252627
282930    
       
     12
3456789
10111213141516
17181920212223
24252627282930
31      
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
    123
45678910
11121314151617
18192021222324
252627282930 
       
 123456
78910111213
14151617181920
21222324252627
28293031   
       
     12
3456789
10111213141516
17181920212223
24252627282930
31      
  12345
6789101112
13141516171819
20212223242526
2728293031  
       
    123
45678910
11121314151617
18192021222324
25262728293031
       
 123456
78910111213
14151617181920
21222324252627
282930    
       
     12
3456789
10111213141516
17181920212223
24252627282930
31      
   1234
567891011
12131415161718
19202122232425
2627282930  
       
1234567
891011121314
15161718192021
22232425262728
293031    
       
1234567
891011121314
15161718192021
22232425262728
       
       
    123
45678910
11121314151617
18192021222324
25262728293031
       
 123456
78910111213
14151617181920
21222324252627
28293031   
       
      1
2345678
9101112131415
16171819202122
23242526272829
30      
    123
45678910
11121314151617
18192021222324
25262728293031
       
  12345
6789101112
13141516171819
20212223242526
27282930   
       
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
     12
3456789
10111213141516
17181920212223
242526272829 
       
  12345
6789101112
13141516171819
20212223242526
2728293031  
       
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
    123
45678910
11121314151617
18192021222324
252627282930 
       
 123456
78910111213
14151617181920
21222324252627
28293031   
       
     12
3456789
10111213141516
17181920212223
24252627282930
       
  12345
6789101112
13141516171819
20212223242526
2728293031  
       
    123
45678910
11121314151617
18192021222324
25262728293031
       
     12
3456789
10111213141516
17181920212223
24252627282930
       
  12345
6789101112
13141516171819
20212223242526
2728293031  
       
1234567
891011121314
15161718192021
22232425262728
293031    
       
    123
45678910
11121314151617
18192021222324
25262728293031
       
  • トップ
  • サイト案内
  • お問い合わせ
  • サイトマップ
  • ランキング

(C) 2017-2025 LAB4ICT All Rights Reserved.

Generic selectors
完全一致
タイトル検索
本文検索
Post Type Selectors