Method of adding password when packaging tar file under Linux

Time:2021-10-4

There is a folder of PMA directory under the current directory:

1. Use tar to compress and encrypt files:

Copy code

The code is as follows:

# tar -zcvf – pma|openssl des3 -salt -k password | dd of=pma.des3

When you finish, you will get a packaged file of pma.des3, and replace the password with the password you set.

2. Unzip the encrypted file using tar:

Copy code

The code is as follows:

# dd if=pma.des3 |openssl des3 -d -k password|tar zxf –

Note: the command ends with “-“, which will release all files. The – K password can not be used, so you will be prompted to enter the password after executing the command. Adding the – k parameter means that the password is automatically verified in the program.
201573171856012.jpg (750×466)