LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 06-02-2014, 07:28 AM   #1
themanwhowas
Member
 
Registered: Nov 2005
Distribution: CentOS 5, Fedora 23
Posts: 218

Rep: Reputation: 29
run program at failed login


Hello

Fedora 19 KDE 4

How can i run a program when a user login fails due to incorrect password? google leads me toward PAM but is there an easier way? if not can anyone point me to a PAM newbie guide as I've never done anything with that before.

The program I want to run is just a simple bash script

Thanks
 
Old 06-02-2014, 04:33 PM   #2
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
Hi

Very intersting, but not sure how to do it.

This is some kind of low-level change which might make your system not able to boot => first ensure that you have an alternative way of booting your PC (e.g. using a cd-rom)

In my case (Gentoo Linux without graphical login), the login is controlled by the configuration found in "/etc/inittab:
Code:
# TERMINALS
c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux
c2:2345:respawn:/sbin/agetty --noclear 38400 tty2 linux
c3:2345:respawn:/sbin/agetty --noclear 38400 tty3 linux
c4:2345:respawn:/sbin/agetty --noclear 38400 tty4 linux
c5:2345:respawn:/sbin/agetty --noclear 38400 tty5 linux
c6:2345:respawn:/sbin/agetty --noclear 38400 tty6 linux
Maybe you could substitute the text saying e.g. "/sbin/agetty --noclear 38400 ttyXXX linux" with your own script "/my/own/scriptXXX.sh" and in "scriptXXX.sh" write something like...
Code:
/sbin/agetty --noclear 38400 ttyXXX linux || echo somefailedlogin_on_XXX >> /tmp/nosypeople.txt
...which would execute the same exact original command but additionally run the "echo" command (for testing purposes - once you have that working you can run anything) only in case of a failure.

Again: if you screw up with "inittab" you'll definitely end up not being able to login at all => ensure that you have a way to modify that file without relying on your HDD (e.g. booting from cd-rom + mounting your root partition + edit that file).

Have fun
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pam help - Run Script at Failed Login sniff Linux - Security 2 04-07-2014 05:12 AM
[SOLVED] run command/program after failed login attempts xwjitftu Linux - Security 7 08-26-2011 06:23 PM
Auto run and only run a program after login? narke Slackware 2 05-27-2011 12:51 PM
Failed to run the tutorial program in Anjuta + Glade matrix13 Linux - Software 0 12-26-2008 02:44 AM
Gnome: Run program at login for all users Neruocomp Linux - Desktop 1 11-13-2007 04:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 12:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration