Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Carreer:Networking Programming in Unix (C programming Language) Post 302232999 by ovais245 on Friday 5th of September 2008 07:05:26 PM
Old 09-05-2008
Write or study a small program that mimics the most common login procedures in UNIX.
You have two options here. Either, you write it yourself according to the specification
below, or you copy the file
/cab/cestud/work/edu/course/EDA263_Computer_Security/
lib/login_linux/login_linux.c into your home directory. If you choose to write
it yourself the following should be implemented.
- The program begins with displaying ”login:” and takes the username as input.
7
- Then the program writes ”Password:” and waits for the password to be entered,
which should not be visible on the terminal (use the function getpass(3) that
among other things will see to that the text is not ”echoed” on the terminal).
- The program queries the system’s user database to see if the username exists. If
this is the case it encrypts the entered password (with a known algorithm) and
ensures it corresponds to the stored encrypted password belonging to the actual
user. Suitable library routines are getpwnam(3), crypt(3) and strncmp(3).
- If the username does not exist, or if the password is wrong, the program displays
”Login incorrect” and restarts from the beginning, otherwise it writes something
like ”Welcome to this System!” and terminates.
Test that your program works by compiling and running it.
This User Gave Thanks to ovais245 For This Post:
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Does the programming language matters?

I see you guys encouraged people studied and used C while they were working on UNIX. Does C++ or JAVA matter? And in the past threads, Neo, PxT, and other members recommanded lots good books. I think those people who asked for the references, such as Dominic, had experiences on sys admin or... (8 Replies)
Discussion started by: HOUSCOUS
8 Replies

2. Programming

c programming language

Can someone enligten me on what below program does? I understand getchar and putchar.. but what is this program suppose to do? I try to put printf on it, but it shows nothing.. can someone explain to me what this program is suppose to do? It is reading something and assigning to c? so, if... (8 Replies)
Discussion started by: convenientstore
8 Replies

3. UNIX for Dummies Questions & Answers

Is PERL a programming language?

I need a small and simple clarification... Can someone tell me whether PERL is a programming language or not. Also, can shell scripts also considered as programming language or not. Also, please tell me the exact difference between programming language and scripting. Please help.... (3 Replies)
Discussion started by: Anjan1
3 Replies

4. Programming

What Programming language should I start learning first?

I want to create a computer program that will translate from English to Spanish and vice versa. So someone could type in a word, phrase, or paragraph and translate from one language to another. What programming language would I use to write up the code and then implement this program? I want to... (8 Replies)
Discussion started by: Anna Hussie
8 Replies

5. UNIX for Dummies Questions & Answers

How does unix system administration, unix programming, unix network programming differ?

How does unix system administration, unix programming, unix network programming differ? Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies

6. Programming

Whats the most in-demand programming language UNIX

I am interested in learning Programming Language to complement my UNIX. What language should I concentrate on to enhance my UNIX. What companies are seeking with UNIX. What languages are used with UNIX as for as there application. Are there any one here from DC (6 Replies)
Discussion started by: zbest1966
6 Replies
d_passwd(4)							   File Formats 						       d_passwd(4)

NAME
d_passwd - dial-up password file SYNOPSIS
/etc/d_passwd DESCRIPTION
A dial-up password is an additional password required of users who access the computer through a modem or dial-up port. The correct pass- word must be entered before the user is granted access to the computer. d_passwd is an ASCII file which contains a list of executable programs (typically shells) that require a dial-up password and the associ- ated encrypted passwords. When a user attempts to log in on any of the ports listed in the dialups file (see dialups(4)), the login program looks at the user's login entry stored in the passwd file (see passwd(4)), and compares the login shell field to the entries in d_passwd. These entries determine whether the user will be required to supply a dial-up password. Each entry in d_passwd is a single line of the form: login-shell:password: where login-shell The name of the login program that will require an additional dial-up password. password An encrypted password. Users accessing the computer through a dial-up port or modem using login-shell will be required to enter this password before gaining access to the computer. d_passwd should be owned by the root user and the root group. The file should have read and write permissions for the owner (root) only. If the user's login program in the passwd file is not found in d_passwd or if the login shell field in passwd is empty, the user must sup- ply the default password. The default password is the entry for /usr/bin/sh. If d_passwd has no entry for /usr/bin/sh, then those users whose login shell field in passwd is empty or does not match any entry in d_passwd will not be prompted for a dial-up password. Dial-up logins are disabled if d_passwd has only the following entry: /usr/bin/sh:*: EXAMPLES
Example 1: Sample d_passwd file. Here is a sample d_passwd file: /usr/lib/uucp/uucico:q.mJzTnu8icF0: /usr/bin/csh:6k/7KCFRPNVXg: /usr/bin/ksh:9df/FDf.4jkRt: /usr/bin/sh:41FuGVzGcDJlw: Generating An Encrypted Password The passwd (see passwd(1)) utility can be used to generate the encrypted password for each login program. passwd generates encrypted pass- words for users and places the password in the shadow (see shadow(4)) file. Passwords for the d_passwd file will need to be generated by first adding a temporary user id using useradd (see useradd(1M)), and then using passwd(1) to generate the desired password in the shadow file. Once the encrypted version of the password has been created, it can be copied to the d_passwd file. For example: 1. Type useradd tempuser and press Return. This creates a user named tempuser. 2. Type passwd tempuser and press Return. This creates an encrypted password for tempuser and places it in the shadow file. 3. Find the entry for tempuser in the shadow file and copy the encrypted password to the desired entry in the d_passwd file. 4. Type userdel tempuser and press Return to delete tempuser. These steps must be executed as the root user. FILES
/etc/d_passwd dial-up password file /etc/dialups list of dial-up ports requiring dial-up passwords /etc/passwd password file /etc/shadow shadow password file SEE ALSO
passwd(1), useradd(1M), dialups(4), passwd(4), shadow(4) WARNINGS
When creating a new dial-up password, be sure to remain logged in on at least one terminal while testing the new password. This ensures that there is an available terminal from which you can correct any mistakes that were made when the new password was added. SunOS 5.10 2 Sep 2004 d_passwd(4)
All times are GMT -4. The time now is 06:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy