-2

So I read this questionUrandom Alternative, but I am unable to make a comment there (without 50 rep) - therefore I open a separate question: If I use this command instead of dd and urandom, how do I set the size of the resulting randomfile.bin?

openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero > randomfile.bin

closed as off-topic by womble, Ward, HBruijn, Roman, MadHatter Aug 18 '15 at 6:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow." – womble, Ward, HBruijn, MadHatter
If this question can be reworded to fit the rules in the help center, please edit the question.

  • You can't comment on that question because it is locked, because it isn't an on-topic question for this site. Neither is this question. – womble Aug 16 '15 at 5:07
1

The problem is that you are reading from /dev/zero that will generate infinity zeros, a way to limit it is using head command to control the size of the output, and pipe that instead of passing it as the input file. So a way to generate a 65535 file is the following:

head -c 65535 /dev/zero | openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt  > randomfile.bin
  • The thing is, I want to create a 100gb file, which is afterwards used as LUKS container. Thanks a lot, your solution worked out fine! – user1252280 Aug 15 '15 at 18:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.