Questions tagged [getpwnam]
13 questions
3
votes
2 answers
Ansible - failed to lookup user
How can I solve problem with run ansible role below? If a user doesn't exist on the remote server, ansible gets me the error "Failed to lookup user test1: 'getpwnam(): name not found: test1". I need manage multiple users on multiple servers.…

omfo
- 39
- 1
- 4
2
votes
3 answers
Weird behavior of getpwnam
#include
#include
#include
int main(void)
{
printf("%s %s\n", getpwnam("steve")->pw_name, getpwnam("root")->pw_name);
printf("%d %d\n", getpwnam("steve")->pw_uid, getpwnam("root")->pw_uid);
…

Steve Lau
- 658
- 7
- 13
2
votes
2 answers
getpwnam on Ubuntu behaves differently if compiled in 32-bit
I'm setting up a ZABBIX agent (written in C) on a couple of Ubuntu 64-bit servers. I usually compile everything in 32-bit unless I specifically need 64-bit (such as database servers.) The servers in question will be hosting virtual servers and…

Andy Shellam
- 15,403
- 1
- 27
- 41
1
vote
1 answer
how to do getpwnam/getpwuid etc in tcl
does tcl have a standard way of doing NSS lookups (getpwnam, setpwent,...)

pm100
- 48,078
- 23
- 82
- 145
1
vote
1 answer
Create a function to get a username using a try and catch method in C++
I'm trying to create a function to get a username using a try and catch method in C++. Unfortunately this code doesn't work, and my application closes when it tries to run.
QString UserInfo::getFullUserName()
{
DBG_ENTERFUNC(getFullUserName);
…
user5040767
1
vote
1 answer
list of uids / names of System Preferences > Accounts
How can I obtain an array with uid and names?
I could iterate from 0 to 99999 and do a getpwnam().
However most machines have less than 5 accounts, so it's not optimal. I don't know what framework is responsible for this and thus I have no clue…

neoneye
- 50,398
- 25
- 166
- 151
1
vote
1 answer
Safe way to use the result of getpwnam()/getpwuid()?
I'm working on Linux and FreeBSD. When I use getpwnam() or getpwuid(), I get a pointer to a passwd struct. What's the safe way to use the char* members of that passwd struct?
The man page says this struct is a static object but will be overwritten…

Wang Tuma
- 893
- 5
- 14
- 24
1
vote
2 answers
Does getpwnam respect /etc/nsswitch.conf?
Does getpwnam respect /etc/nsswitch.conf?
The manpage for getpwnam states
The getpwnam() function returns a pointer to a structure containing the broken-out
fields of the record
in the password database (e.g., the local password file…

Kaleb Pederson
- 45,767
- 19
- 102
- 147
1
vote
1 answer
Why is getpwnam() always returning root information in a function?
I wrote a simple program that calls getpwnam() on a username, passes that username to a function, and then calls getpwnam() again. For some reason, I always get the passwd information for root inside the function.
#include
#include…

Andrew Gunnerson
- 638
- 1
- 8
- 17
0
votes
0 answers
Unable to start server after Jupyterhub upgrade to 0.8.1
I have recently upgraded jupyterhub from 0.7 to 0.8.1. After upgrade, i have upgraded the sqllite database as well as mentioned in the upgrade documents. I'm able to start the jupyterhub service but after login, i'm unable to start the server with…

user3629042
- 21
- 6
0
votes
2 answers
User in passdb, but getpwnam() fails!
Attempting to set up Samba + OpenLDAP using nss_ldap.
After joining Windows7 to Samba stand alone PDC, I can not login with a domain account unless that account is also added to the /etc/passwd file.
I get: user in passdb, but getpwnam()…

Eric
- 1,697
- 5
- 29
- 39
0
votes
1 answer
Perl getpwnam fails in sub
So i'm trying to use getpwnam() to search etc/passwd for a username in a sub, and return true if it exists. I keep getting the error "Use of uninitialized value in getpwnam".
sub nameSearch
{
$search = $_;
@name = getpwnam($search);
if ( ! defined…

sh3rifme
- 1,054
- 1
- 11
- 26
-1
votes
1 answer
How to return "You have been logged in!" knowing a password but not UserID?
I have a basic Linux authentication program compiled, but I do not understand what it requires to return "You have been logged in!". I know a password entry, but not the associate UID.
#include
#include
#include…

oniera
- 23
- 1
- 3