1.4 KiB
1.4 KiB
Using Linux Terminal 3.2: System-wide and per-user security settings
A process limit for one user, a message for every login shell, and a stricter umask for one user.
Before you start
The lab creates users alice and student (password Lab-Pass-1).
Work as root (sudo -i) for tasks 1 and 2, and as student (sudo -iu student) for task 3. The lab saves /etc/profile, /etc/bash.bashrc and
the limits files, and puts them back on reset; it also removes the files
you add to /etc/profile.d and /etc/security/limits.d.
Tasks
- Limit the user
aliceto 50 processes, as both soft and hard limit, in a file of its own.su - alice -c 'ulimit -u; ulimit -Hu'prints50twice, and other users' limits are unchanged. - Make every login shell print
Authorized use onlybefore the prompt, without editing/etc/profile.su - alice -c trueprints the message. - Give
studenta umask of 077 in every interactive shell: in a new shell,umaskprints0077, andtouch ~/x; ls -l ~/xshows-rw-------. Other users keep their umask.
Hints
- A file in
/etc/security/limits.d/withalice,-(or asoftand ahardline),nprocand50. Limits apply at the next login. - A
.shfile in/etc/profile.d/with anecho. ~/.bashrcruns in every interactive bash (and Ubuntu's~/.profileruns it for login shells);bashstarts a new one to test.