Sponsored Content
Top Forums Programming Programming Forum - Check it out! Post 302232998 by ovais245 on Friday 5th of September 2008 07:01:05 PM
Old 09-05-2008
"" need this code in C language for UNIX"
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.

- 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.
 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check lists for Unix Shell Programming

Hi all, Can anyone provide me any checklists or a list of steps I should follow before executing my scripts. Could also tell me if there are any other standards to be followed while shell programming like naming conventions for variables etc. Your help would be much appreciated. Regards,... (2 Replies)
Discussion started by: srikanth_ksv
2 Replies

2. Shell Programming and Scripting

Check any MQ is up or down using shell programming

Hi, I want to know that if there are any methods, which check the MQ, is up or down. Actually I have to write one job which checks the status of any one MQ is up or down. I don't know if there is any method of MQ, which tells the MQ, is up. Could u please give some link for the study... (1 Reply)
Discussion started by: rinku
1 Replies

3. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

4. What is on Your Mind?

Forum Update: Disabled Home Page Forum Statistics for Guests (Not Registered)

Just a quick update; to speed up the forums, I have disabled the forum statistics on the home page for non registered users. No changes for registered users. (0 Replies)
Discussion started by: Neo
0 Replies

5. Post Here to Contact Site Administrators and Moderators

Is it possible to add Python in the description of Shell Programming and Scripting of this forum?

https://www.unix.com/shell-programming-and-scripting/ The current description of Shell Programming and Scripting has: Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here. Perl, php are there. Is it possible to add PYTHON there too? (3 Replies)
Discussion started by: cola
3 Replies

6. What is on Your Mind?

Mobile: Advanced Forum Statistics to Forum Home Page

For mobile users, I have just added a "first beta" Advanced Forum Statistics to the home page on mobile using CSS overflow:auto; so you can swipe if you need to see more. Google Search Console mobile usability says this page is "mobile friendly" so perhaps this will be useful for some of our... (12 Replies)
Discussion started by: Neo
12 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 09:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy