Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to code a bash script that will automate the several tasks related to truecrypt. Tasks are: Creating a truecrypt volume, mounting it, copying a file in filesystem, modifying the file, unmounting the volume.

I have a question regarding creating the truecrypt volume. mounting and unmounting will not be a problem for me.

The command for creating volume is according to manpages:

> truecrypt -c [volume path]

but after this command trucrypt will prompt user to enter several parameters like volume type, size, encryption, hash, password etc.

How can automate all these so that user doesn't need to enter any value? Ok I can use following command for this:

truecrypt –size 200M –type normal –encryption AES –hash SHA-512 –filesystem FAT -c myvolume.tc

But now it asks for password. How to automate that?

Thanks

share|improve this question
    
expect is what you need. There may be easier ways, but thats what comes to my mind. –  Mahesh Nov 18 '12 at 13:09
add comment

2 Answers

up vote 1 down vote accepted

Use the --password=password flag to pass a random/set password through.

I would also use the --non-interactive flag so nothing interrupts the automation process.

Here is a list of all available commands to use with truecrypt:

http://www.irongeek.com/i.php?page=backtrack-3-man/truecrypt

share|improve this answer
    
Hey taang, I think we just posted almost at the same time. ;) Still thanks. –  pss Nov 19 '12 at 21:48
    
and what would be secure way of doing this - without visible password? –  Tomáš Fejfar Jun 25 '13 at 12:31
add comment

At last I got the solution. I shall type it here so that it may assist someone else in future. Before scripting with truecrypt always keep in mind the version number. The solution worked with charm for version 7.1a Can't comment about other versions.

Here is the command to create a truecrypt volume with prompting the user to enter any parameters:

truecrypt -t -–size=1074000000 --password=123 -k "" --random-source=/dev/urandom --volume–type=normal -–encryption=AES –-hash=SHA-512 -–filesystem=FAT -c myvolume.tc

NOTE: This is an insecure method as password is visible!!!

Regards,

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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