Curated

Services and User Management

0 votes

Questions133

  1. Question 1

    Services and User Management

    During an audit, an administrator must report when the permissions on /etc/app.conf were last changed. Which timestamp in the stat output answers this?

    Show the answer

    Correct answerC. Change

    Change (ctime) updates whenever inode metadata such as permissions or ownership changes. Modify is tempting, but it updates only when the file's contents are written, so a chmod does not alter it.

    Open this question
  2. Question 2

    Services and User Management

    An administrator logged in as root must back up /etc/app to /backup/app. The copy must include all subdirectories and keep the original ownership, permissions and timestamps. Which command does this?

    Show the answer

    Correct answerC. cp -a /etc/app /backup/app

    cp -a is archive mode: it recurses and preserves ownership, mode, timestamps and links. cp -r also recurses, but the new files are owned by the invoking user (root here) and get new timestamps, so original ownership is lost.

    Open this question
  3. Question 3

    Services and User Management

    An administrator runs umount /mnt/data and receives "target is busy". Which command lists the processes that have files open on that filesystem?

    Show the answer

    Correct answerA. lsof /mnt/data

    Giving lsof a mount point lists every open file on that filesystem and the processes holding them. lsof -i is tempting, but it selects network connections by address, not by filesystem path.

    Open this question
  4. Question 4

    Services and User Management

    A user creates /srv/reports/q3.csv and immediately runs locate q3.csv, which returns nothing. Running find /srv -name q3.csv lists the file. What explains the difference?

    Show the answer

    Correct answerB. locate searches a database built by updatedb, which has not yet indexed the new file

    AWhy not this: locate matches substrings of the full path by default, and q3.csv would match; the name is not the problem.

    BWhy this is right: Locate reads the index that updatedb builds, so a file created after the last update is missing until updatedb runs again.

    CWhy not this: locate searches its whole database, which covers the filesystem, not just the home directory.

    DWhy not this: find uses no database; it walks the directory tree each time it runs, which is why it sees the new file.

    locate queries a prebuilt index that is usually refreshed on a schedule, so new files can be missing until updatedb runs. find walks the directory tree at run time, so it sees current files. Treating locate as real-time is the common misconception.

    Open this question
  5. Question 5

    Services and User Management

    A developer asks for a file that records the changes from app.conf.orig to app.conf, with context lines, so the changes can be applied elsewhere with patch. Which command should the administrator run?

    Show the answer

    Correct answerC. diff -u app.conf.orig app.conf > app.patch

    diff -u produces unified output with context lines, which patch can apply. sdiff is tempting because it also shows differences, but its side-by-side columns are meant for reading and patch cannot use them.

    Open this question
  6. Question 6

    Services and User Management

    A technician runs 'ls -li' in a directory and sees two entries: '1048593 -rw-r--r-- 2 root root 120 Jan 5 10:00 hosts.conf' and '1048593 -rw-r--r-- 2 root root 120 Jan 5 10:00 hosts.bak'. Which conclusion is correct?

    Show the answer

    Correct answerD. hosts.conf and hosts.bak are hard links to the same inode.

    Identical inode numbers and a link count of 2 show two names for one file, which is a hard link. A symbolic link would show 'l' in the mode and its own inode. Removing one name only lowers the link count, so the data stays reachable.

    Open this question
  7. Question 7

    Services and User Management

    An administrator runs 'ln /srv/app/config.yml /srv/app/config.hard' and 'ln -s /srv/app/config.yml /srv/app/config.sym'. The administrator then deletes /srv/app/config.yml with rm. What is the result?

    Show the answer

    Correct answerB. config.hard still opens the data, but config.sym becomes a dangling link.

    A hard link is another name for the same inode, so the data persists until the last name is removed. A symbolic link stores only a path, so it dangles once the original is deleted. The same-inode idea applies only to the hard link.

    Open this question
  8. Question 8

    Services and User Management

    An administrator runs 'ln /mnt/data/notes.txt /home/user/notes.txt' and receives 'Invalid cross-device link'. /mnt/data and /home are on separate filesystems. Which action creates a working link?

    Show the answer

    Correct answerC. Use ln -s, because a symbolic link can point across filesystems.

    A hard link must reside on the same filesystem as its target because inode numbers are unique only per filesystem. A symbolic link stores a path, so it can cross filesystems. The -f option only replaces existing destinations and cannot override this limit.

    Open this question
  9. Question 9

    Services and User Management

    An administrator needs a source of endless zero bytes to create a 100 MB file with dd. They run ls -l /dev/zero and see a line beginning with 'crw-rw-rw-'. What does this output indicate about /dev/zero?

    Show the answer

    Correct answerA. It is a character special file that provides data as a stream of bytes

    The leading 'c' marks a character special file, which delivers data as a byte stream; /dev/zero is a pseudo-device of this type. A block device would start with 'b', and a named pipe would start with 'p', so neither matches this output.

    Open this question
  10. Question 10

    Services and User Management

    A Linux administrator runs ls -l /dev/sda /dev/tty0 on a server and wants to confirm which one is a block device. The output shows the first character of each line's permission string as 'b' for one entry and 'c' for the other. Which statement correctly interprets the output?

    Show the answer

    Correct answerA. /dev/sda is a block device shown with 'b', and /dev/tty0 is a character device shown with 'c'

    A disk such as /dev/sda is accessed in fixed-size blocks, so ls -l marks it 'b', while a terminal such as /dev/tty0 transfers a stream of characters and is marked 'c'. The reversed reading is tempting but wrong because disks are never character-stream devices in this listing.

    Open this question
  11. Question 11

    Services and User Management

    On an Ubuntu server, an administrator wants to create the account tsmith with one command that creates the home directory by default, copies skeleton files, and interactively prompts for a password and contact details. Which command should be used?

    Show the answer

    Correct answerB. adduser tsmith

    On Debian-based systems, adduser is a friendly front end that applies /etc/adduser.conf defaults, creates the home directory, and prompts for a password and details. Plain useradd is tempting but is non-interactive and does not create a home directory unless -m is given.

    Open this question
  12. Question 12

    Services and User Management

    A junior developer named mchen joins a team. On a RHEL-based server, the administrator must create the account with a home directory, /bin/bash as the login shell, and developers as a supplementary group. The user's primary group must remain the default private group. Which command meets these requirements?

    Show the answer

    Correct answerA. useradd -m -s /bin/bash -G developers mchen

    -m creates the home directory, -s sets the shell, and -G adds supplementary groups while the default private primary group is kept. A lowercase -g would make developers the primary group, which breaks the requirement. -a is a usermod option, so useradd rejects it.

    Open this question
  13. Question 13

    Services and User Management

    An administrator is preparing a service account for a backup daemon. The account needs a dedicated system group and must not allow interactive logins. Which three statements about creating them are correct? (Choose three.)

    Choose 3 answers

    Show the answer

    Correct answersA. useradd -r does not create a home directory unless -m is also suppliedB. useradd -r -g backupsvc -s /usr/sbin/nologin backupd creates a system account that cannot log in interactivelyC. groupadd -r backupsvc creates a group whose GID is taken from the system range

    AWhy this is right: System accounts created with -r get no home directory unless -m is also given.

    BWhy this is right: -r makes a system account, -g sets the group, and a nologin shell blocks interactive logins.

    CWhy this is right: Groupadd -r takes the GID from the system range set in /etc/login.defs.

    DWhy not this: useradd never prompts for a password; the account's password is set afterward with passwd.

    EWhy not this: -r uses the SYS_UID_MIN to SYS_UID_MAX range; UID_MIN to UID_MAX is for regular users.

    The -r option creates system groups and accounts with IDs from the system range, and a nologin shell blocks interactive sessions. System accounts get no home directory unless -m is given. useradd never prompts for a password; one is set afterward with passwd. System IDs come from SYS_UID_MIN to SYS_UID_MAX, not UID_MIN to UID_MAX.

    Open this question
  14. Question 14

    Services and User Management

    Several accounts were removed with userdel and without the -r option. An administrator now wants to list files on the root filesystem that are still owned by UIDs no longer present in /etc/passwd. Which command does this?

    Show the answer

    Correct answerA. find / -xdev -nouser

    find -nouser matches files whose owner UID has no matching user, which is what remains after userdel without -r. The -nogroup test checks group ownership, so it would miss files orphaned only by a deleted user.

    Open this question
  15. Question 15

    Services and User Management

    A contractor's last day was yesterday. On a RHEL server, an administrator must delete the account jsmith and also delete the user's home directory and mail spool in one command. Which command accomplishes this?

    Show the answer

    Correct answerB. userdel -r jsmith

    userdel -r removes the account entries along with the home directory and mail spool. Plain userdel removes only the account entries and leaves the home directory on disk, which is the tempting but incomplete choice.

    Open this question
  16. Question 16

    Services and User Management

    An administrator runs groupdel developers and receives the error "cannot remove the primary group of user 'amy'". The group is no longer needed, and amy should keep her account. Which action allows the group to be deleted?

    Show the answer

    Correct answerD. Run usermod -g staff amy, then rerun groupdel developers

    A group cannot be deleted while it is any user's primary group, so amy's primary group must be changed with usermod -g first. gpasswd -d only removes supplementary membership and does not change a primary group.

    Open this question
  17. Question 17

    Services and User Management

    The group devs owns thousands of project files and must be renamed engineering. Its GID must stay the same so file ownership is unchanged. Which command does this?

    Show the answer

    Correct answerA. groupmod -n engineering devs

    groupmod -n takes the new name followed by the existing group name, and it leaves the GID unchanged. Using -g 2000 changes the GID and would leave existing files owned by a numeric ID that no longer maps to the group. -g also expects a number, not a name.

    Open this question
  18. Question 18

    Services and User Management

    A user named alice is already a member of the supplementary groups developers and qa. An administrator must add her to the docker group without removing her from any existing group. Which command accomplishes this?

    Show the answer

    Correct answerC. usermod -aG docker alice

    usermod -aG appends the group to the user's supplementary groups. Without -a, -G replaces the whole supplementary list, so alice would lose developers and qa. Lowercase -g would change her primary group instead.

    Open this question
  19. Question 19

    Services and User Management

    A security policy requires the user bob to choose a new password at his next login. His account must stay unlocked and his current password must remain valid until then. Which command meets the requirement?

    Show the answer

    Correct answerC. passwd -e bob

    passwd -e expires the password immediately, which forces a change at the next login while the account stays usable. passwd -l locks the password so bob could not log in with it at all. -n 0 only sets the minimum password age.

    Open this question
  20. Question 20

    Services and User Management

    A user returns from extended leave and cannot log in. Running passwd -S alice shows a usable password (status P), not a locked one. An earlier ticket shows the account was disabled with chage -E 0 alice. Which command restores access without changing the password?

    Show the answer

    Correct answerD. chage -E -1 alice

    chage -E -1 removes the account expiration date, which re-enables the account. passwd -u and usermod -U only remove the '!' prefix from the password hash, and that lock is not present here, so the expiry still blocks the login. passwd -d would delete the password.

    Open this question
  21. Question 21

    Services and User Management

    A contractor's engagement has ended. The contractor logs in over SSH with a public key. An administrator must block every login method for the account right away, while keeping the home directory and the account itself. Which command meets this requirement?

    Show the answer

    Correct answerA. chage -E 0 contractor

    chage -E 0 sets the account expiration date to 1970-01-01, so the account is rejected for all authentication methods, including SSH keys. passwd -l and usermod -L only prefix the password hash with '!', which blocks password logins but usually still permits key-based SSH.

    Open this question
  22. Question 22

    Services and User Management

    An administrator needs to stop the user jsmith from authenticating with a password, without deleting the account. Which three commands accomplish this? (Choose three.)

    Choose 3 answers

    Show the answer

    Correct answersB. chage -E 0 jsmithC. usermod -L jsmithD. passwd -l jsmith

    passwd -l and usermod -L prepend '!' to the hash in /etc/shadow, and chage -E 0 sets the account expiration to a past date. passwd -u is the tempting wrong choice because it belongs to the same utility, but it removes the lock instead of applying one. passwd -S only reports status.

    Open this question
  23. Question 23

    Services and User Management

    Policy requires that if user jlee's password has been expired for 14 days without being changed, the account is locked. Which command configures this for jlee?

    Show the answer

    Correct answerC. chage -I 14 jlee

    The -I option sets the inactivity period, the number of days after password expiry before the account is locked. The -W option only sets how many days before expiry the user is warned, so it never locks the account.

    Open this question
  24. Question 24

    Services and User Management

    A contractor's account, contractor1, must stop working automatically after 2025-12-31, regardless of how recently the password was changed. Which command accomplishes this?

    Show the answer

    Correct answerD. chage -E 2025-12-31 contractor1

    The -E option sets the account expiration date, after which logins are refused regardless of password age. The -M option only caps password lifetime in days, so the account would remain usable after any password change.

    Open this question
  25. Question 25

    Services and User Management

    An administrator wants every newly created local user to receive a default maximum password age of 60 days. Which file should be edited to set PASS_MAX_DAYS to 60?

    Show the answer

    Correct answerB. /etc/login.defs

    PASS_MAX_DAYS in /etc/login.defs supplies the default maximum password age for accounts created afterward. /etc/default/useradd holds defaults such as INACTIVE and EXPIRE, not maximum password age, and /etc/shadow changes only existing accounts.

    Open this question
  26. Question 26

    Services and User Management

    A Linux server authenticates most users through SSSD against a central LDAP directory. An administrator must list every user account the system can resolve, including directory accounts that do not appear in the local /etc/passwd file. Which command should the administrator run?

    Show the answer

    Correct answerC. getent passwd

    getent passwd queries every source configured in nsswitch.conf, including local files, SSSD and LDAP, so it lists all resolvable accounts. Reading /etc/passwd directly is tempting but shows only local entries and misses directory users.

    Open this question
  27. Question 27

    Services and User Management

    During a security audit, an administrator must produce a report showing each account's most recent login, including accounts that have never logged in. Which command produces this report?

    Show the answer

    Correct answerC. lastlog

    lastlog reads the lastlog database and prints one line per account, marking accounts that have never logged in. last is tempting but reads the wtmp login history, so it lists only recorded sessions and omits accounts that never logged in.

    Open this question
  28. Question 28

    Services and User Management

    An administrator adds an alias line to /etc/skel/.bashrc. A newly created user, carol, has the alias in her ~/.bashrc, but an existing user, bob, does not. What explains this behavior?

    Show the answer

    Correct answerB. Skeleton files are copied only when a home directory is created, so existing homes are not updated

    Files in /etc/skel are copied once, when useradd -m creates the home directory, so existing users keep their current files. Restarting a service does not re-copy them, and /etc/profile is a separate login-time script that does not alter the skeleton.

    Open this question
  29. Question 29

    Services and User Management

    A systems administrator wants every account created from now on with useradd -m to start with a preconfigured ~/.vimrc file and an empty ~/projects directory. Where should the administrator place these items so they are copied into each new home directory?

    Show the answer

    Correct answerC. /etc/skel

    useradd -m copies the contents of /etc/skel, including files and subdirectories, into each new home directory. /etc/profile.d holds shell scripts that login shells source, so it is never copied into a home directory.

    Open this question
  30. Question 30

    Services and User Management

    An administrator finds this entry in /etc/shadow: contractor:$6$k2x$Qe8...:19900:1:60:7:14:20100: What does the value 14 in the seventh field mean?

    Show the answer

    Correct answerC. The account becomes inactive 14 days after the password expires.

    The seventh shadow field is the inactivity period: days after password expiry before the account is disabled. The warning period is the sixth field (7 here), and the minimum age is the fourth field (1). Failed-login lockouts are not set in /etc/shadow.

    Open this question
  31. Question 31

    Services and User Management

    An administrator reviews this line in /etc/passwd while auditing a new user: jdoe:x:1004:1004:Jane Doe,Room 4:/home/jdoe:/bin/bash Which three statements correctly interpret the line? (Choose three.)

    Choose 3 answers

    Show the answer

    Correct answersA. The x in the second field shows the password hash is stored in /etc/shadow.C. The primary group of the account has the GID 1004.D. The account's login shell is set to /bin/bash.

    AWhy this is right: An x in the password field means the hash is kept in /etc/shadow.

    BWhy not this: The fifth field is the GECOS comment with the full name and contact details; expiry is stored in /etc/shadow.

    CWhy this is right: The fourth field is the primary group's GID, here 1004.

    DWhy this is right: The seventh and last field is the login shell, here /bin/bash.

    EWhy not this: System accounts use UIDs below 1000 on most distributions; 1004 is in the regular-user range.

    The x is a placeholder for the hash kept in /etc/shadow, the fourth field is the primary GID, and the last field is the login shell. The fifth field is the GECOS comment (full name and contact details), not an expiration date, which is stored in /etc/shadow. UID 1004 is in the regular-user range, not the system range below 1000.

    Open this question
  32. Question 32

    Services and User Management

    A shared directory /srv/reports is owned by root:analysts. A compiled binary, /usr/local/bin/archive, is owned by root:analysts and has the setgid bit set (mode 2755). The user kim, whose primary group is staff, runs the binary, and it creates a file in /srv/reports. Which statement correctly describes the identifiers of the running process?

    Show the answer

    Correct answerD. The effective GID is analysts, while the real GID remains staff

    The setgid bit on a compiled executable makes the process's effective GID the file's group (analysts), which is used for permission checks, while the real GID still identifies the invoking user's primary group (staff). Treating both as changed confuses real and effective identifiers.

    Open this question
  33. Question 33

    Services and User Management

    A junior administrator logs in as the user dana (UID 1001) and runs the passwd command, which is owned by root and has the setuid bit set. While the command runs, the administrator inspects the process with ps -o ruid,euid,cmd. Which result should be displayed for the passwd process?

    Show the answer

    Correct answerA. Real UID 1001 and effective UID 0

    A setuid executable keeps the invoker's real UID (1001) while the effective UID becomes the file owner's UID (0), which is what grants the needed privilege. Both values staying 1001 would mean the setuid bit had no effect, and the real UID does not change to the owner's.

    Open this question
  34. Question 34

    Services and User Management

    During a security review, an administrator finds an entry in /etc/passwd named "maint" with UID 0 and a normal login shell. The account was created by a former employee. What does the UID tell the administrator about this account?

    Show the answer

    Correct answerB. It has full superuser privileges, because the kernel grants root rights based on UID 0

    The kernel checks UID, not account name, so any account with UID 0 has root privileges. The system-account idea is tempting because UIDs below 1000 are system accounts, but UID 0 is the exception: it is the superuser, not a restricted daemon account.

    Open this question
  35. Question 35

    Services and User Management

    An administrator is auditing a default RHEL 9 server and lists four accounts from /etc/passwd. Using the default UID ranges in /etc/login.defs, which account is a system account?

    Show the answer

    Correct answerD. batch01, with UID 998

    On RHEL 9 the default system account range is 201-999, so UID 998 is a system account. UID 1000 is tempting, but it is the default UID_MIN, the first regular user UID, so it is not a system account.

    Open this question
  36. Question 36

    Services and User Management

    A server shows dozens of worker processes with the same name. An administrator needs to see which parent process spawned them, with each PID displayed in a hierarchy. Which command BEST provides this?

    Show the answer

    Correct answerD. pstree -p

    pstree -p draws the parent-child hierarchy and shows the PID of each process. ps -e lists every process but as a flat list without the hierarchy, so the parent-child relationships are not visible at a glance.

    Open this question
  37. Question 37

    Services and User Management

    An administrator suspects that several batch jobs are intermittently saturating the CPU. She needs per-process CPU usage sampled every 2 seconds for 5 samples. Which command meets this requirement?

    Show the answer

    Correct answerB. pidstat 2 5

    pidstat reports CPU usage for each process at the chosen interval and count. mpstat uses the same interval syntax but reports per-processor statistics rather than per-process ones, so it cannot identify which job is responsible.

    Open this question
  38. Question 38

    Services and User Management

    A custom application exits immediately at startup with only the message "configuration error" and writes no log. The administrator suspects it cannot find a file it needs. Which command shows each file the application tries to open and whether the attempt failed?

    Show the answer

    Correct answerC. strace -e trace=openat /usr/local/bin/app

    strace -e trace=openat prints each file-open system call with its arguments and return value, including ENOENT failures. strace -c only prints a summary table of call counts and errors, so it does not reveal which path failed.

    Open this question
  39. Question 39

    Services and User Management

    After a package upgrade, an administrator wants to confirm whether the running process with PID 3180 is still executing the old, replaced binary. Which action BEST shows this?

    Show the answer

    Correct answerD. Run ls -l /proc/3180/exe and look for "(deleted)"

    /proc/3180/exe is a symlink to the executable the process was started from, and it is marked "(deleted)" if that file was replaced or removed. The status file shows state, UIDs and memory use, but not whether the binary on disk has changed.

    Open this question
  40. Question 40

    Services and User Management

    A web server with PID 2241 is intermittently slow. It forks worker processes. The administrator wants to attach to the running server, follow the workers it creates, and save the output to a file. Which three strace options accomplish this? (Choose three.)

    Choose 3 answers

    Show the answer

    Correct answersB. -f to follow child processes created by forkC. -p 2241 to attach to the running processE. -o /tmp/web.trace to write the output to a file

    -p attaches to an existing PID, -f follows forked children, and -o writes the trace to a file. -c is tempting but only produces a summary table of call counts, time and errors instead of logging each call.

    Open this question
  41. Question 41

    Services and User Management

    An administrator starts a long job over SSH with nohup ./backup.sh &, then closes the SSH session. The shell that launched the job exits, but the job keeps running. Later, the administrator runs ps -o pid,ppid,cmd -C backup.sh. Which PPID value is the job MOST likely to show?

    Show the answer

    Correct answerD. 1, the init process (systemd)

    When a parent exits, its surviving child is orphaned and reparented to init, which is PID 1 (systemd on current distributions). The PPID is not left pointing at the dead login shell, because that PID no longer exists as a parent.

    Open this question
  42. Question 42

    Services and User Management

    A process with PID 4821 is consuming excessive memory. Running ps -o pid,ppid,cmd -p 4821 reports a PPID of 3190. The administrator wants to see the command line of the process that started PID 4821. Which command does this?

    Show the answer

    Correct answerB. ps -o pid,cmd -p 3190

    The PPID is the PID of the parent, so querying PID 3190 shows the parent's command line. Querying --ppid 4821 or pgrep -P 4821 lists the children of 4821, which is the opposite direction.

    Open this question
  43. Question 43

    Services and User Management

    A monitoring alert reports a defunct process in state Z with PID 7712 and PPID 7700. Repeated kill -9 7712 commands have no effect, and the entry remains in the process table. Which action is MOST likely to remove it?

    Show the answer

    Correct answerB. Terminate the parent, PID 7700, so init adopts and reaps it

    A zombie has already exited and is only waiting for its parent (PPID 7700) to read its exit status. Ending the parent lets init adopt and reap it. Signalling the zombie fails because it is already dead and cannot act on signals.

    Open this question
  44. Question 44

    Services and User Management

    An administrator reviews the STAT column in the output of ps aux while troubleshooting a busy server. Which two pairings of state code and meaning are correct? (Choose two.)

    Choose 2 answers

    Show the answer

    Correct answersA. D: uninterruptible sleep, usually waiting on disk or other I/OB. Z: terminated, waiting for its parent to collect its exit status

    D is uninterruptible sleep, typically during I/O, and Z is a zombie that has exited but has not yet been reaped by its parent. S is interruptible sleep, not stopped, and T is the stopped state, so those two pairings are swapped.

    Open this question
  45. Question 45

    Services and User Management

    A monitoring check reports several processes marked <defunct> with state Z in ps output. The administrator runs kill -9 against each PID, but the entries remain in the process table. What is the most likely reason?

    Show the answer

    Correct answerB. The processes have already terminated and the parent has not read their exit status

    A zombie has already exited, so there is nothing left to kill. Only its process table entry remains until the parent calls wait(); signal the parent or restart it. The uninterruptible I/O option describes state D, which is a different state.

    Open this question
  46. Question 46

    Services and User Management

    A technician presses Ctrl+Z while a long backup script runs in the foreground. The shell reports the job as suspended. Which process state will ps most likely show for the script, and why?

    Show the answer

    Correct answerC. T, because SIGTSTP suspended it until it receives SIGCONT

    Ctrl+Z sends SIGTSTP, which puts the process in the stopped state (T) until fg, bg or SIGCONT resumes it. Sleeping (S) is tempting because the script is not using CPU, but a sleeping process is waiting for an event, not suspended by a signal.

    Open this question
  47. Question 47

    Services and User Management

    A CPU-heavy report job with PID 4821 is slowing a production server. The administrator wants it to keep running but yield CPU time to other processes. Which command does this?

    Show the answer

    Correct answerA. renice -n 10 -p 4821

    renice changes the nice value of a running process, and a higher value means lower priority. A negative value would raise the priority and make the problem worse. nice only starts new commands and has no -p option.

    Open this question
  48. Question 48

    Services and User Management

    Logged in as root, an administrator must start /opt/report.sh with a nice value of -5 so it gets preferential CPU scheduling. Which command does this?

    Show the answer

    Correct answerD. nice -n -5 /opt/report.sh

    nice -n -5 applies an adjustment of -5 to the default value of 0, which gives higher priority. The legacy nice -5 form means an increment of +5, so it lowers priority. renice expects a PID, not a script path.

    Open this question
  49. Question 49

    Services and User Management

    An unprivileged user owns a process that runs at nice value 5. By default, which change can the user make with renice without root privileges?

    Show the answer

    Correct answerC. Raise the process's nice value to 10

    AWhy not this: Lowering the nice value raises the process's priority, which needs root or CAP_SYS_NICE by default.

    BWhy not this: Negative nice values give higher priority and need root or CAP_SYS_NICE.

    CWhy this is right: An owner may raise the nice value of their own process, lowering its priority.

    DWhy not this: Unprivileged users can renice only processes they own.

    Raising a nice value lowers a process's priority, so a user may do this to their own processes. Lowering it gives the process more CPU preference and requires root or CAP_SYS_NICE, so the claim that any owner can lower it is wrong.

    Open this question
  50. Question 50

    Services and User Management

    A running process with PID 4312 keeps hitting its open-file limit. Which command raises that limit for the process without restarting it?

    Show the answer

    Correct answerC. prlimit --pid 4312 --nofile=8192:8192

    AWhy not this: ulimit changes limits only for the current shell and the processes it starts later, not PID 4312.

    BWhy not this: fs.file-max is a system-wide total of open files, not the per-process limit that is being hit.

    CWhy this is right: Prlimit --pid changes the soft and hard nofile limits of the running process.

    DWhy not this: limits.conf is applied by PAM at the next login session, so the running process is not changed.

    prlimit --pid <PID> can display and modify limits such as nofile or nproc for a running process, within the hard limit unless run as root. ulimit is the tempting alternative, but it only affects the current shell and the processes it starts later.

    Open this question