Encrypting archive and then dividing it into many parts

Unix & Linux Asked by user216488 on January 5, 2022

I have a personal archive of many files (more than 12Go)

I want to encrypt it with a password, then divide it into 100 parts.

How can I do so?

And how can I regroup it and de-encrypt it to get the files back?

2 Answers

If any of the 100 parts are lost/corrupted you could end up being unable to recover any files, I'd lean more towards 100 separate archives each encrypted.

But, with one giant split file you may end up needing 12Go (Gigabytes?) of free space to re-assemble the pieces, and another 12 to decrypt/view the archive, if your tools don't support pipeing with stdin/stdout.

Using tar & gpg & split together should work, like:

tar -c files | gpg -o- ... | split -b [size 1/100th of total] -

Options for split that might be useful may include:

  • -a3 generate suffixes of length N (default 2)
  • -d use numeric suffixes instead of alphabetic.
  • - read standard input.
  • outputfilename. name of output files

Answered by Xen2050 on January 5, 2022

To encrypt the file use openssl:

openssl aes-128-cbc -in the_archive -out the_archive.crypted

To split the file use split:

split -a 3 -b 100000 the_archived.crypted chunk.

To regroup the chunks use cat:

cat chunk.??? >the_archive.crypted

To decode the file use openssl again:

openssl aes-128-cbc -d -in the_archive.crypted -out the_archive

Answered by kmkaplan on January 5, 2022

Add your own answers!

Related Questions

Get active sink in PulseAudio

1  Asked on January 4, 2021 by inspectormustache


How do I run 32-bit programs on a 64-bit Debian/Ubuntu?

3  Asked on January 3, 2021 by gilles-so-stop-being-evil


Grub’s default kernel priority

0  Asked on January 3, 2021 by abhishek-deshpande


Kali Linux 2020.2 Stuck on dragon logo

1  Asked on January 2, 2021 by robotix


How to fix Ubuntu 18.04 LTS random freezes again

0  Asked on January 2, 2021 by manmax


X11 windows created by root

2  Asked on December 31, 2020 by saga


Kubuntu 20.04 Display Errror

0  Asked on December 31, 2020 by emil-dworniczak


How to exclude folders in sshfs mounting?

1  Asked on December 30, 2020


Ubuntu upgrade leads unmet dependencies

1  Asked on December 29, 2020 by jonkobu


How to know on which LAN a machine is connected?

0  Asked on December 29, 2020 by jpc


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir