Objective: Configure persistent Linux resource limits for the existing user james, ensuring that:
The hard process limit is 32768.
The soft process limit is 16384.
The limits are applied when the user starts a new PAM-managed login session.
The configuration remains available after a system reboot.
The appropriate solution uses Linux-PAM's resource-limit configuration, typically in /etc/security/limits.d/.
The official Linux-PAM documentation specifies the configuration syntax and confirms that nproc is the resource identifier for process limits.
Step 1: Connect to the correct Linux server.
The video specifies host lfcs00089.
From the candidate terminal, execute:
ssh lfcs00089
This establishes an SSH session with the designated server.
All subsequent configuration changes must be performed on this host.
Step 2: Verify that the user james exists.
Execute:
id james
This displays the user's UID, primary group and supplementary group memberships.
Example output:
uid=1001(james) gid=1001(james) groups=1001(james)
The numeric identifiers may differ on the actual server.
You can also check the account database:
getent passwd james
The task specifies an existing user, so there is no need to create a new account or modify the user's password.
Step 3: Understand soft and hard process limits.
Linux implements process-related resource restrictions using RLIMIT_NPROC.
Limit
Required value
Purpose
Soft
16384
Default process/thread creation limit enforced for the user's processes
Hard
32768
Maximum value to which an unprivileged user may raise the soft limit
The hard limit must be at least as large as the soft limit. Here:
\[ 16384 \leq 32768 \]
Therefore, the requested configuration is valid.
On Linux, RLIMIT_NPROC actually accounts for processes and threads associated with the real user ID, subject to kernel privilege exceptions. It is not a separate allowance for every running application.
Step 4: Inspect any existing persistent limits.
Before changing the system, execute:
sudo cat /etc/security/limits.conf
Then list any existing supplemental configuration files:
sudo ls -la /etc/security/limits.d/
Search specifically for process-limit settings:
sudo grep -RnsE \
'^[[:space:]]*([^#[:space:]] +[[:space:]]+)+(soft|hard|-)[[:space:]] +nproc' \
/etc/security/limits.conf /etc/security/limits.d/ 2 > /dev/null
Also check for any existing entries concerning james:
sudo grep -RnsE '^[[:space:]]*james[[:space:]] ' \
/etc/security/limits.conf /etc/security/limits.d/ 2 > /dev/null
These checks help identify existing user-specific limits and avoid contradictory configuration entries.
Step 5: Understand the persistent configuration locations.
The primary resource-limit configuration file is:
/etc/security/limits.conf
Additional administrator-defined limits can be stored under:
/etc/security/limits.d/
Both locations are supported by Linux-PAM.
The configuration format is:
< domain > < type > < item > < value >
For this task:
Field
Required value
Description
Domain
james
Existing username
Type
soft or hard
Which resource limit to configure
Item
nproc
Number of processes/threads
Value
16384 or 32768
Required limit
A dedicated configuration file is preferable because it keeps the account-specific policy separate from the system's general resource-limit settings.
Step 6: Create the persistent configuration file.
Execute:
sudo nano /etc/security/limits.d/90-james-nproc.conf
This opens a new configuration file.
If the file already exists, inspect its contents before modifying it.
Step 7: Add the required soft and hard process limits.
Insert the following two lines:
james soft nproc 16384
james hard nproc 32768
This is the exact configuration required for the task.
Explanation of the first line:
james soft nproc 16384
james selects the target user.
soft specifies the default soft resource limit.
nproc refers to the process/thread limit.
16384 establishes the required soft value.
Explanation of the second line:
james hard nproc 32768
james selects the same user.
hard specifies the hard resource limit.
nproc identifies the resource.
32768 establishes the maximum hard value.
These settings apply specifically to james rather than all users.
The Linux-PAM manual explicitly supports user-specific soft and hard nproc entries.
Step 8: Save the configuration.
If using Nano:
If using Vim:
Press Esc.
Type :wq.
Press Enter.
The file should be located at:
/etc/security/limits.d/90-james-nproc.conf
Step 9: Verify the saved configuration.
Execute:
sudo cat /etc/security/limits.d/90-james-nproc.conf
Expected output:
james soft nproc 16384
james hard nproc 32768
Check the file permissions:
ls -l /etc/security/limits.d/90-james-nproc.conf
A typical configuration file has permissions of 644 and is owned by root.
If the file permissions are incorrect, restore appropriate permissions:
sudo chmod 644 /etc/security/limits.d/90-james-nproc.conf
The file should be readable by the PAM module when login sessions are established.
Step 10: Verify that PAM applies resource limits.
The settings are interpreted by the PAM module:
pam_limits.so
Check whether the module is configured:
sudo grep -Rns 'pam_limits.so' /etc/pam.d/
A relevant configuration entry resembles:
session required pam_limits.so
session identifies the PAM session-management phase.
required means the module must succeed for the relevant PAM operation to succeed.
pam_limits.so applies the configured resource limits when the session is established.
The official Linux-PAM documentation confirms that this module applies resource limits to user sessions.
On Ubuntu, inspect the PAM configuration used by the relevant login method, including sshd, login, su, and any referenced common-session files.
Do not blindly add duplicate pam_limits.so entries. If the module is absent from the actual login path, configure it appropriately before testing.
Step 11: Understand when the changes take effect.
The limits defined in /etc/security/limits.d/90-james-nproc.conf are persistent settings, but they are not automatically applied to every currently running process.
Linux-PAM applies these limits when an applicable new login session begins.
Therefore:
Existing sessions may retain their previous limits.
New PAM-managed sessions can receive the new values.
Changes survive reboot because the configuration is stored on disk.
There is no need to restart the entire operating system simply to load the configuration.
The Linux-PAM manual specifically explains that configured resource limits are applied per login session.
Step 12: Start a fresh session as james.
If you have administrative access, you can attempt to create a new login session with:
sudo su - james
This starts a login-style shell using the su PAM service, provided that service is configured to apply PAM resource limits.
Alternatively, open a new SSH login as james, using the account's existing credentials if permitted:
ssh james@localhost
A fresh SSH login is particularly useful if the actual login service is the intended target of the configuration.
Check the active user:
whoami
Expected:
james
Do not assume that simply running sudo -u james ulimit ... is a valid test. ulimit is a shell builtin, and changing the execution user does not necessarily create a PAM session or apply its resource-limit policy.
Step 13: Verify the soft process limit.
Inside the new login session belonging to james, execute:
ulimit -Su
ulimit displays or controls process resource limits.
-S selects the soft limit.
-u selects the maximum process/thread resource limit.
Expected output:
16384
This confirms that the session received the required soft limit.
Step 14: Verify the hard process limit.
In the same session, execute:
ulimit -Hu
-H selects the hard limit.
-u selects the process/thread resource limit.
Expected output:
32768
The GNU Bash manual confirms that -S and -H distinguish soft and hard limits, and that -u refers to the maximum number of processes available to a user.
Step 15: Verify both limits together.
Execute:
printf 'Soft limit: '
ulimit -Su
printf 'Hard limit: '
ulimit -Hu
Expected output:
Soft limit: 16384
Hard limit: 32768
This is the most direct practical verification of the two requested values.
Step 16: Verify the kernel's process-limit information.
Linux also exposes resource limits through the /proc filesystem.
Inside the new james session, execute:
cat /proc/self/limits
Find the line:
Max processes
The relevant values should be:
Limit Soft Limit Hard Limit
Max processes 16384 32768
The displayed output contains additional columns and other resource limits, but the Max processes entry is the one relevant to this task.
For a more concise check, execute:
grep 'Max processes' /proc/self/limits
Expected values:
Max processes 16384 32768
You can also use:
prlimit --pid $$
This displays resource limits for the current shell process.
Step 17: Check for conflicting limits if the values are incorrect.
If the new session does not show the required values, investigate rather than repeatedly adding duplicate configuration entries.
First, inspect user-specific rules:
sudo grep -Rns 'james' \
/etc/security/limits.conf /etc/security/limits.d/
Next, inspect all process-limit rules:
sudo grep -Rns 'nproc' \
/etc/security/limits.conf /etc/security/limits.d/
Then check whether pam_limits.so is active in the login method used for testing.
Potential reasons for an unexpected value include an overriding limits configuration, a session started without PAM resource-limit processing, or resource limits imposed by a systemd-managed service.
If the user runs an application under a systemd service, systemd's LimitNPROC= setting may also be relevant. However, configuring a systemd service is not required by the task.
Step 18: Verify persistence.
The persistent configuration resides at:
/etc/security/limits.d/90-james-nproc.conf
Execute:
sudo cat /etc/security/limits.d/90-james-nproc.conf
Expected:
james soft nproc 16384
james hard nproc 32768
Because this configuration is stored under /etc, it remains present after the system reboots unless it is changed or removed.
For end-to-end verification, start a fresh login session after reboot and repeat:
ulimit -Su
ulimit -Hu
Expected:
16384
32768
A reboot is not necessary for normal verification, and should not be performed unnecessarily during the LFCS exam.
Step 19: Confirm that unrelated users remain unchanged.
The file contains rules for:
james
It does not use the wildcard:
*
Therefore, this particular configuration does not apply indiscriminately to all users.
Avoid adding entries such as:
* soft nproc 16384
* hard nproc 32768
Those would impose the specified limits more broadly, instead of targeting the user named in the task.
Step 20: Perform final verification.
The final configuration must satisfy all requirements:
Requirement
Expected result
Existing user
james
Resource type
nproc
Soft limit
16384
Hard limit
32768
Persistent configuration
Present
Fresh login session
Correct limits applied
Other users
No unnecessary changes
Final Solution
The essential commands are:
Copy commands
# Connect to the correct server
ssh lfcs00089
# Verify the user exists
id james
# Create the persistent resource-limit configuration
printf '%s\n' \
'james soft nproc 16384' \
'james hard nproc 32768' | \
sudo tee /etc/security/limits.d/90-james-nproc.conf
# Verify the configuration
sudo cat /etc/security/limits.d/90-james-nproc.conf
# Confirm PAM resource-limit integration
sudo grep -Rns 'pam_limits.so' /etc/pam.d/
# Start a new PAM-managed login session
# (provided the su PAM stack applies pam_limits)
sudo su - james
# Verify the soft limit
ulimit -Su
# Verify the hard limit
ulimit -Hu
# Verify through procfs
grep 'Max processes' /proc/self/limits
The required configuration is:
james soft nproc 16384
james hard nproc 32768
Technical Verification and References
Linux-PAM limits.conf(5) — Confirms the configuration file syntax and nproc resource identifier.
Linux-PAM pam_limits(8) — Explains how limits are applied when PAM sessions are established.
GNU Bash — ulimit — Documents soft and hard resource-limit verification.
Linux getrlimit(2) — Defines the kernel's process-limit behavior.
Video verification finding: At approximately 29:01–29:05, Question 9 appears with host lfcs00089. The recording shows the full task statement but does not demonstrate the required configuration being completed. The solution above is independently validated against Linux-PAM documentation.
Expected result: User james receives a soft process limit of 16384 and a hard process limit of 32768 in applicable new login sessions. The settings are stored persistently and remain configured after reboot.