Find the answer to your Linux question:
Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By drl
hello all how to generate a strong password shell bash script frome my script and get a variable with this password ? exemple the script Generate this password vH]tT@UFY@ and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2013
    Posts
    23

    how to generate a strong password shell bash script


    hello all

    how to generate a strong password shell bash script frome my script and get a variable with this password ?


    exemple

    the script Generate this password vH]tT@UFY@ and get a variable $pass = vH]tT@UFY@ to a software (ftp pass mysql pass ... )

    tx

  2. #2
    drl
    drl is online now
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,305
    Hi.

    A few possibilities for the first step:
    Code:
    NAME
           pwgen - generate pronounceable passwords
    
    SYNOPSIS
           pwgen [ OPTION ] [ pw_length ] [ num_pw ]
    ...
    and
    Code:
    NAME
           apg - generates several random passwords
    
    SYNOPSIS
           apg [-a algorithm] [-M mode] [-E char_string] [-n num_of_pass] [-m
           min_pass_len] [-x max_pass_len] [-r dictfile] [-b filter_file] [-p
           min_substr_len] [-s] [-c cl_seed] [-d] [-y] [-l] [-t] [-q] [-h] [-v]
    ...
    Found by using:
    Code:
    man -k password | grep 1
    These were available on:
    Code:
    OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
    Distribution        : Debian 5.0.8 (lenny, workstation)
    Your system may have others that are similar.

    The next step is to assign a value to a variable:
    Code:
    v1=$( command )
    like
    Code:
    v1=$( echo hello, world )
    printf "$v1\n"
    producing:
    Code:
    hello, world
    substutute your choice of commands for the echo .... For example:
    Code:
    v1=$(pwgen 10 1)
    producing:
    Code:
    noongiteli
    Best wishes ... cheers, drl
    narugawa likes this.
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  3. #3
    Just Joined!
    Join Date
    Aug 2013
    Posts
    23
    tx for your reply I just solved my problem with this code

    Code:
    pwdr=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9'[:graph:] | fold -w 32 | head -n 1)

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •