Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, June 23, 2020

Crontab in Linux - Mithun Technologies - +91-9980923226

Mithun Technologies            +91-9980923226              devopstrainingblr@gmail.com

                                                       http://mithuntechnologies.com/
                                                       http://mithuntechnologies.co.in/ 
Crontab
 

To allow or deny access to specific users, crontab uses the files /etc/cron.allow and /etc/cron.deny. Based on the existence of /etc/cron.allow and /etc/cron.deny files, crontab decides whom to give access to cron in following order.

  1. If cron.allow exists – only the users listed in the file cron.allow will get an access to crontab.
  2. If cron.allow does not exist – all users except the users listed into cron.deny can use crontab
  3. If neither of the file exists – only the root can use crontab
  4. If a user is listed in both cron.allow and cron.deny – that user can use crontab.
crontab -l : To display the cron jobs.
crontab -e : To edit the cron table.

crontab -r : To remove the crontable without confirmation.
crontab -ir: To remove the crontable with confirmation.

To list,schedule or remove cron job for the particular user, use below commands.
#crontab -l -u mithun
#crontab -e -u mithun
#crontab -ir -u mithun

Crontab Format

# Minute   Hour    Day of Month          Month               Day of Week        Command /Script
# (0-59)    (0-23)        (1-31)            (1-12 or Jan-Dec)   (0-6 or Sun-Sat)    /usr/bin/find


Run the cron job every minute.
*/1 * * * *

Run the cron job every 10 minutes.

*/10 * * * *

Saturday, February 22, 2020

Steps to create password less ssh between two AWS EC2 instances - Mithun Technologues - +91-9980923226

Steps to create password less ssh between two AWS EC2 instances - Mithun Technologies - 9980923226

Mithun Technologies            +91-9980923226              devopstrainingblr@gmail.com

                                                       http://mithuntechnologies.com/
                                                       http://mithuntechnologies.co.in/ 
Steps to create password less ssh between two AWS EC2 instances

Pre Requisites

  2 Linux Servers
     Redhat Linux Server - A
     IP:       13.233.128.180
     User:     ec2-user
     Password: ********
   
     Redhat Linux Server - B
     IP:       13.127.64.6
     User:     ec2-user
     Password: ********

Step  1

Generate the ssh key using below command in Redhat Linux Server - A

ssh-keygey
~/.ssh/
id_rsa
id_rsa.pub

Step 2
Copy the public key from Redhat Linux Server - A to Redhat Linux Server - B as follows.

ssh-copy-id ec-user@Redhat Linux Server - B HostName/IP Address


Step 3
Test the configurations as follows.

ssh ec2-user@Redhat Linux Server - B HostName/IP Address

It should not ask the password and It will successfully connected to Redhat Linux Server - B from Redhat Linux Server - A




  

Tuesday, October 22, 2019

AWS Password Login - Configuration - Mithun Technologies +91-9980923226

Mithun Technologies            +91-9980923226              devopstrainingblr@gmail.com
                                                       http://mithuntechnologies.com/
                                                       http://mithuntechnologies.co.in/ 



Enable a password login instead of pem file when logging into EC2 Instance using SSH
================================================================


Procedure to Enable the password login
---------------------------------------------------

Step 1) First login into ec2 instance with pem file, then switch to root user.
ssh -i "mithuntechnologies.pem" ec2-user@ec2-52-66-196-244.ap-south-1.compute.amazonaws.com

sudo su - (OR) sudo -i

Step 2) Set a password for ec2-user as follows.
       
passwd ec2-user
       
Step 3) Update the PasswordAuthentication parameter in the /etc/ssh/sshd_config file as follows.
       
vi /etc/ssh/sshd_config
       
PasswordAuthentication yes

Step 4) Restart the sshd service as follows.

service sshd restart


Nexus Server Installation in Linux - Mithun Technologies - +91-9980923226

Mithun Technologies            +91-9980923226              devopstrainingblr@gmail.com
                                                       http://mithuntechnologies.com/
                                                       http://mithuntechnologies.co.in/ 

Login as a root user
sudo su -
cd /opt
yum install tar wget -y
wget http://download.sonatype.com/nexus/3/nexus-3.15.2-01-unix.tar.gz
tar -zxvf nexus-3.15.2-01-unix.tar.gz
mv /opt/nexus-3.15.2-01 /opt/nexus

#As a good security practice, Nexus is not advised to run nexus service as a root user, so create a new user called nexus and grant sudo access to manage nexus services as follows.
 

useradd nexus

#Give the sudo access to nexus user

visudo
nexus ALL=(ALL) NOPASSWD: ALL

#Change the owner and group permissions to /opt/nexus and /opt/sonatype-work directories.

chown -R nexus:nexus /opt/nexus
chown -R nexus:nexus /opt/sonatype-work
chmod -R 775 /opt/nexus
chmod -R 775 /opt/sonatype-work

#Open /opt/nexus/bin/nexus.rc file and  uncomment run_as_user parameter and set as nexus user.

vi /opt/nexus/bin/nexus.rc
run_as_user="nexus"

#Create nexus as a service

ln -s /opt/nexus/bin/nexus /etc/init.d/nexus

#Switch as a nexus user and start the nexus service as follows.

sudo su - nexus

#Enable the nexus services
sudo systemctl enable nexus

#Start the nexus service
sudo systemctl start nexus

#Access the Nexus server from Laptop/Desktop browser.
 
http://IPAddess/Hostname:8081/

#Default Credentials
User Name:
Password:

Troubleshooting
---------------------

nexus service is not starting?

a)make sure need to change the ownership and group to /opt/nexus and /opt/sonatype-work directories and permissions (775) for nexus user.
b)make sure you are trying to start nexus service with nexus user.
c)check java is installed or not using java -version command.
d) check the nexus.log file which is availabe in  /opt/sonatype-work/nexus3/log  directory.

Unable to access nexus URL?
-------------------------------------

a)make sure port 8081 is opened in security groups in AWS ec2 instance.

Thursday, September 12, 2019

Convert pem(Privacy-Enhanced Mail) file to ppk(PuTTY Private Key) file - Mithun Technologies +91-9980923226

  Mithun Technologies            +91-9980923226              devopstrainingblr@gmail.com                                                       http://mithuntechnologies.com/
                                                       http://mithuntechnologies.co.in/ 
Step1) To convert .pem file to .ppk , we need to use the puttygen software.
Download the puttygen(for 64 bit Windows OS) software by using below url.


https://the.earth.li/~sgtatham/putty/latest/w64/puttygen.exe



Step2) Open the puttygen software.

Click on puttygen.exe icon.



Once you have double clicked on puttygen.exe file, it will open the below screenshot.

Step3) Load the pem file as follows.
Click on Load button and select the pem file and click on Open, as follows.


Once you have clicked on Open, you will see below popup, click on OK button.



Step4) Save the ppk file.

Click on Save private key button and select the path to store the ppk file as follows.




Give the filename for ppk file and click on Save button as follows.




Click on close symbol, once you have successfully generated.



Step5) Login into AWS EC2 instance  using ppk file as follows.

Download the putty software (for 64 bit Windows OS) from below url if you don’t have downloaded already from below url.


Once you have downloaded the putty software copy the putty software executable file (putty.exe) from Downloads folder to Desktop.

Open the Putty software. (Double click on putty.exe file), as follows.


Give the IP address of which server you want to connect as follows.


Select the ppk file
Expand on SSH --> Expand Auth --> Click on Browse and select the ppk file and click on Open button as follows.

Give the username as ec2-user for RHEL instance and hit the Enter button.



Type exit command for disconnecting.



Ansible Installation in Amazon Linux - Mithun Technologies - 9980923226

  Mithun Technologies            +91-9980923226              devopstrainingblr@gmail.com                                                 ...