Removing entries in /etc/shadow and /etc/passwd via a program

Removing entries in /etc/shadow and /etc/passwd via a program

Post by Suresh Rajagopal » Fri, 08 Jul 1994 12:47:00



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

 
 
 

Removing entries in /etc/shadow and /etc/passwd via a program

Post by Stefan Ke » Fri, 08 Jul 1994 19:40:57



>Hi everyone:

Hello,

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.  

Try /usr/ucb/vipw. That'll work fine.

Quote:>Thanks for any info

You're welcome.
Stefan.
--
#####################################################################
#  Stefan Kelm       Life's a piece of shit - when you look at it ! #

#####################################################################

 
 
 

Removing entries in /etc/shadow and /etc/passwd via a program

Post by Jeff Lundbe » Fri, 08 Jul 1994 23:25:05


> 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


Try this:
ed - /etc/passwd <<EOF
H
/^${1}:/d       #where ${1} is a login ID...
w
q
EOF

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                             |

     |  |+ +|^^^^^^^^^^^^^^                            |
     |   \ /^^^^^^  ^^ ^^^                             |
     |    ~ ^^ ^^^^^^^                                 |
     ===================================================

 
 
 

Removing entries in /etc/shadow and /etc/passwd via a program

Post by Robert McGow » Sat, 09 Jul 1994 01:54:50


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

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

 
 
 

Removing entries in /etc/shadow and /etc/passwd via a program

Post by w » Sat, 09 Jul 1994 19:41:52



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

>Try this:
>ed - /etc/passwd <<EOF
>H
>/^${1}:/d       #where ${1} is a login ID...
>w
>q
>EOF

Why not using userdel(1M)?

Wolfgang



        "A little knowledge is a dangerous thing." (Doug Gwyn)

 
 
 

Removing entries in /etc/shadow and /etc/passwd via a program

Post by Robert McGow » Sun, 10 Jul 1994 02:18:45


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

: >
: Try this:
: ed - /etc/passwd <<EOF
: H
: /^${1}:/d       #where ${1} is a login ID...
: w
: q
: EOF

: 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

4. Recommended soundcard?

5. Comment out a line in /etc/passwd & /etc/shadow

6. complex routing problem

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?