Linux administration
- create Linux user without password
bash
useradd -m -d /home/username -s /bin/bash username
- delete Linux user's password
bash
passwd -d username
- display pub key from a private key (useful when there are multiple pub keys in authorized_key file)
bash
ssh-keygen -y -f /path/to/privatekey > /path/to/pubkey
- OpenSSL Operations
- generate self-signed certificate
```bash
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -subj '/CN=localhost'
```
-
convert certificate and key to PFX format
bash openssl pkcs12 -inkey key.pem -in cert.cert -export -out pfx.pfx- convert PFX to certificate and key formatbash # extract key openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key] # extract certificate openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt] # if you need to have an unencrypted key (no passphrase) openssl rsa -in [keyfile-encrypted.key] -out [keyfile-decrypted.key] # if you need to convert from key to pem format openssl rsa -in [keyfile-encrypted.key] -outform PEM -out [keyfile-encrypted-pem.pem] # to convert from crt to pem format openssl x509 -in [certificate.crt] -out [certificate.pem] -outform PEM -
add root and intermediate chain to PFX
bash # copy both root and intermediate public certs in Base-64 encoded (.cer/.pem) # then create new (.cer/.pem) file pasting the content of intermediate then root certs back to back openssl pkcs12 -export -out your_cert.pfx -inkey your_private.key -in your_cert.cer -certfile verisign-chain.cer -
find installed package version on Debian systems
bash
dpkg -s PACKAGE-NAME | grep '^Version:'