Only update limits when needed
This commit is contained in:
parent
7e24becb9c
commit
c1650ae415
|
@ -473,14 +473,18 @@ function limit_user_logins {
|
|||
if ! grep -q '* hard maxsyslogins' /etc/security/limits.conf; then
|
||||
echo '* hard maxsyslogins 10' >> /etc/security/limits.conf
|
||||
else
|
||||
sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' /etc/security/limits.conf
|
||||
if ! grep -q '* hard maxsyslogins 10' /etc/security/limits.conf; then
|
||||
sed -i 's|hard maxsyslogins.*|hard maxsyslogins 10|g' /etc/security/limits.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# Max logins for each user
|
||||
if ! grep -q '* hard maxlogins' /etc/security/limits.conf; then
|
||||
echo '* hard maxlogins 2' >> /etc/security/limits.conf
|
||||
else
|
||||
sed -i 's|hard maxlogins.*|hard maxlogins 2|g' /etc/security/limits.conf
|
||||
if ! grep -q '* hard maxlogins 2' /etc/security/limits.conf; then
|
||||
sed -i 's|hard maxlogins.*|hard maxlogins 2|g' /etc/security/limits.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -609,10 +613,12 @@ function lockdown_permissions {
|
|||
}
|
||||
|
||||
function disable_core_dumps {
|
||||
if ! grep -q '* hard core 0' /etc/security/limits.conf; then
|
||||
if ! grep -q '* hard core' /etc/security/limits.conf; then
|
||||
echo '* hard core 0' >> /etc/security/limits.conf
|
||||
else
|
||||
sed -i 's|hard core.*|hard core 0|g' /etc/security/limits.conf
|
||||
if ! grep -q '* hard core 0' /etc/security/limits.conf; then
|
||||
sed -i 's|hard core.*|hard core 0|g' /etc/security/limits.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue