Cómo configurar el controlador de red UniFi como un servicio de Windows
5 de julio de 2020Compendio de scripts para DBA MS-SQL
10 de septiembre de 2020Ficheros entre 2 fechas
du -sh --time * | awk '$2 >= "2014-10" $2 <= "2014-11" ' | xargs rm -rf
Añadir usuario a grupo (ej. usuario a grupo sudo)
usermod -a -G groupName userName
Añadir usuario y usuario a grupo
adduser username
adduser user group
Entrar en consola Mysql de un contenedor docker
docker exec -it miweb_db mysql -u userName -p
Entrar en bash de un servidor web nginx
docker exec -it nginx-test /bin/bash
Cambiar atributos a directorios y archivos
find . -type d -exec chmod 775 {};
find . -type f -exec chmod 664 {};
Cambiar propietario
chown -R www-data:www-data /var/www/html/
Aplicar /etc/sysctl.conf sin reiniciar
sysctl --system
Tamaño directorios
du -sh /var/log
Tarea crontab
20 00 * * * * /usr/local/bin/ejecutable_proceso watchdog > /dev/null 2> 1
Consulta a dispositivo por SNMP
snmpwalk -v2c -cpublic 172.20.20.100
snmptable -v 2c -cpublic 172.20.20.100 IF-MIB::ifXTable
Extraer claves de certificados
Extract .crt and .key files from .pfx file
Start OpenSSL from the OpenSSL\bin folder.
Open the command prompt and go to the folder that contains your .pfx file.
Run the following command to extract the private key:
openssl pkcs12 -in [yourfile.pfx] -nocerts -out [drlive.key]
You will be prompted to type the import password. Type the password that you used to protect your keypair when you created
the .pfx file. You will be prompted again to provide a new password to protect the .key file that you are creating.
Store the password to your key file in a secure place to avoid misuse.
Run the following command to extract the certificate:
openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [drlive.crt]
Run the following command to decrypt the private key:
openssl rsa -in [drlive.key] -out [drlive-decrypted.key]
Type the password that you created to protect the private key file in the previous step.
The .crt file and the decrypted and encrypted .key files are available in the path, where you started OpenSSL.
Convert .pfx file to .pem format:
There might be instances where you might have to convert the .pfx file into .pem format. Run the following command to convert it into PEM format.
openssl rsa -in [keyfile-encrypted.key] -outform PEM -out [keyfile-encrypted-pem.key]