How to Generate/Encrypt/Decrypt Random Passwords on CentOS/RHEL & Fedora - Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Tuesday, October 22, 2019

How to Generate/Encrypt/Decrypt Random Passwords on CentOS/RHEL & Fedora

 




 1. Generate a random unique password of length equal to 10 characters
Step1 :-  yum install pwgen
Step2 :-  pwgen 10 1
Step3 :-  pwgen 50
Step4 :- yum install expect
Step5 :- yum –y install makepasswd    --- As per choice
Step6 :- makepasswd                       --- Default is 10
Step7 :- makepasswd  --char 50
Step8 :- makepasswd  --char 20  --count 7     --- Generate 7 random password of 20cht.

2. Encrypt a password using crypt along with salt.

Salt is a random data which servers as an additional input to one way function in order to protect password against dictionary attack.




Step9 :-  Yum install mkpasswd
Step10 :- mkpasswd  cloudnetwork
                mkpasswd cloudnetwork  -s   tt

4. Encrypt a string say “cloudnetwork is a video tutorials make in Linux,Ubuntu” using aes-256-cbc encryption using password say “cloudnetwork” and salt.

Step8 :- echo cloudnetwork-is-a-video-tutorials-make-in-Linux,Ubuntu  | openssl
enc -aes-256-cbc -a -salt -pass pass:cloudnetwork

5. Decrypt the above string using openssl command using the -aes-256-cbc decryption.

Step9 :- echo U2FsdGVkX18Zgoc+dfAdpIK58JbcEYFdJBPM9oXWsgpvpdO/Z | openssl
enc -aes-256-cbc -a -d -salt -pass pass:cloudnetwork