Setting Up Security for Exams on Linux
1. Limit Access to Shared Folder and Restrict Write Permissions During Exams
a. Create a shared folder
sudo mkdir /home/exam_folderb. Restrict write permissions for the shared folder
sudo chmod 755 /home/exam_folderc. Test if permissions are set correctly
- Check permissions using:
ls -ld /home/exam_folder- You should see something like:
drwxr-xr-x 2 root root 4096 Feb 17 12:00 /home/exam_folder2. Use AppArmor or SELinux for Enhanced Security
a. Install AppArmor
sudo apt update
sudo apt install apparmor apparmor-utilsb. Enforce AppArmor security profile
sudo aa-enforce /etc/apparmor.d/usr.bin.YourAppReplace YourApp with the app you want to secure.
c. Test if AppArmor is enforcing profiles
sudo apparmor_statusd. Use SELinux (Alternative)
Install SELinux if preferred:
sudo apt install selinux-utilse. Test SELinux status
sestatus3. Lock Down Student Accounts and Prevent System Modifications During Exam Times
a. Lock student accounts
sudo passwd -l student_usernameb. Prevent login by modifying /etc/passwd
sudo usermod -s /sbin/nologin student_usernamec. Test if student account is locked
su - student_username4. Additional Measures
a. Prevent access to certain files during the exam
sudo mount -o remount,noexec /home/exam_folderb. Test noexec flag
cd /home/exam_folder
./your_script.shYou should receive a permission denied message if the noexec flag is correctly set.
Troubleshooting: Fixing "This account is currently not available" Error
If you see the message “This account is currently not available”, it indicates that the student_username account may be missing a home directory or its shell is set to /sbin/nologin or another non-interactive shell, preventing login.
Steps to fix the issue:
1. Check the student_username account details
Use the grep command to check the details of the student_username account in /etc/passwd:
grep student_username /etc/passwdThe output will look something like:
student_username:x:1001:1001::/home/student_username:/bin/bash- Home directory: Ensure the path
/home/student_usernameexists. If it does not, create it:
sudo mkdir /home/student_username
sudo chown student_username:student_username /home/student_username- Shell: Make sure the shell is set to a valid one (e.g.,
/bin/bash): If the shell is set to/sbin/nologinor another non-interactive shell, change it to/bin/bash:
sudo usermod -s /bin/bash student_username2. Verify the account is not locked or unavailable
Check the account status to ensure it is unlocked and available for login:
sudo passwd -S student_usernameIf the account is locked, unlock it:
sudo passwd -u student_username3. Try to log in again
After making these changes, try switching to the student_username account again:
su - student_usernameThis should resolve the issue. If the problem persists, please share more details.