azzid wrote: ↑2017/03/20 16:53:21
Changing
/etc/login.defs and running
authconfig --updateall changes the limit in a way that won't get overwritten.
This solution is the most reliable, thanks for sharing!
I'd like to share a story. I have a template of CentOS-7.2-x64 that I had preserved more than a year ago. So, when I need a CentOS-7.x-based instance, I usually deploy a virtual machine with this template, log in and run
fdisk to delete and create the
vda2 partition to resize it. Then I always reboot the OS to make it understand that the
vda2 has new parameters, log in again and run
pvresize,
lvextend and other tools (including
yum to update all the packages, of course).
Yesterday an odd thing happen. I deployed a new virtual machine, successfully logged in as
root for the first time, made some changes, ran
reboot and... was unable to log-in as
root anymore. Long story short, I've found these lines in
/var/log/secure and the solution kindly provided by you (again, thank you!)
But there was a thing I couldn't understand: why did it never happen before? This template has been created about 20 months ago, we deployed more than 100 virtual machines with it and never ran into this problem. So I felt an urge to sort it out.
I've created a virtual machine based on the same template and tried to reproduce the whole sequence of operations I performed last time, but this time I restarted the OS after each step to understand what step was the trigger. At some point I had the following configuration in the
/etc/sysconfig/network-scripts/ifcfg-eth0 file:
Code: Select all
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_PEERDNS="no"
IPV6_PEERROUTES="no"
IPV6_FAILURE_FATAL="no"
NAME="eth0"
UUID="***0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR="***1.***2.***3.xxx4"
NETMASK="255.255.255.0"
GATEWAY="***1.***2.***3.***5"
At this point I restarted the OS and things were fine: I'd successfully logged in as root.
Then I added a line that became the trigger:
After this step I ran
reboot and then I wasn't able to log in as
root anymore!
Now I'm feeling puzzled: what exactly changed when I added that only line?
If anyone has ideas, please, do share.
Thanks!