赞
踩
安全是网络世界中的主要问题之一。网络安全,也称为信息技术安全,重点在于保护计算机,网络,程序和数据免遭意外或未经授权的访问,更改或破坏。我们将密码用于计算机,电子邮件,云,电话,文档等。我们都知道选择易于记忆且难以猜测的密码的基本知识。不过,如果用户想加密或解密密码,那么Linux提供了很多选择。
本文介绍“如何在Linux中生成/加密/解密随机密码”。
PWGen
PwGen是随机的唯一密码生成器。要安装PWGen,请使用以下命令–$ sudo apt-get install pwgen
样本输出应如下所示–Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gcc-4.8-base:i386 libasn1-8-heimdal:i386 libasound2:i386
libasound2-plugins:i386 libasyncns0:i386 libavahi-client3:i386
libavahi-common-data:i386 libavahi-common3:i386 libbit-vector-perl
libcapi20-3:i386 libcarp-clan-perl libclass-method-modifiers-perl
libcups2:i386 libdata-random-perl libdate-calc-perl libdate-calc-xs-perl
libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386
libdrm-radeon1:i386 libedit2:i386 libelf1:i386 libexif12:i386 libexpat1:i386
libffi6:i386 libflac8:i386 libfontconfig1:i386 libfreetype6:i386
libgcrypt11:i386 libgd-perl libgd3:i386 libgif4:i386
libgl1-mesa-dri-lts-wily:i386 libgl1-mesa-glx-lts-wily:i386
libglapi-mesa-lts-wily:i386 libglib2.0-0:i386 libglu1-mesa:i386
libgnome2-gconf-perl libgnutls26:i386 libgpg-error0:i386 libgphoto2-6:i386
libgphoto2-port10:i386 libgssapi-krb5-2:i386 libgssapi3-heimdal:i386
libgstreamer-plugins-base0.10-0:i386 libgstreamer0.10-0:i386
libhcrypto4-heimdal:i386 libheimbase1-heimdal:i386 libheimntlm0-heimdal:i386
libhx509-5-heimdal:i386 libice6:i386 libieee1284-3:i386
libjack-jackd2-0:i386 libjbig0:i386 libjpeg-turbo8:i386 libjpeg8:i386
libk5crypto3:i386 libkeyutils1:i386 libkrb5-26-heimdal:i386 libkrb5-3:i386
libkrb5support0:i386 liblcms2-2:i386 libldap-2.4-2:i386 libllvm3.6:i386
libltdl7:i386 libmouse-perl libmpg123-0:i386 libnet-dropbox-api-perl
..........................................
要生成长度等于10个字符的随机唯一口令,请使用以下命令–$ pwgen 5 1
样本输出应如下所示–$ pwgen 10 1
lah6M
要生成几个字符长度为50的随机唯一口令,请使用以下命令–$ pwgen 50
输出样本应如下所示–$ pwgen 50
Meepahshoo4ee9kohvezah8fu0Ox0neogh9iechoo9thoocooM
ye7ieliiGhief6ohquahf4leithei7sugh6shu3nooy6ooz7Ae
ieng0shefaizeezoo6ila5Ecee0iu9aaquaiwie8chi1yoh4ah
iiw7Noogh1hi5iga2queepheiCahyaghiesie2yaexeifeifoo
lunu9Aic1iepah4Bei8wenee4aer1aiVaing1hoh7eiphiu1le
kooquifooFai3uK7Gai8Ix9oph8oolah0ohp2iheiChaepudie
caiTiem3ilies0nietetheevei2oatoeloh7iLooPi8Beeneey
esug8ahmait6reepheaBoo8goequ2Bu9oodoo5rahkaeweequa
nie4ahgheida2xiij6hak7ke5lu0ugh1otah7Feir8iefoDaum
noy1chep2da3eu7sheicohZaighai8aem9feec8bohmei2eemu
zu8Aec3Pei6ol2ahteexoc3goQuaisai4upaj5chepha6ahsh4
lah4aedahTee2ki6zou4uphoBoh5Ooyeixaihiu5fuoYah7Tei
ooS6ku2Ia9Eilohchubais7yoxeephohS9Eath9Pequ3aengae
Ooqui3goeko1loh6ooshaikiahi4noxaiDuiP2Ohruroh2ohba
pa3quee7Lagheengae9iR3fooHooXa0Ioth0ieMee2pe2Ain9h
maife3eiLerooh3to0eeGee6ahHo0aeT9Eef7axa7eiY4LaeP2
aech0AiWuoTheeGeno6NoWahgh0shish8quoo3Chu0uoxahmie
paihay0aip3iexaseidah1OhRoo3Eeniemulah8oG7VobeaThi
seequ2akooW6Teij2aico6aivohT3eshaeri0Gohjaigiohixu
pee8eith4Rinodeequoh2Eipowuvool7ohquu8eibai4haih1h
makepasswd
makepasswd用于根据选择生成给定长度的随机,唯一密码。要安装makepasswd,请使用以下命令–$ sudo apt-get install makepasswd
样本输出应如下所示–Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gcc-4.8-base:i386 libasn1-8-heimdal:i386 libasound2:i386
libasound2-plugins:i386 libasyncns0:i386 libavahi-client3:i386
libavahi-common-data:i386 libavahi-common3:i386 libbit-vector-perl
libcapi20-3:i386 libcarp-clan-perl libclass-method-modifiers-perl
libcups2:i386 libdata-random-perl libdate-calc-perl libdate-calc-xs-perl
libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386
libdrm-radeon1:i386 libedit2:i386 libelf1:i386 libexif12:i386 libexpat1:i386
libffi6:i386 libflac8:i386 libfontconfig1:i386 libfreetype6:i386
libgcrypt11:i386 libgd-perl libgd3:i386 libgif4:i386
libgl1-mesa-dri-lts-wily:i386 libgl1-mesa-glx-lts-wily:i386
libglapi-mesa-lts-wily:i386 libglib2.0-0:i386 libglu1-mesa:i386
libgnome2-gconf-perl libgnutls26:i386 libgpg-error0:i386 libgphoto2-6:i386
libgphoto2-port10:i386 libgssapi-krb5-2:i386 libgssapi3-heimdal:i386
libgstreamer-plugins-base0.10-0:i386 libgstreamer0.10-0:i386
libhcrypto4-heimdal:i386 libheimbase1-heimdal:i386 libheimntlm0-heimdal:i386
libhx509-5-heimdal:i386 libice6:i386 libieee1284-3:i386
libjack-jackd2-0:i386 libjbig0:i386 libjpeg-turbo8:i386 libjpeg8:i386
libk5crypto3:i386 libkeyutils1:i386 libkrb5-26-heimdal:i386 libkrb5-3:i386
libkrb5support0:i386 liblcms2-2:i386 libldap-2.4-2:i386 libllvm3.6:i386
libltdl7:i386 libmouse-perl libmpg123-0:i386 libnet-dropbox-api-perl
libogg0:i386 libopenal1:i386 liborc-0.4-0:i386 libosmesa6:i386
.........................................
要生成字符长度为10(默认值为10)的随机密码,请使用以下命令-$ makepasswd
样本输出应如下所示–$ makepasswd
c0CgufUg
要生成字符长度为50的随机密码,请使用以下命令-$ makepasswd --char 40
样本输出应如下所示–$ makepasswd --char 50
HCvvXipXmc7idBcWHt8UcjcX21xvC9P700NgCAoM
要生成10个20个字符的随机密码,请使用以下命令-$ makepasswd --char 20 --count 10
样本输出应如下所示–$ makepasswd --char 20 --count 10
b8aotAGE83WqpNXb6tms
XBItn0UenWhc4dNixcBD
uE5Km8J8ssHIThhSBWnS
XFcfA50Ew6iD0WxwsuKn
3e4nxDU0F3WtzLE7WNoV
G640DxC3XsrFQRgFtHho
THXKMI65qojzGCVsmje8
LmhK9ScX9uJCE2mDgEYD
p9YU7eWI4CN9cxeiLUGn
rraxYCpGUNjiFvXmNJha
要加密密码,请使用mkpasswd命令。如下所示安装mkpasswd –$ sudo apt-get install whois
样本输出应如下所示–Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
gcc-4.8-base:i386 libasn1-8-heimdal:i386 libasound2:i386
libasound2-plugins:i386 libasyncns0:i386 libavahi-client3:i386
libavahi-common-data:i386 libavahi-common3:i386 libbit-vector-perl
libcapi20-3:i386 libcarp-clan-perl libclass-method-modifiers-perl
libcups2:i386 libdata-random-perl libdate-calc-perl libdate-calc-xs-perl
libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386
libdrm-radeon1:i386 libedit2:i386 libelf1:i386 libexif12:i386 libexpat1:i386
libffi6:i386 libflac8:i386 libfontconfig1:i386 libfreetype6:i386
libgcrypt11:i386 libgd-perl libgd3:i386 libgif4:i386
libgl1-mesa-dri-lts-wily:i386 libgl1-mesa-glx-lts-wily:i386
libglapi-mesa-lts-wily:i386 libglib2.0-0:i386 libglu1-mesa:i386
libgnome2-gconf-perl libgnutls26:i386 libgpg-error0:i386 libgphoto2-6:i386
......................................
要使用mkpasswd加密密码,请使用以下命令-$ mkpasswd tutorialspoint
样本输出应如下所示–$ mkpasswd tutorialspoint
V8dIs6XzLXB7c
要使用aes-256-cbc加密对密码进行加密,请使用以下命令-$ echo Nhooo-is-a-best-online-resouce | openssl enc -aes-256-cbc -a -salt -pass pass:tutorialspoint
样本输出应如下所示–$ echo Nhooo-is-a-best-online-resouce | openssl enc -aes-256-cbc -a -salt -pass pass:tutorialspoint
U2FsdGVkX19TJ9x2yI18KoP1TzIbyCQhkrK8uShPTm3CtLaZpI4YkOQG3O8RcQnX
wymb1bWnshJXkFeyATgCQw==
要解密上述字符串,请使用以下命令–$ echo U2FsdGVkX19TJ9x2yI18KoP1TzIbyCQhkrK8uShPTm3CtLaZpI4YkOQG3O8RcQnX | openssl enc -aes-256-cbc -a -d -salt -pass pass:tutorialspoint
样本输出应如下所示–Nhooo-is-a-best-online-resouce
恭喜你!现在,您知道“如何在Linux中生成/加密/解密随机密码”。在下一篇Linux文章中,我们将学习有关这些命令类型的更多信息。继续阅读!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。