Hi everyone:
I'm writing some maintenance scripts, and would like to know how to
remove entries in /etc/shadow and /etc/passwd through a program or
system call.
Thanks for any info
Suresh
I'm writing some maintenance scripts, and would like to know how to
remove entries in /etc/shadow and /etc/passwd through a program or
system call.
Thanks for any info
Suresh
Try /usr/ucb/vipw. That'll work fine.Quote:>I'm writing some maintenance scripts, and would like to know how to
>remove entries in /etc/shadow and /etc/passwd through a program or
>system call.
You're welcome.Quote:>Thanks for any info
> I'm writing some maintenance scripts, and would like to know how to
> remove entries in /etc/shadow and /etc/passwd through a program or
> system call.
> Thanks for any info
> Suresh
Works for us (gotta be root, of course).
===================================================
| ^* Jeff Lundberg |
| | | Network Administrator |
| ^ | | ^ Optical Society of America |
| | | | | | | 2010 Massachusetts Ave. NW |
| | |_| | | | Washington, DC 20036 |
| \__ |_/ / |
| | __/ P: (202) 416-1450 |
| | | F: (202) 223-1096 |
| | | ooo |
| | | ooooo |
| |+ +|^^^^^^^^^^^^^^ |
| \ /^^^^^^ ^^ ^^^ |
| ~ ^^ ^^^^^^^ |
===================================================
: I'm writing some maintenance scripts, and would like to know how to
: remove entries in /etc/shadow and /etc/passwd through a program or
: system call.
Check out the commands "passmgmt", "useradd", "userdel", "usermod",
"groupadd", "groupdel" and "groupmod". The last three actually work on the
/etc/group file but are included for completeness. Also check out the
"passwd" command for options to check and set password aging.
Bob
>Try this:
>ed - /etc/passwd <<EOF
>H
>/^${1}:/d #where ${1} is a login ID...
>w
>q
>EOF
Wolfgang
"A little knowledge is a dangerous thing." (Doug Gwyn)
: Works for us (gotta be root, of course).
This is not recommended since there are no locks on the passwd/shadow to
keep other users from making changes while you work on the file. When you
save the edit buffer the changes (generally passwords) would either be
overwritten (if you are not using the shadow file) or the passwd and
shadow files will be out of sync, also causing problems.
Also your method only manages the /etc/passwd file. Perhaps you have
other scripts for /etc/shadow? In any case, there are commands, mentioned
in my previous post responding to Suresh's original question, that do the
job better (passmgmt, useradd, userdel, usermod).
Bob
1. CDE vs. /etc/passwd, /etc/shadow and /etc/group
Hi,
Can anybody tell me what happens to the /etc/passwd, /etc/shadow and
/etc/group when DCE is installed?
I've seen images of these files and seems like CDE adds users & groups
with funny names like 'hosts/machine/group' and
'subsys/dce/dts-servers'.
If this is the case, how do the Solaris commands (useradd/mod/del,
passwd, etc.) get along with these weird users/groups?
Thanks,
--
/* EagleEye Control Software, LTD., Tel-Aviv, Israel */
/* .. I busted a mirror and got seven years bad luck, but my ..*/
/* .. lawyer thinks he can get me five. (Steven Wright) ..*/
2. Sun (Solaris) raster to PCX
3. Convert NIS passwd back to standard /etc/passwd & /etc/shadow
5. Comment out a line in /etc/passwd & /etc/shadow
7. restricted http acces with /etc/passwd and /etc/shadow
8. Data Base Insights & Recommendations
9. rconsiling the /etc/shadow and /etc/passwd files
10. kuser etc/shadow and etc/passwd
11. Moving etc/shadow & etc /passwd
12. how to tell /etc/passwd from /etc/shadow?
13. what's the difference between /etc/shadow and /etc/passwd?