LPIC-1 110.2: Setting up host security
Turning off a service nobody needs, /etc/nologin, and the nologin
shell.
Before you start
The lab runs a service nobody needs, legacy-echo, which listens on TCP
port 7007. It creates users tess and testuser (password Lab-Pass-1);
tess can log in over SSH with the key /root/lab-keys/tess
(ssh -i /root/lab-keys/tess tess@localhost). Keep a root session open
while you do task 2.
Tasks
- List every listening service with
ss -tulpn, and turn offlegacy-echowithsystemctl disable --now. Check it's gone, then mask it and try to start it. - Create
/etc/nologinwith a message, and try to log in astessover SSH (and on the console, if you have one). Then remove/etc/nologinfrom the session you kept open. - Give
testuserthe shell/usr/sbin/nologinand trysu - testuser.
Hints
ss -tulpn | grep 7007;systemctl status legacy-echo;systemctl mask,systemctl start.echo "Down for maintenance" > /etc/nologin; root can still log in.journalctl --since -10minshows the refused login.usermod -s,getent passwd testuser.