61 lines
2.2 KiB
EmacsLisp
61 lines
2.2 KiB
EmacsLisp
;;; 10-ssh-service-lesson.el --- ssh-service-lesson
|
|
|
|
(defun ssh-service-lesson ()
|
|
"Hands-on Linux+ lesson for managing the SSH service with systemctl."
|
|
(interactive)
|
|
(delete-other-windows)
|
|
(let ((lesson-buffer (get-buffer-create "*SSH Service Lesson*"))
|
|
(shell (or shell-file-name (getenv "SHELL") "/bin/sh")))
|
|
(switch-to-buffer lesson-buffer)
|
|
(read-only-mode -1)
|
|
(erase-buffer)
|
|
(insert
|
|
"Linux+ Lesson: SSH Service Management\n"
|
|
"====================================\n\n"
|
|
"Concept:\n"
|
|
"Learn the difference between starting/stopping a service now and\n"
|
|
"enabling/disabling it for boot.\n\n"
|
|
"VM requirement:\n"
|
|
"- Use a systemd-based Linux VM.\n"
|
|
"- Debian/Ubuntu usually use service name: ssh\n"
|
|
"- Fedora/Rocky/Alma/RHEL usually use service name: sshd\n\n"
|
|
"In the terminal below, determine whether your VM uses ssh or sshd:\n"
|
|
" systemctl status ssh\n"
|
|
" systemctl status sshd\n\n"
|
|
"Use the correct service name for the rest of the lesson.\n\n"
|
|
"Hands-on tasks:\n"
|
|
"A. Check status:\n"
|
|
" sudo systemctl status <service>\n\n"
|
|
"B. Stop the service:\n"
|
|
" sudo systemctl stop <service>\n"
|
|
" Then check status again.\n\n"
|
|
"C. Start the service:\n"
|
|
" sudo systemctl start <service>\n"
|
|
" Then check status again.\n\n"
|
|
"D. Disable the service:\n"
|
|
" sudo systemctl disable <service>\n\n"
|
|
"E. Re-enable the service:\n"
|
|
" sudo systemctl enable <service>\n\n"
|
|
"What to notice:\n"
|
|
"- start = runs now\n"
|
|
"- stop = stops now\n"
|
|
"- enable = starts at boot\n"
|
|
"- disable = does not start at boot\n\n"
|
|
"Important Linux+ trap:\n"
|
|
"A service can be enabled but not currently running.\n"
|
|
"If so, use:\n"
|
|
" systemctl start <service>\n\n"
|
|
"When you finish the hands-on portion, run:\n"
|
|
" M-x ssh-service-quiz\n")
|
|
(goto-char (point-min))
|
|
(view-mode 1)
|
|
(split-window-below)
|
|
(other-window 1)
|
|
(let ((term-buffer (get-buffer "*term*")))
|
|
(if (buffer-live-p term-buffer)
|
|
(switch-to-buffer term-buffer)
|
|
(ansi-term shell "term")))
|
|
(other-window -1)))
|
|
|
|
;;; 10-ssh-service-lesson.el ends here
|