LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 07-03-2007, 06:24 AM   #1
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
uuencode for random password generation with /dev/urandom


I somewhere read how to produce a random password:
Code:
dd if=/dev/urandom bs=1 count=20 | uuencode
On my SUSE there is a mime_uuencode which doesn't deliver though. What am I missing here? Or rather, how is this done with SUSE?

Last edited by JZL240I-U; 07-03-2007 at 06:26 AM.
 
Old 07-03-2007, 06:37 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
I don't know anything particular about SUSE, but I'll bet the following will work on any distribution:

Code:
dd if=/dev/urandom bs=1 count=20 | uuencode x | head -2 | tail -1
Hope this helps.
 
Old 07-03-2007, 06:40 AM   #3
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Thank you, but no, it won't since ole SuSE 10.0 somehow doesn't come with uuencode. That's why I posted here in the SUSE Forum. What are SUSE-users using instead? Or alternatively what am I doing wrong?
 
Old 07-04-2007, 06:40 AM   #4
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
I've waited for about 24 hours for a SUSE person to respond. Sigh.

Ok, try this:

Code:
dd if=/dev/urandom bs=1 count=20 | md5sum | cut '-d ' -f1
 
Old 07-06-2007, 01:22 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Thank you wjevans_7d1@yahoo.com.

Your solution looks like a good idea, I'll try it over the weekend. In the meantime I resolved the basic issue ... would you believe it "uuencode" is part of the distribution but simply was not installed . I do apologize to any-/everybody *blush*.

After I installed "uuencode" I got results, but only with upper case letters -- not that optimal for creating random passwords with a greater variety in their character pool. Md5sum should do nicely.

Thanks again, wjevans_7d1@yahoo.com

Last edited by JZL240I-U; 08-13-2007 at 02:30 AM. Reason: typo
 
Old 07-07-2007, 08:21 AM   #6
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
If you don't like the uuencode solution because of no lower case letters, then md5sum will be even worse, because all you get are hex digits.

Try this perl script, removing what you don't want:

Code:
#!/usr/bin/perl
$a=`dd if=/dev/urandom bs=1 count=90`;
$a=~s/[\x00-\*]//g;      # eliminate low  characters
$a=~s/[\x7f-\xff]//g;    # eliminate high characters
$a=~s/\\\;\?\`\~//g;     # eliminate other characters which might be awkward
$a=substr($a,0,20);      # limit it to 20 characters
print("$a\n");
 
Old 07-12-2007, 06:38 AM   #7
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Right. Found that out about md5sum too . Thanks for the script, I'll try it soonest (thought that might still be in about a month).

Again, thank you.
 
Old 07-13-2007, 05:36 AM   #8
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
I just looked at my script again and found three bugs. Corrected script:

Code:
#!/usr/bin/perl

$a=`dd if=/dev/urandom bs=1 count=90`;
chomp($a);

$a=~s/[\x00-\ *]//g;     # eliminate low  characters
$a=~s/[\x7f-\xff]//g;    # eliminate high characters
$a=~s/[\\\;\?\`\~]//g;   # eliminate other characters which might be awkward
$a=substr($a,0,20);      # limit it to 20 characters

print("$a\n");
 
Old 08-13-2007, 02:43 AM   #9
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Okay, back again.

I tried your script and got the nasty answer:
Code:
bash: Cannot execute binary file <file name>
Perl is installed.

I can also type "perl" at the prompt, which produces a blank line. When I copy the script there an press return no result and no error is printed out.

What is perl expecting from me? What do I do wrong?
 
Old 08-14-2007, 12:17 AM   #10
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
What happens when you try this script?

Code:
#!/usr/bin/perl
print("Hello, world!\n");
 
Old 08-16-2007, 03:12 AM   #11
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Result of the test script (exactly as on my screen):
Code:
print("Hello,: bad interpreter: file or directory not found
What's that supposed to tell me?

Btw this is version perl5.8.7-linux-thread-multi

Last edited by JZL240I-U; 08-16-2007 at 03:16 AM.
 
Old 08-17-2007, 12:02 AM   #12
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
This is very strange.

Presumably you placed the two-liner in a file somewhere, changed the protection to 700, and then said

Code:
./whateverfilename
Correct?
 
Old 08-17-2007, 01:57 AM   #13
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Yes, indeed (I may have omitted the leading "./" though). I even copied it from your post on a floppy to take it home so as to be sure not to accidentally include a typo of my own making...

What now? Might there be some missing perl modules (in particular the printing module)? What perl files constitute a complete installation, i.e. could you post the perl directory from your machine?
 
Old 08-17-2007, 09:27 AM   #14
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Original Poster
Rep: Reputation: Disabled
Something to smile over?

http://ars.userfriendly.org/cartoons/?id=20070806

 
Old 08-19-2007, 09:27 AM   #15
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
Does any Perl script work on your system?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Random number generation jacques83 Programming 5 02-04-2006 12:38 PM
java- static messing with random number generation titanium_geek Programming 8 10-15-2005 01:39 PM
random number generation sailu_mvn Programming 4 03-10-2005 02:10 PM
Strong password generation Lindy Linux - Software 2 12-27-2003 07:00 PM
Generation of random primes SaTaN Programming 12 10-30-2003 04:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 02:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration