Thursday 23 August 2018

ssh passwordless authentication with key file in linux

Step 1

Need to create a key file with following command

 ssh-keygen -t rsa -b 2048 -f ssh-key-name

then copy the file that you want to access it with this key

scp -r ssh-key-name.pub root@192.168.1.50

Step 2

In remote machine we need to add this key to authorized_keys with below command

cat ssh-key-name >> .ssh/authorized_keys

if authorized_keys file or .ssh is not available then we have to create it manually. 

goto the home directory of the user that you need to provide this access and create it.

mkdir .ssh

touch .ssh/authorized_keys 

chmod  700 .ssh

chmod 600 .ssh/authorized_keys

now add the key in authorized_keys

cat ssh-key-name > .ssh/authorized_keys

Step 3

Now we can access the remote server with following command

 ssh -i ssh-key-name root@192.168.1.50

it will login to the remote server without using password. 

Wednesday 22 August 2018

How to add larger than 2TB HDD in Linux

Step 1 

Check the partition label with fdisk command 

fdisk -l 


Step 2 

Now we need to use that in parted command to create partition

parted /dev/sda



Now set the partition table format as gpt with below command

mklabel gpt



Now assign primary partition and assign capacity of the disk with below command

mkpart primary 0GB 4000.8GB



Step 3

Now check the partition that we have created in fdisk

fdisk -l

Now format it with below command

mkfs.ext4 /dev/sda1 



 Now we can mount that partition with below command

mount /dev/sda1 /USB_DISK

 
and also add the same in /etc/fstab 

/dev/sda1               /USB_DISK               ext4    defaults        0 0
 

 
 Now check the mounted partition with df command

df -h

 

Permanent hostname setup for RHEL7

Step 1 Set the host name on NMTUI tool like following nmtui set host name   then save and exit Step 2 add the following l...