Files
linuxplus/102-user-management-lesson.el
2026-06-16 11:10:28 -04:00

145 lines
2.4 KiB
EmacsLisp

(defun linuxplus-user-management-lesson ()
"CompTIA Linux+ lesson: user management with lesson window and ansi-term."
(interactive)
(let ((lesson-buffer (get-buffer-create "*Linux+ User Management Lesson*"))
(term-buffer-name "*Linux+ Terminal*")
(shell-program (or shell-file-name "/bin/bash")))
;; Prepare lesson buffer
(switch-to-buffer lesson-buffer)
(read-only-mode -1)
(erase-buffer)
(insert
"Linux+ XK0-005 Lesson: User and Group Management
Study objectives:
- Linux account files
- User defaults
- Group management
- Account troubleshooting
==================================================
/etc/passwd
==================================================
Stores:
- username
- UID
- primary GID
- home directory
- shell
Does NOT store:
- password hashes
- password aging
==================================================
/etc/shadow
==================================================
Stores:
- password hashes
- expiration
- password aging
Commands:
sudo chage -l $USER
==================================================
/etc/group
==================================================
Stores group information.
Commands:
groups $USER
id $USER
==================================================
User defaults
==================================================
Files:
/etc/default/useradd
/etc/login.defs
Try:
cat /etc/default/useradd
grep UID /etc/login.defs
==================================================
usermod exam trap
==================================================
SAFE:
sudo usermod -aG GROUP USER
DANGEROUS:
sudo usermod -G GROUP USER
Without -a:
Existing supplementary groups are replaced.
==================================================
Rename groups
==================================================
Syntax:
groupmod -n NEW OLD
Example:
sudo groupmod -n Development WIP
==================================================
When finished:
M-x linuxplus-user-management-quiz
")
(goto-char (point-min))
;; Create the study layout
(delete-other-windows)
;; Top = lesson
;; Bottom = terminal
(split-window-below)
(other-window 1)
;; Reuse terminal if already created
(if (get-buffer term-buffer-name)
(switch-to-buffer term-buffer-name)
(ansi-term shell-program term-buffer-name))
;; Put cursor back in lesson
(other-window -1)))