Archive for March, 2015

GPG basic commands

Export your public key:
gpg –armor -o filename.asc –export localemailaddress

Generate key:
gpg –gen-key

Generate key with more options:
gpg –no-default-keyring –keyring $PWD/.gpg/jgz-keyring –secret-keyring $PWD/.gpg/jgz-secring –trustdb-name $PWD/.gpg/jgz-trustdb –no-random-seed-file –gen-key

Delete private keyring:
gpg –delete-secret-key user # Either email or Real Name in quotes

Delete pub key from keyring:
gpg –delete-key user # Either email or Real Name in quotes

Import public key:
gpg –import publickeyfile.asc

Decrypt a file:
gpg -o filename –decrypt filename.gpg

Note: I have found that if you use su to become the account that encrypted the file, you may need to do the following to allow other accounts access to your current tty:
This worked on a CentOS7 server:
chmod o+rw $(tty)

Encrypt a file:
gpg –output filename.gpg –encrypt –recipient recipeientemailaddress filename # recipientemailaddress is the email address used for a public previously imported.

Edit/trust key:
gpg –edit-key 12345678
gpg> trust

Check an existing key fingerprint:
gpg –fingerprint emailaddress

CentOS 7 change timezone.

To List all timezones:

# timedatectl list-timezones

To set to the new timezone:

# timedatectl set-timezone newtimezone

Sample output:

# timedatectl list-timezones | grep Angeles
# timedatectl set-timezone America/Los_Angeles
# date
Thu Mar 5 11:56:43 PST 2015
# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 41 Mar 5 11:56 /etc/localtime -> ../usr/share/zoneinfo/America/Los_Angeles

To view your current timezone configuration:

# timedatectl status

Return top

INFORMATION