LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-08-2014, 04:58 AM   #1
Pooja2505
LQ Newbie
 
Registered: Feb 2014
Posts: 3

Rep: Reputation: Disabled
I am facing a problem using pam_exec.so library.I have created script for session.


I am facing a problem using pam_exec.so library.I have created script my.sh in /usr/local/bin/my.sh.

The script contains

---------------------------
#!/bin/sh

echo "hello"
exit 0
-------------------------
Permission 777 is given to script.
and i have added the following in /etc/pam.d/system-auth

session required /usr/local/bin/my.sh log=/etc/logfile

but when i login into the system the script does not execute.
Please help me to solve the problem.
 
Old 02-08-2014, 07:16 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,335
Blog Entries: 55

Rep: Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535
Quote:
Originally Posted by Pooja2505 View Post
Permission 777 is given to script.
That's nice but it's wrong. Owner should be root and access rights should be 0755 at most. Change it before doing anything else.


Quote:
Originally Posted by Pooja2505 View Post
i have added the following in /etc/pam.d/system-auth
session required /usr/local/bin/my.sh log=/etc/logfile
That is not how 'man pam_exec' suggests the entry should be. It could look something like
Code:
open_session optional pam_exec.so seteuid /path/to/script
Also since you're debugging make it read
Code:
open_session optional pam_exec.so debug seteuid /path/to/script
Also do not test and debug as root but only as unprivileged user and don't use system-auth for testing as you won't be able to login if you fsck things up proper.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
KDE konsole err msg:QDBusConnection: session D-Bus conn created b4 QCoreAppliction... jimstaffer Red Hat 0 03-03-2012 09:39 PM
pam_exec run script as user that's logging in arizonagroovejet Linux - General 2 08-23-2011 02:59 AM
Bash script problem with ftp session exiting the script early edomingox Programming 5 02-23-2010 05:39 AM
How to compile a code in gcc, linux by using self-created library??? payu21 Linux - Newbie 9 05-22-2009 01:40 AM
LXer: PalmSource Releases Newly Created Software Library to the Open Source Community LXer Syndicated Linux News 0 08-14-2006 05:21 AM


All times are GMT -5. The time now is 09:56 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration