12-29-2009
Best way to check for system user and password in C
Hello,
I'm implementing a very simple FTP client, and to do the login I would like to check against system users instead of using my own database, so that I can give the proper permissions to the newly created process that I spawn with fork. What's the best way for doing this in C?
I've read about the getpwnam function, that returns a struct passwd that has the field pw_passwd to compare against (using the crypt function), but I'm not sure if this is quite standard, is there any other way to do this?
Thanks, Roger.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
While using Pipe concept ,if a user enters a "login name" and "paswword"
,then how does a child process check for user password is correct or not and give notification to parent process. (1 Reply)
Discussion started by: riya
1 Replies
2. Solaris
Hi,
I'm new to solaris/ Unix and would like to know how to check in the system what
was the last login user were doing. Is there any way to check this? Thanks in advanced. (1 Reply)
Discussion started by: raziayub
1 Replies
3. UNIX for Advanced & Expert Users
Helo ,
I m using linux pam library for user and its password authentication.
I m creating new user and giving its password.I m giving password of 10 characters.now when I login in as that newly created user its ask me
$ su - ram
Password:
You are required to change your password immediately... (12 Replies)
Discussion started by: amitpansuria
12 Replies
4. Cybersecurity
I need to periodically run a check on the passwords of the users (Redhat 5.0) to verify that all passwords meet minimal standards. I remember seeing a script years ago that grabbed the encrypted passwords from the file and checked if they matched any of the encrypted strings in another file, plus... (1 Reply)
Discussion started by: tlynnch
1 Replies
5. UNIX for Dummies Questions & Answers
For moderator: I made a new thread in a proper part of the forum now https://www.unix.com/homework-coursework-questions/137119-user-processes.html
But now i wan't to make something which isn't related to a homework, so i hope
you won't close this one. Thanks to those two answers, you helped me!... (9 Replies)
Discussion started by: petel1
9 Replies
6. UNIX for Advanced & Expert Users
Advance Thanks.
(1) I would like to know any unix/Linux command to check EOF char in a file.
(2) Or Any way I can check a file has been reached completely at machine B from machine A. Note that machine A ftp/scp the file to machine B at unknown time. (5 Replies)
Discussion started by: alexalex1
5 Replies
7. Shell Programming and Scripting
Can someone help in writing some script through which I can transfer file (scp) from root user in abc server to crt user in hfg server and can give the crt user password in script itself so that it doesn't prompt me every time for password (4 Replies)
Discussion started by: Moon1234
4 Replies
8. HP-UX
Hi Guys,
I am new to HP-UX and want to find expiration date of particular user please also note i don't have root access on that server.
for e.g.
i have user abc on my HP box and want to know when its password going to expire and also when its password changed last time.
I also try to... (7 Replies)
Discussion started by: Yasin Rakhangi
7 Replies
9. UNIX and Linux Applications
I have these two table. How do I see if user roles and system roles are seperated?
SQL> desc DBA_ROLES;
Name Null? Type
----------------------------------------- -------- ----------------------------
ROLE NOT NULL... (1 Reply)
Discussion started by: alvinoo
1 Replies
LEARN ABOUT DEBIAN
passwd
PASSWD(5) File Formats and Conversions PASSWD(5)
NAME
passwd - the password file
DESCRIPTION
/etc/passwd contains one line for each user account, with seven fields delimited by colons (":"). These fields are:
o login name
o optional encrypted password
o numerical user ID
o numerical group ID
o user name or comment field
o user home directory
o optional user command interpreter
The encrypted password field may be blank, in which case no password is required to authenticate as the specified login name. However, some
applications which read the /etc/passwd file may decide not to permit any access at all if the password field is blank. If the password
field is a lower-case "x", then the encrypted password is actually stored in the shadow(5) file instead; there must be a corresponding line
in the /etc/shadow file, or else the user account is invalid. If the password field is any other string, then it will be treated as an
encrypted password, as specified by crypt(3).
The comment field is used by various system utilities, such as finger(1).
The home directory field provides the name of the initial working directory. The login program uses this information to set the value of
the $HOME environmental variable.
The command interpreter field provides the name of the user's command language interpreter, or the name of the initial program to execute.
The login program uses this information to set the value of the $SHELL environmental variable. If this field is empty, it defaults to the
value /bin/sh.
FILES
/etc/passwd
User account information.
/etc/shadow
optional encrypted password file
/etc/passwd-
Backup file for /etc/passwd.
Note that this file is used by the tools of the shadow toolsuite, but not by all user and password management tools.
SEE ALSO
crypt(3), getent(1), getpwnam(3), login(1), passwd(1), pwck(8), pwconv(8), pwunconv(8), shadow(5), su(1), sulogin(8).
shadow-utils 4.1.5.1 05/25/2012 PASSWD(5)