In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "Shell script how to generate random passwords", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "Shell scripts how to generate random passwords" this article.
Generate random passwords (urandom version)
#! / bin/bash # Author: Jacob # / dev/urandom file is a Linux built-in random device file # cat / dev/urandom can see the contents, ctrl+c quit to view # after viewing the contents of the file, I found that the content is a little too random, including a lot of special symbols The password we need does not want to use these symbols # tr-dc'_ A-Za-z0-9'# this command can delete other characters from the random file, leaving only uppercase and lowercase letters, numbers and underscores, but there is still too much content # We can continue to pipe the optimized content to the head command Show only the first 10 bytes in a large amount of data # notice that An is preceded by an underscore tr-dc'_ A-Za-z0-9'
Generate random passwords (string intercepted version)
#! / bin/bash # Author: Jacob (Jacob) # set the variable key to store all the possibilities of the password (password library). If you need other characters, please add other password characters yourself # use the $# statistics password library length key= "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" num=$ {# key} # set the initial password to empty pass='' # loop 8 times Generate 8 random passwords # each time is the remainder of the length of the password base, ensuring that the extracted password characters do not exceed the length of the password base # extract one random password each cycle, and append the random password to the last for i in {1.. 8} do index=$ [RANDOM%num] pass=$pass$ {key:$index:1} done echo $pass of the pass variable
Generate a random password (UUID version, hexadecimal password)
#! / bin/bash uuidgen 4. Generate random passwords (process ID version, digital passwords) #! / bin/bash echo $$above is all the content of the article "how Shell scripts generate random passwords". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.