Setting grub password in single line command

as grub  does not accept the password in single linewith below method.

[root@host1~]# echo -e “password\npassword” | grub2-setpassword
stty: standard input: Inappropriate ioctl for device

we can use below command to reset the grub password(but it ask for manual intervention)

printf '%s\n' "password" "password" | script -qf -c 'grub2-setpassword' /dev/null

save the above command to grub-pass.sh and run with nohup  command

 

 

Server hardening linux

Server harding is a process to make system secure and manageable.

for example.

  1. root login disable on ssh
  2. set password in single usermode
  3. removing unwanted kernal module
  4. enforcing SELinux
  5. remote login warning banner
  6. apply security patches
  7. Disable xinetd service
  8. unwanted network port blocked
  9. Enable audit logs
  10. logging is configured

Steps for hardening : https://www.cisecurity.org/cis-benchmarks/