• We did not send an email asking for donations - please read this post.

PAM script login / disk formatting

shayan35

New Member
Joined
Nov 23, 2022
Messages
1
Reaction score
0
Credits
14
Hello to all !


I'm coming to you for help with a personal project

In a few words :

When opening the Ubuntu session I would like a script to be activated when a user enters a wrong password

The script should run for example after the 3rd try and if the 3rd try is wrong, a partition or complete disk formatting command is executed with a reboot

I have seen some scripts with PAM but nothing concrete

A little help would be welcome

Thanks in advance for your help and have a nice day !
 


osprey

Active Member
Joined
Apr 15, 2022
Messages
281
Reaction score
184
Credits
2,587
Alas, a challenging task you speak of, but it sounds to me like I'm reading an XY problem.
See https://en.wikipedia.org/wiki/XY_problem.

What do you want to achieve after the 3rd failure to login occurs? If you want to prevent further login attempts and lock the user out, there are robust and reliable ways of doing that other than the radical move of reformatting a partition ... but you may have something else in mind.

On the face of it, as far as I understand what you want, to clear the partition of the user and reformat it after login failure, the part of the filesystem where the user's home directory is located would best be on a separate partition itself, which is not the usual way in which home directories are set by default on linux installations. The default arrangement is based on directories for users rather than partitions, though the home directory itself that houses the users may be a separate partition. So, to achieve your goal as I understand it, you would need to have a multiplicity of partitions for users rather just directories. I guess this could be set up at installation, or created on the fly with a means of creating or allocating a partition to the new user whenever they are added to the system ... perhaps using lvm or btrfs or zfs, but I can't say more on the capabilities of those systems. In any case, the task may or may not need PAM, but rather just a shell script or other other executable that you create.
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
7,428
Reaction score
6,402
Credits
60,233
This sounds like a very, very bad idea.

All it takes is a wonky keyboard, caps lock, or something just mashing buttons and you've removed a bunch of seemingly important data.

There's gotta be a better way to secure your data.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Staff online

Members online


Top