Unix for Dummies FAQ


 
Thread Tools Search this Thread
Contact Us Post Here to Contact Site Administrators and Moderators Unix for Dummies FAQ
# 1  
Old 03-20-2001
Java

I have created a small FAQ for the "Unix for Dummies" forum.
Hopefully this will be useful, as there are questions which are asked (and answered) repeatedly.

<A HREF="http://www.droflet.net/unix_dot_com_faq.html">http://www.droflet.net/unix_dot_com_faq.html
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Programming

C++ for dummies: how to compile a code.

Hi. I wrote a small programm which shows me display's refresh rate #include "stdafx.h" #include "windows.h" #include "iostream" using namespace std; int _tmain(int cout) { HDC hDCScreen = GetDC(NULL); int RefreshFrequency = GetDeviceCaps(hDCScreen, VREFRESH); ReleaseDC(NULL, hDCScreen);... (1 Reply)
Discussion started by: urello
1 Replies

2. UNIX for Dummies Questions & Answers

dummies question

Please help to answer some highlighted question below. 1. How to create more than 1 partition in a single hard disk? 2. How to format the created partition to be viewable like in windows C: or D: ? 3. How to use pen drive in unix environment? 4. How to find a file starting with... (8 Replies)
Discussion started by: jimmyysk
8 Replies

3. UNIX for Dummies Questions & Answers

I am real Dummies , I am Questions

I want to know data about 1. Overview 2. Process Management 3. Memory Management 4. File System Management 5. Secondary Storage Management 6. Protection and Security Systems of UNIX OS Thank Alot. (1 Reply)
Discussion started by: coolmara04
1 Replies

4. Solaris

Solaris for dummies

Is there one command that will display all system information on a Solaris host running Solaris 8? System information such as model, memory, CPU, disk space etc. etc. (2 Replies)
Discussion started by: mita
2 Replies

5. News, Links, Events and Announcements

UNIX for Dummies Test

A goofy UNIX test: http://www.majon.com/cgi-bin/IQ?Q=unix WARNING: ANSWERS ARE BELOW!!!! IF YOU WANT TO DO THE TEST BEFORE SEEING THE ANSWERS, DON"T READ FURTHER ;) (13 Replies)
Discussion started by: Neo
13 Replies

6. Shell Programming and Scripting

Perl for Dummies

Hi all. iam new to this and i want to learn perl Any good website out there ?? anything will do thanks :( (1 Reply)
Discussion started by: perleo
1 Replies

7. UNIX for Dummies Questions & Answers

scripts for dummies

í have no idea how to write a script. can someone help? how would i write a script that will do the following commands mkdir temp cp * temp cd temp ls i want to be able to do a set of commands by typing in only one command. i´m a windows user that is trying to learn unix, finally :P so... (6 Replies)
Discussion started by: eeldivady
6 Replies
Login or Register to Ask a Question
PAM::FAQ(3)						User Contributed Perl Documentation					       PAM::FAQ(3)

NAME
Authen::PAM::FAQ - Frequently-Asked Questions about Authen::PAM. SYNOPSIS
perldoc Authen::PAM::FAQ VERSION
This document is currently at version 0.05, as of May 4, 2005 DESCRIPTION
1. Can I authenticate a user non interactively? Yes, you can although not in a very clean way. The PAM library has a mechanism, in a form of a conversation function, to send and receive text data from the user. For details of the format of the conversation function consult the Authen::PAM manual. This function receives a list of code/string pairs. There are two codes (PAM_TEXT_INFO and PAM_ERROR_MSG) for displaying the associated string to the user and two codes (PAM_ECHO_ON and PAM_ECHO_OFF) for getting input from the user. As you can see the codes are rather general and you can not be com- pletely sure when you are asked for a user name and when for a password. However, the common practice is that PAM_ECHO_ON is used for a user name and PAM_ECHO_OFF is used for a password. So, what you can do is to write your own conversation function which ignores the PAM_TEXT_INFO and PAM_ERROR_MSG codes and returns the user name for the code PAM_ECHO_ON and the password for the code PAM_ECHO_OFF. If you pass the user name in the initialization function then usually you will not be asked for it. Here is a simple example how to do this: use Authen::PAM; use POSIX qw(ttyname); $service = "login"; $username = "foo"; $password = "bar"; $tty_name = ttyname(fileno(STDIN)); sub my_conv_func { my @res; while ( @_ ) { my $code = shift; my $msg = shift; my $ans = ""; $ans = $username if ($code == PAM_PROMPT_ECHO_ON() ); $ans = $password if ($code == PAM_PROMPT_ECHO_OFF() ); push @res, (PAM_SUCCESS(),$ans); } push @res, PAM_SUCCESS(); return @res; } ref($pamh = new Authen::PAM($service, $username, &my_conv_func)) || die "Error code $pamh during PAM init!"; $res = $pamh->pam_set_item(PAM_TTY(), $tty_name); $res = $pamh->pam_authenticate; print $pamh->pam_strerror($res)," " unless $res == PAM_SUCCESS(); The Authen::PAM module comes with a default conversation function which you can find in the file PAM.pm. 2. Can I change a password non interactively? All the discussion of the previous question also applies here. There is however one serious complication. When changing a password it is quite possible that the PAM library will send you at lest two PAM_ECHO_OFF prompts - one for the old password and one or two for the new one. Therefore, the first thing you should do is to see what sequence of prompts is produced by your service. Then the conversation func- tion should include some state variable to distinguish the different prompts. Here is an example: use Authen::PAM; $service = "passwd"; $username = "foo"; $oldpassword = "old_pass"; $newpassword = "new_pass"; sub my_conv_func { my @res; while ( @_ ) { my $code = shift; my $msg = shift; my $ans = ""; $ans = $username if ($code == PAM_PROMPT_ECHO_ON() ); if ($code == PAM_PROMPT_ECHO_OFF() ) { $ans = $oldpassword if ($state == 0); $ans = $newpassword if ($state == 1); $ans = $newpassword if ($state == 2); $state++; } push @res, (PAM_SUCCESS(),$ans); } push @res, PAM_SUCCESS(); return @res; } ref($pamh = new Authen::PAM($service, $username, &my_conv_func)) || die "Error code $pamh during PAM init!"; $state = 0; $res = $pamh->pam_chauthtok; print $pamh->pam_strerror($res)," " unless $res == PAM_SUCCESS(); If you are running the script as root then most likely you will not be prompted for an old password. In this case you can simply return the new password at the ECHO_OFF prompt. The $msg variable contains the text of the input prompt which you can use for additional test or for debugging purposes, e.g. if ($code == PAM_PROMPT_ECHO_OFF() ) { if ($state>=1 || $msg=~/new/i) { # are we asked for a new password $ans = $newpassword; } else { $ans = $oldpassword; } $state++; } 3. Why are the constants PAM_AUTHTOK and PAM_OLDAUTHTOK not avaliable? The PAM_AUTHTOK and PAM_OLDAUTHTOK items can be used to pass authentication tokens (passwords) from one module to another. However, they are avaliable only to PAM modules and not to PAM applicatinos. If you have a special setup in which you really need to preset the password from the application (e.g. using a radius server) then you can use the pam_set_authtok module avaliable from <http://www.uni-hohen- heim.de/~schaefer/linux/pam/pam_set_authtok.html>. SEE ALSO
Authen::PAM AUTHOR
Nikolay Pelov <NIKIP at cpan.org> COPYRIGHT
Copyright (c) 1998-2005 Nikolay Pelov. All rights reserved. This file is part of the Authen::PAM library. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.8.4 2005-06-30 PAM::FAQ(3)