Tuesday, 29 January 2013

How To Linux Random Password Generator in Command Line:

 i.

1. [sankar@CSSW2013NOC3 ~]$ pwd

/home/sankar

2. [sankar@CSSW2013NOC3 ~]$ vim .bashrc

Note:Append the bellow code:
 
genpasswd() {
 local l=$1
        [ "$l" == "" ] && l=16
       tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
 

3. [sankar@CSSW2013NOC3 ~]$ source ~/.bashrc


4. To generate random password, enter:

[sankar@CSSW2013NOC3 ~]$  genpasswd
dZJgIfIY60KB4lNo


[sankar@CSSW2013NOC3 ~]$ genpasswd 8
P_UlFer_
 
[sankar@CSSW2013NOC3 ~]$ genpasswd 9
_FxwL4h2D

[sankar@CSSW2013NOC3 ~]$ genpasswd 10
qW9CGfhRYw
 

ii.



1. [sankar@CSSW2013NOC3 ~]$ which mkpasswd

/usr/bin/which: no mkpasswd in (/usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/sankar/bin)

2. [root@CSSW2013NOC3 sankar]# yum install expect
 

Installed:
  expect.i686 0:5.44.1.15-4.el6                                                

Dependency Installed:
  tcl.i686 1:8.5.7-6.el6                                                       

Complete!

3. [root@CSSW2013NOC3 sankar]# yum whatprovides */mkpasswd

expect-5.44.1.15-4.el6.i686 : A program-script interaction and testing utility
Repo        : installed
Matched from:
Filename    : /usr/bin/mkpasswd

4. [sankar@CSSW2013NOC3 ~]$ mkpasswd
Is>91Hqat

2 comments: