Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Verifying a user's password

Posted on 1998-05-31
4
Medium Priority
?
402 Views
Last Modified: 2010-04-21
I am writing a UNIX program to verify a user's UNIX user name and password. UNIX includes a structure called passwd that allows programmers to verify fields in the passwd file. Comparing and verifying the user inputted/supplied name can be accomplished using this structure; however, the users inputted/supplied password can not, since it must be encrypted before it can be used. Is there a function that encrypts the user's inputted password? Th objective is to compare it against the field in the passwd file.


ronandersen@hotmail.com
0
Comment
Question by:ronandersen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:ronandersen
ID: 2007309
Edited text of question
0
 

Author Comment

by:ronandersen
ID: 2007310
This question should probably go under the topic UNIX programming, although administrators could benefit from the response.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2007311
man 3 crypt

0
 
LVL 1

Accepted Solution

by:
hajek earned 400 total points
ID: 2007312
integer pw_compare(current, check)
char    *current,               /* Current pw (encrypted) */
        *check;                 /* check pw (plain) */
{
        if (!*current)
                return(0);
        return(!strcmp(current, crypt(check, current)));
}
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question