Monday, February 26, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 703  / 2 Years ago, sun, december 26, 2021, 5:25:23

I have just recently installed Ubuntu 22.04 on my computer, and I don't know much about Linux. I have a file that I'm trying to secure (only accessible by password, for example)


Does anybody know how can I do that?


More From » 22.04

 Answers
4

You can do that by:


1- Using GnuPG



  • Open the terminal.

  • Use the cd command and ls command to navigate to the directory containing the file you want to password-protect.

  • Once inside the directory, run the following command to encrypt your file:


gpg -c filename


  • Finally, when prompted for a passphrase, type in one that's strong and easy to remember.


GnuPG will now create an encrypted file (with .gpg extension) in your current working directory. To access it, you'll need to decrypt it. For this, run the following command, and when prompted for a password, enter the one you used to encrypt the file and hit Enter:


gpg filename.gpg

GnuPG will return a decrypted version of the file in your current working directory.


2- Using zip



  • Open the terminal and use the cd and ls commands to go into the directory with the files to encrypt.

  • Enter the command in the following format to create a password-protected zip file:


zip --password preferred_password archive_file.zip filename1 filename2

Here, replace preferred_password with the password you want to use to encrypt the archive and archive_file.zip with the file name you want to give to the resultant archive.


Now, when you want to access these files, unzip the archive and enter your password. Or, to do it via the terminal, run:


unzip archive_file.zip

Zip will now ask you for a password. Enter the password you set at the time of encryption and hit Enter to decrypt the file.


3- Using mcrypt



  • Open the terminal, and using cd and ls, go into the directory that contains the file you want to encrypt.

  • Enter the command below to list out all the supported encryption algorithms:


mcrypt --list


  • Finally, encrypt your file using:


mcrypt -a algorithm_name filename


  • When asked for a passphrase, enter it twice and hit Enter.
    mcrypt will now encrypt your file and save it with the ".nc" extension. If you wish to open this file, you'll need to decrypt it. To do this, run:


mcrypt -d filename.nc

And then, enter the decryption passphrase.


Source


[#27] Monday, December 27, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
skipu

Total Points: 366
Total Questions: 114
Total Answers: 112

Location: Saudi Arabia
Member since Mon, Sep 5, 2022
2 Years ago
skipu questions
Wed, Oct 6, 21, 10:26, 2 Years ago
Sun, Oct 31, 21, 02:01, 2 Years ago
Tue, Feb 14, 23, 19:48, 1 Year ago
Tue, Feb 22, 22, 08:37, 2 Years ago
;