LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-23-2009, 03:24 PM   #1
brobeck
LQ Newbie
 
Registered: Oct 2009
Location: Bay Area
Distribution: RHEL4
Posts: 2

Rep: Reputation: 0
How to make PAM give a message when denying ssh access


We use PAM to control access to our RHEL4 servers. We would like PAM to give a message, of our choice, when users who are not allowed to login try to login. PAM's default is to let the user try 3 times without any explanation.
 
Old 10-23-2009, 04:43 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by brobeck View Post
We would like PAM to give a message, of our choice, when users who are not allowed to login try to login.
In some organizations it is required to present a banner or trespass notice before login (pam_issue, pam_echo, /etc/issue, sshd_config Banner, 'man 5 hosts_access') basically telling you to stay away. I think that's the best generic way without giving away information. I'm sure you have your requirements but giving away information unnecessarily is bad. Giving explicit confirmation to not-yet-authenticated-users about account existence or access restrictions is doubleplusbad.
 
Old 10-23-2009, 05:49 PM   #3
brobeck
LQ Newbie
 
Registered: Oct 2009
Location: Bay Area
Distribution: RHEL4
Posts: 2

Original Poster
Rep: Reputation: 0
I agree, but let's say I would like to do tell the user "You are not allowed to login to this server". How would I go about doing this in PAM?
 
Old 10-23-2009, 06:12 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
You don't. At least not as a response and not configurable per user.
 
Old 10-23-2009, 06:36 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by brobeck
I agree, but let's say I would like to do tell the user "You are not allowed to login to this server". How would I go about doing this in PAM?
Not to sidestep the question, but I'd argue that failed authentication and a nice "Permission denied (keyboard-interactive)" message says exactly that.

Couple that with an sshd banner clearly stating appropriate access terms, and only the dimmest of bulbs won't be able to get the picture.
 
Old 10-25-2009, 09:23 AM   #6
fpmurphy
Member
 
Registered: Jan 2009
Location: /dev/ph
Distribution: Fedora, Ubuntu, Redhat, Centos
Posts: 299

Rep: Reputation: 62
Quote:
I agree, but let's say I would like to do tell the user "You are not allowed to login to this server". How would I go about doing this in PAM?
Use pam_echo to output the required message

Last edited by fpmurphy; 10-25-2009 at 09:25 AM.
 
Old 10-25-2009, 10:29 AM   #7
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Question

Quote:
Originally Posted by fpmurphy View Post
Use pam_echo to output the required message

Hi fpmurphy,

Could you please tell where to put pam_echo and if possible syntax also pls.
 
Old 10-25-2009, 08:09 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
This may help http://www.kernel.org/pub/linux/libs...x-PAM_SAG.html
 
  


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
[SOLVED] Give access to your server via ssh Syed Tarique Moin Linux - Networking 4 07-21-2011 10:06 AM
SSH/PAM non-authorized login attempts: print default message kenneho Linux - Security 0 01-08-2009 08:42 AM
deny ssh access with pam RobertCraven Linux - Security 5 05-12-2006 03:55 AM
Denying access to SSH but allow access to FTP nemesisza Linux - Security 5 03-14-2004 10:25 PM
Denying telnet with message Infamous Tim Linux - Security 4 03-25-2001 05:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:37 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