Linux - Reddit – Telegram
Linux - Reddit
773 subscribers
4.19K photos
207 videos
39.9K links
Stay up-to-date with everything Linux!
Content directly fetched from the subreddit just for you.

Powered by : @r_channels
Download Telegram
[Tutorial for beginners] How to install and use GnuPG on GNU/Linux

Hello, friends!

​

If you are worried about your personal/professional documents and want to keep them safe, I'd like to recommend the software *"GnuPrivacy Guard"* (a.k.a *GnuPG* or *GPG*).

But, first things first. I don't want to be rude, but I am presuming that you have a GNU/Linux distribution installed into your computer, and that you have the basic knowledge on how to use your system, install a package using graphical and command line interface, how to use the terminal etc. I recommend to use Internet to learn about GNU/Linux before continue with this simple tutorial.

GnuPG is a software that complies with OpenPGP standard, modelled on a program called *Pretty Good Privacy* (*PGP*). PGP is a program written by Philip R. Zimmermann in 1991.

An additional information you need to know is that GPG needs 2 encryption keys for each user. They are: private key and public key. The private key is used to encrypt, while the other key, public key, is used to decrypt. Also, your keys are going to storage your name, your e-mail, a password and a comment that explains, in few words, the purpose of these keys.

Let's start with the software installation. Open a terminal and type this command:

For Debian/Ubuntu and Debian-based distributions

sudo apt install gnupg

For RedHat/Fedora and RedHat-based distributions

sudo yum install gnupg

Once installed, let's create and use your new keys. In a terminal, type:

gpg --full-generate-key
gpg --full-gen-key # Command with abbreviated/short parameter

https://i.redd.it/6agjpes16wg31.png

The first prompt wants to know which option you want. Let's select the option number 1, which is the default. You can press **ENTER** without type any value.

The next prompt asks for the key size. What is key size? In simple words, it's about the security level/force of your keys. You can pick the default option pressing **ENTER** or any other value between 1024 and 4096 bits.

https://i.redd.it/bu4pceq36wg31.png

Now, let's define for how long these GPG keys are going to be valid. Using the list bellow as a reference, you can choose days, weeks, months and years. My recommendation is 1 year. So, you can type: **365** **ENTER** (or) **1y** **ENTER**

https://i.redd.it/q128em756wg31.png

As soon as you pick an option, the following prompt asks to confirm. Type **Y** and press **ENTER.**

https://i.redd.it/63o6yj396wg31.png

The next step is to insert your personal information. In the last line (Change name, comment...), you can use uppercase or lowercase letters.

https://i.redd.it/egljr45b6wg31.png

This is one of the most important part of GPG keys creation: the password. It's extremely recommended to use a strong password. Strong passwords are passwords combining uppercase/lowercase letters, numbers and special characters, e.g.: Th1s\_1s\_@\_STr0nG\_P@ssW0rd

https://i.redd.it/s1o6eovd6wg31.png

As soon as you press "OK", GnuPG is going to take a moment to create your keys. Don't worry about the time, just wait. The last thing you are going to see is the following information.

https://i.redd.it/moe7ceo69wg31.png

Voilá! You created your keys.

Using the same terminal, you can list your keys:

gpg --list-key # You can use '--list-keys' in plural; the output is the same
gpg -k # Command with abbreviated/short parameter

https://i.redd.it/yntsp5ki6wg31.png

Now, let's start with the encryption and decryption steps of a file. In the terminal, create a simple TXT file:

echo "This is a secret message!" > example.txt
cat example.txt

https://i.redd.it/yaem8xqs6wg31.png

As you can see, a file with a message was created. You can open it with a simple notepad. To encrypt it, type:

gpg --recipient <YOUR_EMAIL> --encrypt example.txt
gpg -r <YOUR_EMAIL> -e example.txt # Command with abbreviated/short parameter

Once you press **ENTER**, the file **"example.txt"** will be encrypted as **"example.txt.gpg"**. If you try to read it using the command **"cat"**,
you are going to see strange characters in your screen.

cat example.txt.gpg

Another option is to encrypt all the information in a readable file. To do this, you must add the parameter `--armor` or `--armour` (sort version `-a`), and the output file will be **"example.txt.asc"** You can read it using the command **"cat"** or a simple notepad.

gpg --recipient <YOUR_EMAIL> --encrypt --armour example.txt
gpg --recipient <YOUR_EMAIL> --encrypt --armor example.txt
gpg -r <YOUR_EMAIL> -e -a example.txt # Command with abbreviated/short parameters

https://i.redd.it/vy35j36w6wg31.png

You learned how to encrypt, but how about the decrypt method? It's simple! You need to replace `--encrypt` or `-e` by `--decrypt` or `-d`, and add the parameter `--output` or `-o` followed by the filename. But there's a detail, the output parameter needs to come before the decrypt parameter. Also, it doesn't matter if you encrypted a file as *.GPG* or *.ASC*, the GnuPG is going to decrypt both. Before learn how to decrypt, I'd like to ask you to delete the file **"example.txt"** and keep any encrypted file (example.txt.gpg / example.txt.asc).

gpg --recipient <YOUR_EMAIL> --output example.txt --decrypt example.txt.gpg
gpg -r <YOUR_EMAIL> -o example.txt -d example.txt.gpg # Command with abbreviated/short parameters

In this moment, a password window is asking for your GnuPG password. Once you typed the correct password, your file is going to be decrypted.

https://i.redd.it/kc0zcio07wg31.png

Well... This is all, folks!

For more information about GnuPG, you can access the official website [GnuPG](https://gnupg.org)

https://redd.it/creb29
@r_linux
When/Why do you choose a non-copyleft licence over the (L)GPL?

I'm interested in finding out why people use non-copyleft licences for new projects. I found some ideas on when a different licence might be useful at [https://www.gnu.org/licenses/license-recommendations.html](https://www.gnu.org/licenses/license-recommendations.html#contributing) but I have seen new 'independent' projects using licences which would allow others to take their work to proprietary software and screwing with the FLOSS ideas of the creators and contributors. Btw do you have examples for such practices?

https://redd.it/crivhv
@r_linux
Flatpak via Tor

Is it possible to install and update flatpaks through Tor?

https://redd.it/crkwwo
@r_linux
/e/ is now selling refurbished smartphones with /e/ pre-installed
https://e.foundation/e-pre-installed-refurbished-smartphones/

https://redd.it/crlv9v
@r_linux
VIM 'for people who don't want to use it , but have to '
https://redd.it/crm4n0
@r_linux
How the system can respond to vm.overcommit_memory=2

[https://imgur.com/a/p9j67KA](https://imgur.com/a/p9j67KA)

https://redd.it/crmbb5
@r_linux
Linux installation in phone

Ive been thinking about installing linux on my phone, does anyone know if thats a good idea or not ???

https://redd.it/cro208
@r_linux
Is there any application / noscript to automatically move files?

I download a lot of things (images, videos, files) from the web. I'd like to find a way to keep my downloads folder organized. A program that looks at the file type, and moves it to a selected folder, would be the perfect solution.

I've been searching in the Software Center, didn't find anythinh.

I use Manjaro with KDE desktop.

Thanks!

https://redd.it/crrn5u
@r_linux
Kernel based User Isolation vs Container/Chroot

I have heard quite some times of breaking out of containers and chroots and fucking up cgroups and namespaces.

What I have never heard of yet is breaking out of user isolation (two separate user accounts on the same installation), it seems like its impossible to access user A files as user B if permissions have been set properly.

I want to know which one is the most secure ie least likely to have bugs and most likely to protect applications from reading files it has no permissions to read.

https://redd.it/cru6t7
@r_linux
Multiplayer survival game Rust is offering refunds for Linux users

They're going to stop shipping the linux client as well. [Here is a good writeup about it](https://www.rockpapershotgun.com/2019/08/17/rust-will-offer-refunds-as-they-stop-shipping-linux-client/) but they've pretty much said none of the developers used linux outside of developing the game client, Unity doesn't support building the anticheating software for linux, but does for Windows and OSX, etc. They knew they'd lose more money than they made off linux, but it sounds like it's become way too much of a hassle for them and they're at a crossroads.

They also gave the number of users who have played in the last 30 days by OS:

Windows 227,842
MacOS 2,414
Linux 217

But, they've gone even further and made the statement "Don't make Linux versions of any future games because we can't/won't properly support it"

https://redd.it/crxf7o
@r_linux