05-12-2012
add new user using usradd admin . and after that in /etc/passwd file change its uid to root's uid .
8 More Discussions You Might Find Interesting
1. AIX
Hello,
I am not the AIX guru..
This might seem simple for a lot but I am not sure where to start.. So here is my question:
I have a unix account on a remote site. My UID is 999999.
Now I need to create my account at my main site, with the same UID. So i have to make sure the UID 999999 is... (1 Reply)
Discussion started by: maxalarie
1 Replies
2. Shell Programming and Scripting
Hi, I want to write a script to check whether an user ID is used in my server and then create that user.
If the user ID is not used, I will echo something like "OK, continue" and then continue to execute the script. Else, I will echo something like "Used, exit" and then exit the script.
As... (4 Replies)
Discussion started by: dirkaulo
4 Replies
3. UNIX for Advanced & Expert Users
Hello,
I created a new user "rootNew"
After creation I manually change the file /etc/passwd and gave the new user "rootNew" uid 0.
Now I have 2 users with uid 0 (root,rootNew) how can I know which user is log in the system?
"whoami" command return "root" for both users.
Thanks,
Uri
No... (0 Replies)
Discussion started by: urip
0 Replies
4. Cybersecurity
Hello,
I created a new user "rootNew"
After creation I manually change the file /etc/passwd and gave the new user "rootNew" uid 0.
Now I have 2 users with uid 0 (root,rootNew) how can I know which user is log in the system?
"whoami" command return "root" for both users.
Thanks,
Uri (10 Replies)
Discussion started by: urip
10 Replies
5. Shell Programming and Scripting
hi,
i am new to shell scripts
i write a shell script to create multiple users but i need to give passwords to that users while creating users, command to write this script (1 Reply)
Discussion started by: DONFOX
1 Replies
6. Shell Programming and Scripting
I need to list users in /etc/passwd with root's GID or UID or /root as home directory
If we have these entries in /etc/passwd
root:x:0:0:root:/root:/bin/bash
rootgooduser1:x:100:100::/home/gooduser1:/bin/bash
baduser1:x:0:300::/home/baduser1:/bin/bash... (6 Replies)
Discussion started by: anil510
6 Replies
7. Shell Programming and Scripting
Hi, guys. I need help on some expect problem.
#!/usr/bin/expect
set user
set password
set newuser
spawn telnet x.x.x.x
expect login*
send “root\r”
expect Password*
send “123546\r”
send "useradd $newuser\r"
send "exit\r"
interact
I can add 1 user using expect script, but how do I... (1 Reply)
Discussion started by: alhazerd
1 Replies
8. Homework & Coursework Questions
I would like to get an opinion for my solution for this task and get feedback about better approach or mistakes I have made.
1. The problem statement, all variables and given/known data:
The task is to create a script which prints information about users whose names are specified in the... (2 Replies)
Discussion started by: kornfan
2 Replies
LEARN ABOUT CENTOS
hesiod_getpwuid
HESIOD(3) Library Functions Manual HESIOD(3)
NAME
hesiod_getpwnam, hesiod_getpwuid, hesiod_free_passwd - Hesiod functions for retrieving passwd information
SYNOPSIS
#include <hesiod.h>
struct passwd *hesiod_getpwnam(void *context, const char *name)
struct passwd *hesiod_getpwuid(void *context, uid_t uid)
void hesiod_free_passwd(void *context, struct passwd *pw)
cc file.c -lhesiod
DESCRIPTION
This family of functions allows you to retrieve passwd database information using Hesiod. To perform lookups, you need an initialized Hes-
iod context; see hesiod(3) for details. You may look up passwd information by name or by uid; information is returned in the same format
as by getpwnam or getpwuid. It is the caller's responsibility to call hesiod_free_passwd with the returned passwd entry to free the
resources used by the passwd entry.
Hesiod queries for passwd information are made using the ``passwd'' or ``uid'' Hesiod type, using either the username or the decimal repre-
sentation of the uid as the Hesiod name. The corresponding records should be a colon-separated list of fields giving the username,
encrypted password, uid, gid, GECOS information, home directory, and shell of the user.
RETURN VALUES
On failure, hesiod_getpwnam and hesiod_getpwuid return NULL and set the global variable errno to indicate the error.
ERRORS
These calls may fail for any of the reasons the routine hesiod_resolve may fail.
SEE ALSO
hesiod(3)
30 November 1996 HESIOD(3)