If you want command like ls -alh in one go, you can create an alias using the following:
alias ll="ls -alh"
Now each time you type ll, you'll get the output for "ls -alh" and win few fraction of second :)
Monday, November 6, 2017
Saturday, November 4, 2017
How to verify if CSR - Certificate Request and SSL certificate - Public Key are using same private key
To plain display certificate, you can use the following:
Display certificate:
CSR:
openssl req -in req.csr -noout -text
Certificate - Public Key:
openssl x509 -in cert.cer -noout -text
In order to make sure those use the same private key, modulus section shall be the same.
So, all the below shall match:
Private Key:
openssl rsa -noout -modulus -in private.key
CSR:
openssl req -noout -modulus -in req.csr
Certificate - Public Key:
openssl x509 -noout -modulus -in cert.cer
Display certificate:
CSR:
openssl req -in req.csr -noout -text
Certificate - Public Key:
openssl x509 -in cert.cer -noout -text
In order to make sure those use the same private key, modulus section shall be the same.
So, all the below shall match:
Private Key:
openssl rsa -noout -modulus -in private.key
CSR:
openssl req -noout -modulus -in req.csr
Certificate - Public Key:
openssl x509 -noout -modulus -in cert.cer
Saturday, October 7, 2017
How to scp/ssh using private/public keys
Note: Below tested on CentOS/RedHat 7x
1. In source system generate keys for specific user:
ssh-keygen -t rsa -C "user@source-machine-name"
Enter file in which to save the key (/root/.ssh/id_rsa): filename_rsa
No Passprase Enter passphrase (empty for no passphrase): passphrase
Enter same passphrase again: passphrase
2. In destination system under /home/user create .ssh folder (owner user and rights 700), and after create FILE authorized_keys (inside .ssh folder) (chmod 644 chown user) and copy Public key from source system into this file.
3. In destination system:
service sshd restart
4. SSH from source to destination
ssh -i id_rsa_user user@destination-machine-ip
5. SCP files from source to destination
scp -i id_rsa_user /path/test.txt user@destination-machine-ip:/destination-folder/
1. In source system generate keys for specific user:
ssh-keygen -t rsa -C "user@source-machine-name"
Enter file in which to save the key (/root/.ssh/id_rsa): filename_rsa
No Passprase Enter passphrase (empty for no passphrase): passphrase
Enter same passphrase again: passphrase
2. In destination system under /home/user create .ssh folder (owner user and rights 700), and after create FILE authorized_keys (inside .ssh folder) (chmod 644 chown user) and copy Public key from source system into this file.
3. In destination system:
service sshd restart
4. SSH from source to destination
ssh -i id_rsa_user user@destination-machine-ip
5. SCP files from source to destination
scp -i id_rsa_user /path/test.txt user@destination-machine-ip:/destination-folder/
Monday, August 14, 2017
Red Hat Linux - Disk File System Read Ahead
If there are issues with disk I/O or CPU wait time, you might consider fine tunning read ahead disk parameters:
1. Check current values and volumes:
blockdev --report
2. Set up proper parameters:
sudo blockdev --setra 256 /dev/xvda
If you want to read more, good documentation is here:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/main-fs.html
Linux Red Hat - change timezone
Set Date&Time as needed:
1. List all available timezones:
timedatectl list-timezones
2. Update timezone and check:
echo 'ZONE="Europe/Madrid"' > /etc/sysconfig/clock && ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime && date
1. List all available timezones:
timedatectl list-timezones
2. Update timezone and check:
echo 'ZONE="Europe/Madrid"' > /etc/sysconfig/clock && ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime && date
Saturday, July 8, 2017
Start Adobe Experience Manager AEM in command line
1. Get license jar (e.g. cq-quickstart-6.3.0.jar) and license.properties file from Adobe.
Please make sure you have a valid licensed product.
2. Move the above two files in the same folder
3. Rename jar file to desired run modes and port (e.g. aem-author-4502.jar)
4. Start jar using Java 8.
Example of run command:
java -XX:MaxMetaspaceSize=1024m -Xmx1024M -jar aem-author-4502.jar
5, It takes few minutes to start - once started you can get login screen with admin/admin user.
Please make sure you have a valid licensed product.
2. Move the above two files in the same folder
3. Rename jar file to desired run modes and port (e.g. aem-author-4502.jar)
4. Start jar using Java 8.
Example of run command:
java -XX:MaxMetaspaceSize=1024m -Xmx1024M -jar aem-author-4502.jar
5, It takes few minutes to start - once started you can get login screen with admin/admin user.
Wednesday, June 21, 2017
Use crontab on AWS RedHat
1. Get your script defined and get it into a proper location on the machine:
touch script.sh
chmod +x script.sh
vi script.sh
Example of script copying files to a user home folders:
#!/bin/bash
cd /folder/test-pckg/
chown dest_user:dest_user filename*
mv filename* /home/dest_user/prod-pckg/
2. Add your script to crontab
crontab -e
30 21 * * * /folder/test-pckg/script.sh
The above runs each day at 21:30 local machine time.
3. Verify if it runs under cron tab logs:
cat /var/log/cron
You should grep for a line like the below:
Jun 20 21:30:01 instance-name CROND[12092]: (root) CMD (/folder/script.sh)
touch script.sh
chmod +x script.sh
vi script.sh
Example of script copying files to a user home folders:
#!/bin/bash
cd /folder/test-pckg/
chown dest_user:dest_user filename*
mv filename* /home/dest_user/prod-pckg/
2. Add your script to crontab
crontab -e
30 21 * * * /folder/test-pckg/script.sh
The above runs each day at 21:30 local machine time.
3. Verify if it runs under cron tab logs:
cat /var/log/cron
You should grep for a line like the below:
Jun 20 21:30:01 instance-name CROND[12092]: (root) CMD (/folder/script.sh)
Subscribe to:
Posts (Atom)