Solved error in service module, after etc/security/limits.conf delete

Solved issue

solidsnake

Member
Joined
Oct 6, 2021
Messages
44
Reaction score
2
Credits
592
hostname login :


The /etc/security/limits.conf file was under the repos.d directory and I deleted it. Then I realized that my server was down.

When I want to log in I get error in service modeule error.

I can't run a command because I can't log in with my root user. How can I fix the problem?

Can I start with iso and say fix problem?
 


İşletim sisteminiz bir USB bellekteyse - bu belleğe önyükleme yapın, ardından dosyayı USB belleğinizden kopyalayın ve gitmesi gereken yere yerleştirin - bunu USB belleğinizden yapmak için büyük ihtimalle root olmanız gerekecektir
I couldn't do what you said

I cannot open the configuration file with vi

I tried to change the content with sed command but it didn't work


sh-4.2# pwd
/etc/selinux

sh-4.2# ls
config targeted tmp
 
I couldn't do what you said

I cannot open the configuration file with vi

I tried to change the content with sed command but it didn't work


sh-4.2# pwd
/etc/selinux

sh-4.2# ls
config targeted tmp
You do not need to open the configuration file simply copy and paste - you need to be root - depending on your distro navigate to where the file is on you USB drive then open that as root - generally right click and Open Root Here then copy that file and paste it onto your HD where the file is corrupt - or this is mine just copy and paste it into your text editor and save as limits.conf and replace your corrupted version - you may have to manipulate from here to suit your purposes

# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#
#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means, for example, that setting a limit for wildcard domain here
#can be overridden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overridden only
#with a user specific setting in the subdirectory.
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - a user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
# - NOTE: group and wildcard limits are not applied to root.
# To apply a limit to the root user, <domain> must be
# the literal username root.
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open file descriptors
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-20, 19]
# - rtprio - max realtime priority
# - chroot - change root to directory (Debian-specific)
#
#<domain> <type> <item> <value>
#

#* soft core 0
#root hard core 100000
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#ftp - chroot /ftp
#@student - maxlogins 4

# End of file
 
I just looked in my /etc/security/limits.conf and everything was commented out. You can boot from an installation disc and mount the root file system rw and put the file back.

/etc/security/limits.conf
Code:
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - a user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#        - NOTE: group and wildcard limits are not applied to root.
#          To apply a limit to the root user, <domain> must be
#          the literal username root.
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open file descriptors
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#        - chroot - change root to directory (Debian-specific)
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#root            hard    core            100000
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#ftp             -       chroot          /ftp
#@student        -       maxlogins       4

# End of file

Signed,

Matthew Campbell
 
Az önce /etc/security/limits.conf dosyama baktım ve her şey yorum satırına alınmış. Bir kurulum diskinden önyükleme yapabilir ve kök dosya sistemi rw'yi bağlayıp dosyayı geri koyabilirsiniz.

/etc/güvenlik/limits.conf
[kod]
# /etc/security/limits.conf
#
#Her satır, kullanıcı için bir limiti şu şekilde tanımlar:
#
#<alan> <tür> <öğe> <değer>
#
#Nerede:
#<domain> şunlar olabilir:
# - bir kullanıcı adı
# - @group sözdizimine sahip bir grup adı
# - varsayılan giriş için joker karakter *
# - joker karakter %, %group sözdizimiyle de kullanılabilir,
# maxlogin limiti için
# - NOT: Grup ve joker karakter sınırlamaları kök kullanıcıya uygulanmaz.
# Kök kullanıcıya bir sınır uygulamak için <etki alanı> olmalıdır
# gerçek kullanıcı adı kökü.
#
#<type> iki değere sahip olabilir:
# - Yumuşak sınırları zorlamak için "yumuşak"
# - "sert", katı sınırların uygulanması için
#
#<item> aşağıdakilerden biri olabilir:
# - core - çekirdek dosya boyutunu (KB) sınırlar
# - veri - maksimum veri boyutu (KB)
# - fsize - maksimum dosya boyutu (KB)
# - memlock - maksimum kilitli bellek adres alanı (KB)
# - nofile - açık dosya tanımlayıcılarının maksimum sayısı
# - rss - maksimum yerleşik set boyutu (KB)
# - yığın - maksimum yığın boyutu (KB)
# - cpu - maksimum CPU süresi (MIN)
# - nproc - maksimum işlem sayısı
# - olarak - adres alanı sınırı (KB)
# - maxlogins - bu kullanıcı için maksimum oturum açma sayısı
# - maxsyslogins - sistemdeki maksimum oturum açma sayısı
# - öncelik - kullanıcı sürecini çalıştırmanın önceliği
# - kilitler - kullanıcının tutabileceği maksimum dosya kilidi sayısı
# - sigpending - bekleyen sinyallerin maksimum sayısı
# - msgqueue - POSIX mesaj kuyrukları tarafından kullanılan maksimum bellek (bayt)
# - nice - izin verilen en fazla nice önceliği şu değerlere yükseltilebilir: [-20, 19]
# - rtprio - maksimum gerçek zamanlı öncelik
# - chroot - kökü dizine değiştir (Debian'a özgü)
#
#<alan> <tür> <öğe> <değer>
#

#* yumuşak çekirdek 0
#root hard core 100000
#* zor rss 10000
#@öğrenci zor nproc 20
#@faculty yumuşak nproc 20
#@faculty zor nproc 50
#ftp zor nproc 0
#ftp - chroot /ftp
#@öğrenci - maxlogins 4

# Dosyanın sonu
[/kod]

İmzalandı,

Matthew Campbell
I tried this, I opened it from an iso file but I cannot make changes on the server.

How should I open it with iso?
 
I tried this, I opened it from an iso file but I cannot make changes on the server.

How should I open it with iso?
Boot the server using a separate boot disc. Log in to the server as root. Mount the server's root partition as rw and copy the file limits.conf to /etc/security/. sync and umount the server's root partition. Run e2fsck -fv on the server's root partition. sync and reboot the server. The installation iso generally offers you the chance to exec a shell. It might not have e2fsck though. It's a really good idea to have an alternate way to boot your Linux computer.

Signed,

Matthew Campbell
 
Boot the server using a separate boot disc. Log in to the server as root. Mount the server's root partition as rw and copy the file limits.conf to /etc/security/. sync and umount the server's root partition. Run e2fsck -fv on the server's root partition. sync and reboot the server. The installation iso generally offers you the chance to exec a shell. It might not have e2fsck though. It's a really good idea to have an alternate way to boot your Linux computer.

Signed,

Matthew Campbell
I solved the problem as you said.
The mistake I made was not mounting the / directory of the server.
Using iso solved the problem. Thank you
 
I solved the problem as you said.
The mistake I made was not mounting the / directory of the server.
Using iso solved the problem. Thank you
Welcome. Glad I could be helpful.

Signed,

Matthew Campbell
 

Members online


Top