Generate random password with special characters on Solaris
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I am trying to generate a 10-character random password in Solaris servers. The examples give around the web are for Linux and mostly not working in Solaris.
solaris password random
add a comment |Â
up vote
1
down vote
favorite
I am trying to generate a 10-character random password in Solaris servers. The examples give around the web are for Linux and mostly not working in Solaris.
solaris password random
mostly not working in solaris
â judi
May 8 at 11:35
1
âÂÂ10 digitsâ contradicts âÂÂspecial characterâÂÂ. What is your exact requirement? Edit your question. Your question may or may not end up being a duplicate of this depending on what you need.
â Gilles
May 8 at 11:41
Thanks - the password should be 10 characters - Alpha + Numeric+ Special character
â judi
May 8 at 11:59
1
A list of commands you tried and any output / error messages you got (and what you expected instead) might help to understand your issue.
â frostschutz
May 8 at 12:14
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am trying to generate a 10-character random password in Solaris servers. The examples give around the web are for Linux and mostly not working in Solaris.
solaris password random
I am trying to generate a 10-character random password in Solaris servers. The examples give around the web are for Linux and mostly not working in Solaris.
solaris password random
edited May 8 at 12:31
Gilles
503k1189951522
503k1189951522
asked May 8 at 11:34
judi
216
216
mostly not working in solaris
â judi
May 8 at 11:35
1
âÂÂ10 digitsâ contradicts âÂÂspecial characterâÂÂ. What is your exact requirement? Edit your question. Your question may or may not end up being a duplicate of this depending on what you need.
â Gilles
May 8 at 11:41
Thanks - the password should be 10 characters - Alpha + Numeric+ Special character
â judi
May 8 at 11:59
1
A list of commands you tried and any output / error messages you got (and what you expected instead) might help to understand your issue.
â frostschutz
May 8 at 12:14
add a comment |Â
mostly not working in solaris
â judi
May 8 at 11:35
1
âÂÂ10 digitsâ contradicts âÂÂspecial characterâÂÂ. What is your exact requirement? Edit your question. Your question may or may not end up being a duplicate of this depending on what you need.
â Gilles
May 8 at 11:41
Thanks - the password should be 10 characters - Alpha + Numeric+ Special character
â judi
May 8 at 11:59
1
A list of commands you tried and any output / error messages you got (and what you expected instead) might help to understand your issue.
â frostschutz
May 8 at 12:14
mostly not working in solaris
â judi
May 8 at 11:35
mostly not working in solaris
â judi
May 8 at 11:35
1
1
âÂÂ10 digitsâ contradicts âÂÂspecial characterâÂÂ. What is your exact requirement? Edit your question. Your question may or may not end up being a duplicate of this depending on what you need.
â Gilles
May 8 at 11:41
âÂÂ10 digitsâ contradicts âÂÂspecial characterâÂÂ. What is your exact requirement? Edit your question. Your question may or may not end up being a duplicate of this depending on what you need.
â Gilles
May 8 at 11:41
Thanks - the password should be 10 characters - Alpha + Numeric+ Special character
â judi
May 8 at 11:59
Thanks - the password should be 10 characters - Alpha + Numeric+ Special character
â judi
May 8 at 11:59
1
1
A list of commands you tried and any output / error messages you got (and what you expected instead) might help to understand your issue.
â frostschutz
May 8 at 12:14
A list of commands you tried and any output / error messages you got (and what you expected instead) might help to understand your issue.
â frostschutz
May 8 at 12:14
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
You can get cryptographic-quality random bytes from /dev/urandom
. (This exists since Solaris 9. It also exists on Linux.) This includes unprintable characters, so you need to remove those. The following command extracts 10 random printable, non-space ASCII characters.
</dev/urandom tr -dc '!-~' | dd ibs=1 obs=1 count=10
I don't recommend using special characters in passwords. They don't make passwords more secure. What makes the security of a password is its entropy. A 10-character password has 10ÃÂlog2(94) â 65.5 bits of entropy. You can get the same amount of entropy from 9 arbitrary bytes and encode them as you wish, for example as hexadecimal.
</dev/urandom dd ibs=1 obs=1 count=9 | od -tx1 -An | tr -d ' '
Or as Base64, which is shorter.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed -n 2p
If there's some hard constraint that âÂÂpasswords must contain at least one special characterâ (which is a questionable way to make passwords selected by average humans more secure, and it completely wrong for randomly generated passwords), then you can't simply use a random password, because there's a chance that it'll happen not to contain any character in a required class. If you reject passwords that don't meet the constraint, you're reducing the security of the password. Instead, make the password longer, e.g.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/'
If you need the password to be memorable, that's a different problem. The best memorable passwords are passphrases.
can this stdd in and out be removed please sol10 # dd if=/dev/urandom ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/' 9+0 records in 9+0 records out A9xk0r4MvMCY-Aa1 sol10 #
â judi
May 8 at 14:06
Thanks Much , this will eliminate the dd command output.dd if=/dev/urandom ibs=1 obs=1 count=9 2>/dev/null | uuencode -m - | sed '2!d; s/$/-Aa1/'
â judi
May 8 at 14:20
add a comment |Â
up vote
-1
down vote
You have perl in Solaris, it helps:
perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10'
With special characters it will be:
perl -e 'print [0..9,a..z,A..Z,qw- _ / & ?]->[rand 67]for 0..10'
Thanks - but there is no special characters. sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' e9RKUJiss3 sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' zLdxvTqlJT sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' AiaiDubgye sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' lJxiV2iDwY sol10 #
â judi
May 8 at 12:01
You may add special characters in such way: perl -e 'print [a..z,A..Z,0..9,qw- _ / & ?]->[rand 67]for 0..10'
â Sasha Golikov
May 8 at 12:24
1
No, Perl'srand
is not suitable to generate a password. This answer is insecure.
â Gilles
May 8 at 12:31
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
You can get cryptographic-quality random bytes from /dev/urandom
. (This exists since Solaris 9. It also exists on Linux.) This includes unprintable characters, so you need to remove those. The following command extracts 10 random printable, non-space ASCII characters.
</dev/urandom tr -dc '!-~' | dd ibs=1 obs=1 count=10
I don't recommend using special characters in passwords. They don't make passwords more secure. What makes the security of a password is its entropy. A 10-character password has 10ÃÂlog2(94) â 65.5 bits of entropy. You can get the same amount of entropy from 9 arbitrary bytes and encode them as you wish, for example as hexadecimal.
</dev/urandom dd ibs=1 obs=1 count=9 | od -tx1 -An | tr -d ' '
Or as Base64, which is shorter.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed -n 2p
If there's some hard constraint that âÂÂpasswords must contain at least one special characterâ (which is a questionable way to make passwords selected by average humans more secure, and it completely wrong for randomly generated passwords), then you can't simply use a random password, because there's a chance that it'll happen not to contain any character in a required class. If you reject passwords that don't meet the constraint, you're reducing the security of the password. Instead, make the password longer, e.g.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/'
If you need the password to be memorable, that's a different problem. The best memorable passwords are passphrases.
can this stdd in and out be removed please sol10 # dd if=/dev/urandom ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/' 9+0 records in 9+0 records out A9xk0r4MvMCY-Aa1 sol10 #
â judi
May 8 at 14:06
Thanks Much , this will eliminate the dd command output.dd if=/dev/urandom ibs=1 obs=1 count=9 2>/dev/null | uuencode -m - | sed '2!d; s/$/-Aa1/'
â judi
May 8 at 14:20
add a comment |Â
up vote
3
down vote
You can get cryptographic-quality random bytes from /dev/urandom
. (This exists since Solaris 9. It also exists on Linux.) This includes unprintable characters, so you need to remove those. The following command extracts 10 random printable, non-space ASCII characters.
</dev/urandom tr -dc '!-~' | dd ibs=1 obs=1 count=10
I don't recommend using special characters in passwords. They don't make passwords more secure. What makes the security of a password is its entropy. A 10-character password has 10ÃÂlog2(94) â 65.5 bits of entropy. You can get the same amount of entropy from 9 arbitrary bytes and encode them as you wish, for example as hexadecimal.
</dev/urandom dd ibs=1 obs=1 count=9 | od -tx1 -An | tr -d ' '
Or as Base64, which is shorter.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed -n 2p
If there's some hard constraint that âÂÂpasswords must contain at least one special characterâ (which is a questionable way to make passwords selected by average humans more secure, and it completely wrong for randomly generated passwords), then you can't simply use a random password, because there's a chance that it'll happen not to contain any character in a required class. If you reject passwords that don't meet the constraint, you're reducing the security of the password. Instead, make the password longer, e.g.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/'
If you need the password to be memorable, that's a different problem. The best memorable passwords are passphrases.
can this stdd in and out be removed please sol10 # dd if=/dev/urandom ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/' 9+0 records in 9+0 records out A9xk0r4MvMCY-Aa1 sol10 #
â judi
May 8 at 14:06
Thanks Much , this will eliminate the dd command output.dd if=/dev/urandom ibs=1 obs=1 count=9 2>/dev/null | uuencode -m - | sed '2!d; s/$/-Aa1/'
â judi
May 8 at 14:20
add a comment |Â
up vote
3
down vote
up vote
3
down vote
You can get cryptographic-quality random bytes from /dev/urandom
. (This exists since Solaris 9. It also exists on Linux.) This includes unprintable characters, so you need to remove those. The following command extracts 10 random printable, non-space ASCII characters.
</dev/urandom tr -dc '!-~' | dd ibs=1 obs=1 count=10
I don't recommend using special characters in passwords. They don't make passwords more secure. What makes the security of a password is its entropy. A 10-character password has 10ÃÂlog2(94) â 65.5 bits of entropy. You can get the same amount of entropy from 9 arbitrary bytes and encode them as you wish, for example as hexadecimal.
</dev/urandom dd ibs=1 obs=1 count=9 | od -tx1 -An | tr -d ' '
Or as Base64, which is shorter.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed -n 2p
If there's some hard constraint that âÂÂpasswords must contain at least one special characterâ (which is a questionable way to make passwords selected by average humans more secure, and it completely wrong for randomly generated passwords), then you can't simply use a random password, because there's a chance that it'll happen not to contain any character in a required class. If you reject passwords that don't meet the constraint, you're reducing the security of the password. Instead, make the password longer, e.g.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/'
If you need the password to be memorable, that's a different problem. The best memorable passwords are passphrases.
You can get cryptographic-quality random bytes from /dev/urandom
. (This exists since Solaris 9. It also exists on Linux.) This includes unprintable characters, so you need to remove those. The following command extracts 10 random printable, non-space ASCII characters.
</dev/urandom tr -dc '!-~' | dd ibs=1 obs=1 count=10
I don't recommend using special characters in passwords. They don't make passwords more secure. What makes the security of a password is its entropy. A 10-character password has 10ÃÂlog2(94) â 65.5 bits of entropy. You can get the same amount of entropy from 9 arbitrary bytes and encode them as you wish, for example as hexadecimal.
</dev/urandom dd ibs=1 obs=1 count=9 | od -tx1 -An | tr -d ' '
Or as Base64, which is shorter.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed -n 2p
If there's some hard constraint that âÂÂpasswords must contain at least one special characterâ (which is a questionable way to make passwords selected by average humans more secure, and it completely wrong for randomly generated passwords), then you can't simply use a random password, because there's a chance that it'll happen not to contain any character in a required class. If you reject passwords that don't meet the constraint, you're reducing the security of the password. Instead, make the password longer, e.g.
</dev/urandom dd ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/'
If you need the password to be memorable, that's a different problem. The best memorable passwords are passphrases.
answered May 8 at 12:47
Gilles
503k1189951522
503k1189951522
can this stdd in and out be removed please sol10 # dd if=/dev/urandom ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/' 9+0 records in 9+0 records out A9xk0r4MvMCY-Aa1 sol10 #
â judi
May 8 at 14:06
Thanks Much , this will eliminate the dd command output.dd if=/dev/urandom ibs=1 obs=1 count=9 2>/dev/null | uuencode -m - | sed '2!d; s/$/-Aa1/'
â judi
May 8 at 14:20
add a comment |Â
can this stdd in and out be removed please sol10 # dd if=/dev/urandom ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/' 9+0 records in 9+0 records out A9xk0r4MvMCY-Aa1 sol10 #
â judi
May 8 at 14:06
Thanks Much , this will eliminate the dd command output.dd if=/dev/urandom ibs=1 obs=1 count=9 2>/dev/null | uuencode -m - | sed '2!d; s/$/-Aa1/'
â judi
May 8 at 14:20
can this stdd in and out be removed please sol10 # dd if=/dev/urandom ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/' 9+0 records in 9+0 records out A9xk0r4MvMCY-Aa1 sol10 #
â judi
May 8 at 14:06
can this stdd in and out be removed please sol10 # dd if=/dev/urandom ibs=1 obs=1 count=9 | uuencode -m - | sed '2!d; s/$/-Aa1/' 9+0 records in 9+0 records out A9xk0r4MvMCY-Aa1 sol10 #
â judi
May 8 at 14:06
Thanks Much , this will eliminate the dd command output.
dd if=/dev/urandom ibs=1 obs=1 count=9 2>/dev/null | uuencode -m - | sed '2!d; s/$/-Aa1/'
â judi
May 8 at 14:20
Thanks Much , this will eliminate the dd command output.
dd if=/dev/urandom ibs=1 obs=1 count=9 2>/dev/null | uuencode -m - | sed '2!d; s/$/-Aa1/'
â judi
May 8 at 14:20
add a comment |Â
up vote
-1
down vote
You have perl in Solaris, it helps:
perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10'
With special characters it will be:
perl -e 'print [0..9,a..z,A..Z,qw- _ / & ?]->[rand 67]for 0..10'
Thanks - but there is no special characters. sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' e9RKUJiss3 sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' zLdxvTqlJT sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' AiaiDubgye sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' lJxiV2iDwY sol10 #
â judi
May 8 at 12:01
You may add special characters in such way: perl -e 'print [a..z,A..Z,0..9,qw- _ / & ?]->[rand 67]for 0..10'
â Sasha Golikov
May 8 at 12:24
1
No, Perl'srand
is not suitable to generate a password. This answer is insecure.
â Gilles
May 8 at 12:31
add a comment |Â
up vote
-1
down vote
You have perl in Solaris, it helps:
perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10'
With special characters it will be:
perl -e 'print [0..9,a..z,A..Z,qw- _ / & ?]->[rand 67]for 0..10'
Thanks - but there is no special characters. sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' e9RKUJiss3 sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' zLdxvTqlJT sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' AiaiDubgye sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' lJxiV2iDwY sol10 #
â judi
May 8 at 12:01
You may add special characters in such way: perl -e 'print [a..z,A..Z,0..9,qw- _ / & ?]->[rand 67]for 0..10'
â Sasha Golikov
May 8 at 12:24
1
No, Perl'srand
is not suitable to generate a password. This answer is insecure.
â Gilles
May 8 at 12:31
add a comment |Â
up vote
-1
down vote
up vote
-1
down vote
You have perl in Solaris, it helps:
perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10'
With special characters it will be:
perl -e 'print [0..9,a..z,A..Z,qw- _ / & ?]->[rand 67]for 0..10'
You have perl in Solaris, it helps:
perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10'
With special characters it will be:
perl -e 'print [0..9,a..z,A..Z,qw- _ / & ?]->[rand 67]for 0..10'
edited May 8 at 12:38
answered May 8 at 11:44
Sasha Golikov
1317
1317
Thanks - but there is no special characters. sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' e9RKUJiss3 sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' zLdxvTqlJT sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' AiaiDubgye sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' lJxiV2iDwY sol10 #
â judi
May 8 at 12:01
You may add special characters in such way: perl -e 'print [a..z,A..Z,0..9,qw- _ / & ?]->[rand 67]for 0..10'
â Sasha Golikov
May 8 at 12:24
1
No, Perl'srand
is not suitable to generate a password. This answer is insecure.
â Gilles
May 8 at 12:31
add a comment |Â
Thanks - but there is no special characters. sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' e9RKUJiss3 sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' zLdxvTqlJT sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' AiaiDubgye sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' lJxiV2iDwY sol10 #
â judi
May 8 at 12:01
You may add special characters in such way: perl -e 'print [a..z,A..Z,0..9,qw- _ / & ?]->[rand 67]for 0..10'
â Sasha Golikov
May 8 at 12:24
1
No, Perl'srand
is not suitable to generate a password. This answer is insecure.
â Gilles
May 8 at 12:31
Thanks - but there is no special characters. sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' e9RKUJiss3 sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' zLdxvTqlJT sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' AiaiDubgye sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' lJxiV2iDwY sol10 #
â judi
May 8 at 12:01
Thanks - but there is no special characters. sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' e9RKUJiss3 sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' zLdxvTqlJT sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' AiaiDubgye sol10 # perl -e 'print[0..9,a..z,A..Z]->[rand 62]for 1..10' lJxiV2iDwY sol10 #
â judi
May 8 at 12:01
You may add special characters in such way: perl -e 'print [a..z,A..Z,0..9,qw- _ / & ?]->[rand 67]for 0..10'
â Sasha Golikov
May 8 at 12:24
You may add special characters in such way: perl -e 'print [a..z,A..Z,0..9,qw- _ / & ?]->[rand 67]for 0..10'
â Sasha Golikov
May 8 at 12:24
1
1
No, Perl's
rand
is not suitable to generate a password. This answer is insecure.â Gilles
May 8 at 12:31
No, Perl's
rand
is not suitable to generate a password. This answer is insecure.â Gilles
May 8 at 12:31
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f442519%2fgenerate-random-password-with-special-characters-on-solaris%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
mostly not working in solaris
â judi
May 8 at 11:35
1
âÂÂ10 digitsâ contradicts âÂÂspecial characterâÂÂ. What is your exact requirement? Edit your question. Your question may or may not end up being a duplicate of this depending on what you need.
â Gilles
May 8 at 11:41
Thanks - the password should be 10 characters - Alpha + Numeric+ Special character
â judi
May 8 at 11:59
1
A list of commands you tried and any output / error messages you got (and what you expected instead) might help to understand your issue.
â frostschutz
May 8 at 12:14