Switch to NetBSD passwd format
Based on work by Vivek Prakash and Gianluca Guida. See UPDATING about caveats on currently existing accounts. . restores netbsd libc pwcache functions
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
# $NetBSD: Makefile,v 1.12 2009/04/22 15:23:09 lukem Exp $
|
||||
#
|
||||
|
||||
WARNS?= 1 # XXX: -Wsign-compare -Wcast-qual
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
CPPFLAGS+= -DEXTENSIONS -DPW_MKDB_ARGC=2
|
||||
|
||||
PROG= user
|
||||
SRCS+= user.c main.c
|
||||
LINKS+= ${BINDIR}/user ${BINDIR}/useradd
|
||||
LINKS+= ${BINDIR}/user ${BINDIR}/userdel
|
||||
LINKS+= ${BINDIR}/user ${BINDIR}/usermod
|
||||
LINKS+= ${BINDIR}/user ${BINDIR}/group
|
||||
LINKS+= ${BINDIR}/user ${BINDIR}/groupadd
|
||||
LINKS+= ${BINDIR}/user ${BINDIR}/groupdel
|
||||
LINKS+= ${BINDIR}/user ${BINDIR}/groupmod
|
||||
LINKS+= ${BINDIR}/user ${BINDIR}/userinfo
|
||||
LINKS+= ${BINDIR}/user ${BINDIR}/groupinfo
|
||||
LDADD+= -lutil
|
||||
DPADD+= ${LIBUTIL}
|
||||
MAN= user.8 useradd.8 userdel.8 usermod.8 userinfo.8 usermgmt.conf.5
|
||||
MAN+= group.8 groupadd.8 groupdel.8 groupmod.8 groupinfo.8
|
||||
MLINKS= useradd.8 adduser.8
|
||||
|
||||
# this target checks the built-in default group, and, if it doesn't exist,
|
||||
# creates it
|
||||
default-group:
|
||||
@ln -fs ${.OBJDIR}/user ${.OBJDIR}/group; \
|
||||
defgrp=`${.OBJDIR}/user add -D | \
|
||||
${TOOL_AWK} '/^group/ { print $$2 }'`; \
|
||||
if ${.OBJDIR}/group info -e $$defgrp; then \
|
||||
defgid=`${.OBJDIR}/group info $$defgrp | \
|
||||
${TOOL_AWK} '/^gid/ { print $$2 }'`; \
|
||||
else \
|
||||
defgid=99; \
|
||||
while [ $$defgid -gt 0 ]; do \
|
||||
${.OBJDIR}/group info -e $$defgid || break; \
|
||||
defgid=`expr $$defgid - 1`; \
|
||||
done; \
|
||||
if [ $$defgid -eq 0 ]; then \
|
||||
defgid=100; \
|
||||
while [ $$defgid -lt 60000 ]; do \
|
||||
${.OBJDIR}/group info -e $$defgid || break; \
|
||||
defgid=`expr $$defgid + 1`; \
|
||||
done; \
|
||||
if [ $$defgid -eq 60000 ]; then \
|
||||
echo "No gids left"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
${.OBJDIR}/group add -g $$defgid $$defgrp; \
|
||||
fi; \
|
||||
echo "Default group is $$defgrp ($$defgid):"; \
|
||||
${.OBJDIR}/group info $$defgrp
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
test: ${PROG}
|
||||
@echo "No news is good news"
|
||||
@echo "1. Adding new user"
|
||||
@rm -f useradd
|
||||
@ln -s user useradd
|
||||
-./useradd -m -g=uid test1.1
|
||||
@echo "2. Modifying new user"
|
||||
-./${PROG} mod -l test1.2 test1.1
|
||||
@echo "3. Deleting new user"
|
||||
-./${PROG} del -r test1.2
|
||||
@echo "4. Attempting to add an invalid user name - IGNORE ANY ERROR"
|
||||
-./${PROG} add -m test1%1
|
||||
@echo "5. Bad usage - IGNORE ANY ERROR"
|
||||
-./${PROG} add -m
|
||||
@echo "6. Set range defaults"
|
||||
-./${PROG} add -D -r4000..6000
|
||||
-./${PROG} add -D
|
||||
@echo "7. Get user information"
|
||||
-./${PROG} info root
|
||||
@echo "8. Bad user name - IGNORE ANY ERROR"
|
||||
-./${PROG} info test1%1 || echo "User not found"
|
||||
@echo "All tests completed"
|
||||
@@ -0,0 +1,59 @@
|
||||
/* $NetBSD: defs.h,v 1.6 2005/11/25 08:00:18 agc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef DEFS_H_
|
||||
#define DEFS_H_
|
||||
|
||||
#define NEWARRAY(type,ptr,size,action) do { \
|
||||
if ((ptr = (type *) calloc(sizeof(type), size)) == (type *) NULL) { \
|
||||
warn("can't allocate %ld bytes", (long)(size * sizeof(type))); \
|
||||
action; \
|
||||
} \
|
||||
} while( /* CONSTCOND */ 0)
|
||||
|
||||
#define RENEW(type,ptr,size,action) do { \
|
||||
if ((ptr = (type *) realloc(ptr, sizeof(type) * size)) == (type *) NULL) { \
|
||||
warn("can't realloc %ld bytes", (long)(size * sizeof(type))); \
|
||||
action; \
|
||||
} \
|
||||
} while( /* CONSTCOND */ 0)
|
||||
|
||||
#define NEW(type, ptr, action) NEWARRAY(type, ptr, 1, action)
|
||||
|
||||
#define FREE(ptr) (void) free(ptr)
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#endif /* !DEFS_H_ */
|
||||
@@ -0,0 +1,89 @@
|
||||
.\" $NetBSD: group.8,v 1.17 2005/11/25 08:00:18 agc Exp $ */
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd November 7, 2005
|
||||
.Dt GROUP 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm group
|
||||
.Nd manage group information on the system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Cm add
|
||||
.Op options
|
||||
.Ar group
|
||||
.Nm
|
||||
.Cm del
|
||||
.Op options
|
||||
.Ar group
|
||||
.Nm
|
||||
.Cm info
|
||||
.Op options
|
||||
.Ar group
|
||||
.Nm
|
||||
.Cm mod
|
||||
.Op options
|
||||
.Ar group
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility acts as a frontend to the
|
||||
.Xr groupadd 8 ,
|
||||
.Xr groupmod 8 ,
|
||||
.Xr groupinfo 8 ,
|
||||
and
|
||||
.Xr groupdel 8
|
||||
commands.
|
||||
The utilities by default are built with
|
||||
.Dv EXTENSIONS .
|
||||
This allows for further functionality.
|
||||
.Pp
|
||||
For a full explanation of the options available, please see the relevant manual page.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std group
|
||||
.Sh SEE ALSO
|
||||
.Xr group 5 ,
|
||||
.Xr groupadd 8 ,
|
||||
.Xr groupdel 8 ,
|
||||
.Xr groupinfo 8 ,
|
||||
.Xr groupmod 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
@@ -0,0 +1,87 @@
|
||||
.\" $NetBSD: groupadd.8,v 1.17 2006/05/29 01:38:33 hubertf Exp $ */
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd November 7, 2005
|
||||
.Dt GROUPADD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm groupadd
|
||||
.Nd add a group to the system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl ov
|
||||
.Op Fl g Ar gid
|
||||
.Op Fl r Ar lowgid Ns Li .. Ns Ar highgid
|
||||
.Ar group
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility adds a group to the system.
|
||||
See
|
||||
.Xr group 8
|
||||
for more information about
|
||||
.Dv EXTENSIONS .
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl g Ar gid
|
||||
Give the numeric group identifier to be used for the new group.
|
||||
.It Fl o
|
||||
Allow the new group to have a gid which is already in use for
|
||||
another group.
|
||||
.It Fl r Ar lowgid Ns Li .. Ns Ar highgid
|
||||
Set the low and high bounds of a gid range for new groups.
|
||||
A new group can only be created if there are gids which can be
|
||||
assigned inside the range.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl v
|
||||
Enable verbose mode - explain the commands as they are executed.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std groupadd
|
||||
.Sh SEE ALSO
|
||||
.Xr group 5 ,
|
||||
.Xr group 8 ,
|
||||
.Xr user 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
@@ -0,0 +1,74 @@
|
||||
.\" $NetBSD: groupdel.8,v 1.14 2006/05/29 01:38:33 hubertf Exp $ */
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd November 7, 2005
|
||||
.Dt GROUPDEL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm groupdel
|
||||
.Nd remove a group from the system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl v
|
||||
.Ar group
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility removes a group from the system.
|
||||
See
|
||||
.Xr group 8
|
||||
for more information about
|
||||
.Dv EXTENSIONS .
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl v
|
||||
Enable verbose mode - explain the commands as they are executed.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std groupdel
|
||||
.Sh SEE ALSO
|
||||
.Xr group 5 ,
|
||||
.Xr group 8 ,
|
||||
.Xr user 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
@@ -0,0 +1,90 @@
|
||||
.\" $NetBSD: groupinfo.8,v 1.12 2006/05/29 01:38:33 hubertf Exp $ */
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd November 7, 2005
|
||||
.Dt GROUPINFO 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm groupinfo
|
||||
.Nd displays group information
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl ev
|
||||
.Ar group
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility retrieves the group information from the system.
|
||||
The
|
||||
.Nm
|
||||
utility is only available if built with
|
||||
.Dv EXTENSIONS .
|
||||
See
|
||||
.Xr group 8
|
||||
for more information.
|
||||
.Pp
|
||||
The following command line options are recognised:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl e
|
||||
Return 0 if the group exists, and non-zero if the
|
||||
group does not exist, on the system.
|
||||
No information is displayed.
|
||||
This form of the command is useful for
|
||||
scripts which need to check whether a particular group
|
||||
name or gid is already in use on the system.
|
||||
.It Fl v
|
||||
Perform any actions in a verbose manner.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Ar group
|
||||
argument may either be a group's name, or a gid.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std groupinfo
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/usermgmt.conf -compact
|
||||
.It Pa /etc/usermgmt.conf
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr passwd 5 ,
|
||||
.Xr group 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
@@ -0,0 +1,83 @@
|
||||
.\" $NetBSD: groupmod.8,v 1.14 2005/11/25 08:00:18 agc Exp $ */
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd November 7, 2005
|
||||
.Dt GROUPMOD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm groupmod
|
||||
.Nd modify an existing group on the system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl ov
|
||||
.Op Fl g Ar gid
|
||||
.Op Fl n Ar newname
|
||||
.Ar group
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility modifies an existing group on the system.
|
||||
See
|
||||
.Xr group 8
|
||||
for more information about
|
||||
.Dv EXTENSIONS .
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl g Ar gid
|
||||
Give the numeric group identifier to be used for the new group.
|
||||
.It Fl n Ar new-group-name
|
||||
Give the new name which the group shall have.
|
||||
.It Fl o
|
||||
Allow the new group to have a gid which is already in use for
|
||||
another group.
|
||||
.It Fl v
|
||||
Enable verbose mode - explain the commands as they are executed.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std groupmod
|
||||
.Sh SEE ALSO
|
||||
.Xr group 5 ,
|
||||
.Xr group 8 ,
|
||||
.Xr user 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
@@ -0,0 +1,99 @@
|
||||
/* $NetBSD: main.c,v 1.5 2006/10/22 21:16:58 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "usermgmt.h"
|
||||
|
||||
enum {
|
||||
MaxCmdWords = 2
|
||||
};
|
||||
|
||||
/* this struct describes a command */
|
||||
typedef struct cmd_t {
|
||||
int c_wc; /* word count */
|
||||
const char *c_word[MaxCmdWords]; /* command words */
|
||||
int (*c_func)(int, char **); /* called function */
|
||||
} cmd_t;
|
||||
|
||||
/* despatch table for commands */
|
||||
static cmd_t cmds[] = {
|
||||
{ 1, { "useradd", NULL }, useradd },
|
||||
{ 2, { "user", "add" }, useradd },
|
||||
{ 1, { "usermod", NULL }, usermod },
|
||||
{ 2, { "user", "mod" }, usermod },
|
||||
{ 1, { "userdel", NULL }, userdel },
|
||||
{ 2, { "user", "del" }, userdel },
|
||||
#ifdef EXTENSIONS
|
||||
{ 1, { "userinfo", NULL }, userinfo },
|
||||
{ 2, { "user", "info" }, userinfo },
|
||||
#endif
|
||||
{ 1, { "groupadd", NULL }, groupadd },
|
||||
{ 2, { "group", "add" }, groupadd },
|
||||
{ 1, { "groupmod", NULL }, groupmod },
|
||||
{ 2, { "group", "mod" }, groupmod },
|
||||
{ 1, { "groupdel", NULL }, groupdel },
|
||||
{ 2, { "group", "del" }, groupdel },
|
||||
#ifdef EXTENSIONS
|
||||
{ 1, { "groupinfo", NULL }, groupinfo },
|
||||
{ 2, { "group", "info" }, groupinfo },
|
||||
#endif
|
||||
{ .c_wc = 0 }
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
cmd_t *cmdp;
|
||||
int matched;
|
||||
int i;
|
||||
|
||||
for (cmdp = cmds ; cmdp->c_wc > 0 ; cmdp++) {
|
||||
for (matched = i = 0 ; i < cmdp->c_wc && i < MaxCmdWords ; i++) {
|
||||
if (argc > i) {
|
||||
if (strcmp((i == 0) ? getprogname() : argv[i],
|
||||
cmdp->c_word[i]) == 0) {
|
||||
matched += 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (matched == cmdp->c_wc) {
|
||||
return (*cmdp->c_func)(argc - (matched - 1), argv + (matched - 1));
|
||||
}
|
||||
}
|
||||
usermgmt_usage(getprogname());
|
||||
errx(EXIT_FAILURE, "Program `%s' not recognised", getprogname());
|
||||
/* NOTREACHED */
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
chown: /home/test1.1/.ashrc: invalid argument
|
||||
chown: /home/test1.1/.ellepro.b1: invalid argument
|
||||
chown: /home/test1.1/.ellepro.e: invalid argument
|
||||
chown: /home/test1.1/.exrc: invalid argument
|
||||
chown: /home/test1.1/.profile: invalid argument
|
||||
chown: /home/test1.1: invalid argument
|
||||
useradd: Error running `/usr/sbin/chown -R -h 4000:4000 /home/test1.1': no such file or directory
|
||||
user: User `test1.2' doesn't own directory `/home/test1.1', not removed
|
||||
user: Can't add user `test1%1': invalid login name
|
||||
usage: useradd -D [-F] [-b base-dir] [-e expiry-time] [-f inactive-time]
|
||||
[-g gid | name | =uid] [-k skel-dir] [-L login-class]
|
||||
[-M homeperm] [-r lowuid..highuid] [-s shell]
|
||||
usage: useradd [-moSv] [-b base-dir] [-c comment] [-d home-dir] [-e expiry-time]
|
||||
[-f inactive-time] [-G secondary-group] [-g gid | name | =uid]
|
||||
[-k skeletondir] [-L login-class] [-M homeperm] [-p password]
|
||||
[-r lowuid..highuid] [-s shell] [-u uid] user
|
||||
user: Can't find user `test1%1'
|
||||
@@ -0,0 +1,115 @@
|
||||
.\" $NetBSD: user.8,v 1.23 2005/11/25 08:00:18 agc Exp $ */
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd November 16, 2005
|
||||
.Dt USER 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm user
|
||||
.Nd manage user login information on the system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Cm add
|
||||
.Fl D
|
||||
.Op options
|
||||
.Nm
|
||||
.Cm add
|
||||
.Op options
|
||||
.Ar user
|
||||
.Nm
|
||||
.Cm del
|
||||
.Fl D
|
||||
.Op options
|
||||
.Nm
|
||||
.Cm del
|
||||
.Op options
|
||||
.Ar user
|
||||
.Nm
|
||||
.Cm info
|
||||
.Op options
|
||||
.Ar user
|
||||
.Nm
|
||||
.Cm mod
|
||||
.Op options
|
||||
.Ar user
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility acts as a frontend to the
|
||||
.Xr useradd 8 ,
|
||||
.Xr usermod 8 ,
|
||||
.Xr userinfo 8 ,
|
||||
and
|
||||
.Xr userdel 8
|
||||
commands.
|
||||
The utilities by default are built with
|
||||
.Dv EXTENSIONS .
|
||||
This allows for further functionality.
|
||||
.Pp
|
||||
For a full explanation of the options available, please see the relevant manual page.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std user
|
||||
.Sh FILES
|
||||
.Bl -tag -width /usr/share/examples/usermgmt -compact
|
||||
.It Pa /etc/skel/.[A-z]*
|
||||
Skeleton files for new user
|
||||
.It Pa /etc/usermgmt.conf
|
||||
Configuration file for
|
||||
.Nm ,
|
||||
.Xr group 8
|
||||
and the backend commands mentioned above.
|
||||
.\" .It Pa /usr/share/examples/usermgmt
|
||||
.\" A directory containing examples for
|
||||
.\" .Nm
|
||||
.\" and
|
||||
.\" .Xr group 8 .
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr chpass 1 ,
|
||||
.Xr group 5 ,
|
||||
.Xr passwd 5 ,
|
||||
.Xr usermgmt.conf 5 ,
|
||||
.Xr useradd 8 ,
|
||||
.Xr userdel 8 ,
|
||||
.Xr userinfo 8 ,
|
||||
.Xr usermod 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,318 @@
|
||||
.\" $NetBSD: useradd.8,v 1.42 2009/01/14 02:18:28 reed Exp $ */
|
||||
.\"
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd January 13, 2009
|
||||
.Dt USERADD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm useradd
|
||||
.Nd add a user to the system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Fl D
|
||||
.Op Fl F
|
||||
.Op Fl b Ar base-dir
|
||||
.Op Fl e Ar expiry-time
|
||||
.Op Fl f Ar inactive-time
|
||||
.Op Fl g Ar gid | name | Li =uid
|
||||
.Op Fl k Ar skel-dir
|
||||
.Op Fl L Ar login-class
|
||||
.Op Fl M Ar home-perm
|
||||
.Op Fl r Ar lowuid Ns Li .. Ns Ar highuid
|
||||
.Op Fl s Ar shell
|
||||
.Nm
|
||||
.Op Fl moSv
|
||||
.Op Fl b Ar base-dir
|
||||
.Op Fl c Ar comment
|
||||
.Op Fl d Ar home-dir
|
||||
.Op Fl e Ar expiry-time
|
||||
.Op Fl f Ar inactive-time
|
||||
.Op Fl G Ar secondary-group
|
||||
.Op Fl g Ar gid | name | Li =uid
|
||||
.Op Fl k Ar skel-dir
|
||||
.Op Fl L Ar login-class
|
||||
.Op Fl M Ar home-perm
|
||||
.Op Fl p Ar password
|
||||
.Op Fl r Ar lowuid Ns Li .. Ns Ar highuid
|
||||
.Op Fl s Ar shell
|
||||
.Op Fl u Ar uid
|
||||
.Ar user
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm useradd
|
||||
utility adds a user to the system, creating and
|
||||
populating a home directory if necessary.
|
||||
Any skeleton files will be provided
|
||||
for the new user if they exist in the
|
||||
.Ar skel-dir
|
||||
directory (see the
|
||||
.Fl k
|
||||
option).
|
||||
Default values for
|
||||
the base directory,
|
||||
the time of password expiry,
|
||||
the time of account expiry,
|
||||
primary group,
|
||||
the skeleton directory,
|
||||
the range from which the uid will be allocated,
|
||||
and default login shell
|
||||
can be provided in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file, which, if running as root, is created using the built-in defaults if
|
||||
it does not exist.
|
||||
.Pp
|
||||
The first form of the command shown above (using the
|
||||
.Fl D
|
||||
option)
|
||||
sets and displays the defaults for the
|
||||
.Nm
|
||||
utility.
|
||||
.Pp
|
||||
See
|
||||
.Xr user 8
|
||||
for more information about
|
||||
.Dv EXTENSIONS .
|
||||
.Bl -tag -width Ds
|
||||
.It Fl b Ar base-dir
|
||||
Set the default base directory.
|
||||
This is the directory to which the
|
||||
user directory is added, which will be created if the
|
||||
.Fl m
|
||||
option is specified and no
|
||||
.Fl d
|
||||
option is specified.
|
||||
.It Fl D
|
||||
without any further options,
|
||||
.Fl D
|
||||
will show the current defaults which
|
||||
will be used by the
|
||||
.Nm
|
||||
utility.
|
||||
Together with one of the options shown for the first version
|
||||
of the command,
|
||||
.Fl D
|
||||
will set the default to be the new value.
|
||||
See
|
||||
.Xr usermgmt.conf 5
|
||||
for more information.
|
||||
.It Fl e Ar expiry-time
|
||||
Set the time at which the new user accounts will expire.
|
||||
It should be entered in the form
|
||||
.Dq month day year ,
|
||||
where month is the month name (the first three characters are
|
||||
sufficient), day is the day of the month, and year is the year.
|
||||
Time in seconds since the epoch (UTC) is also valid.
|
||||
A value of 0 can be used to disable this feature.
|
||||
.It Fl F
|
||||
Force the user to change their password upon next login.
|
||||
.It Fl f Ar inactive-time
|
||||
Set the time at which passwords for the new user accounts will
|
||||
expire.
|
||||
Also see the
|
||||
.Fl e
|
||||
option above.
|
||||
.It Fl g Ar gid | groupname | Li =uid
|
||||
Set the default group for new users.
|
||||
.It Fl k Ar skel-dir
|
||||
Set the skeleton directory in which to find files with
|
||||
which to populate new users' home directories.
|
||||
.It Fl L Ar login-class
|
||||
Set the default login class for new users.
|
||||
See
|
||||
.Xr login.conf 5
|
||||
for more information on user login classes.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl M Ar home-perm
|
||||
sets the default permissions of the newly created home directory if
|
||||
.Fl m
|
||||
is given.
|
||||
The permission is specified as an octal number, with or without a leading zero.
|
||||
.It Fl r Ar lowuid Ns Li .. Ns Ar highuid
|
||||
Set the low and high bounds of uid ranges for new users.
|
||||
A new user can only be created if there are uids which can be
|
||||
assigned from one of the free ranges.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl s Ar shell
|
||||
Set the default login shell for new users.
|
||||
.El
|
||||
.Pp
|
||||
In the second form of the command,
|
||||
after setting any defaults, and then reading values from
|
||||
.Pa /etc/usermgmt.conf ,
|
||||
the following command line options are processed:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl b Ar base-directory
|
||||
Set the base directory name, in which the user's new home
|
||||
directory will be created, should the
|
||||
.Fl m
|
||||
option be specified.
|
||||
.It Fl c Ar comment
|
||||
Set the comment field (also, for historical reasons known as the
|
||||
GECOS field) which will be added for the user, and typically will include
|
||||
the user's full name, and, perhaps, contact information for the user.
|
||||
.It Fl d Ar home-directory
|
||||
Set the home directory which will be created and populated for the user,
|
||||
should the
|
||||
.Fl m
|
||||
option be specified.
|
||||
.It Fl e Ar expiry-time
|
||||
Set the time at which the current password will expire for new
|
||||
users.
|
||||
It should be entered in the form
|
||||
.Dq month day year ,
|
||||
where month is the month name (the first three characters are
|
||||
sufficient), day is the day of the month, and year is the year.
|
||||
Time in seconds since the epoch (UTC) is also valid.
|
||||
A value of 0 can be used to disable this feature.
|
||||
See
|
||||
.Xr passwd 5
|
||||
for more details.
|
||||
.It Fl f Ar inactive-time
|
||||
Set the time at which new user accounts will expire.
|
||||
Also see the
|
||||
.Fl e
|
||||
option above.
|
||||
.It Fl G Ar secondary-group
|
||||
Add the user to the secondary group
|
||||
.Ar secondary-group
|
||||
in the
|
||||
.Pa /etc/group
|
||||
file.
|
||||
The
|
||||
.Ar secondary-group
|
||||
may be a comma-delimited list for multiple groups.
|
||||
Or the option may be repeated for multiple groups.
|
||||
(16 groups maximum.)
|
||||
.It Fl g Ar gid | name | Li =uid
|
||||
Give the group name or identifier to be used for the new user's primary group.
|
||||
If this is
|
||||
.Ql =uid ,
|
||||
then a uid and gid will be picked which are both unique
|
||||
and the same, and a line added to
|
||||
.Pa /etc/group
|
||||
to describe the new group.
|
||||
.It Fl k Ar skeleton directory
|
||||
Give the skeleton directory in which to find files
|
||||
with which to populate the new user's home directory.
|
||||
.It Fl L Ar login-class
|
||||
Set the login class for the user being created.
|
||||
See
|
||||
.Xr login.conf 5
|
||||
for more information on user login classes.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl M Ar home-perm
|
||||
sets the permissions of the newly created home directory if
|
||||
.Fl m
|
||||
is given.
|
||||
The permission is specified as an octal number, with or without a leading zero.
|
||||
.It Fl m
|
||||
Create a new home directory for the new user.
|
||||
.It Fl o
|
||||
Allow the new user to have a uid which is already in use for another user.
|
||||
.It Fl p Ar password
|
||||
Specify an already-encrypted password for the new user.
|
||||
Encrypted passwords can be generated with
|
||||
.Xr pwhash 1 .
|
||||
The password can be changed later by using
|
||||
.Xr chpass 1
|
||||
or
|
||||
.Xr passwd 1 .
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl S
|
||||
Allow samba user names with a trailing dollar sign to be
|
||||
added to the system.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl s Ar shell
|
||||
Specify the login shell for the new user.
|
||||
.It Fl u Ar uid
|
||||
Specify a uid for the new user.
|
||||
Boundaries for this value can be preset for all users
|
||||
by using the
|
||||
.Ar range
|
||||
field in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file.
|
||||
.It Fl v
|
||||
Enable verbose mode - explain the commands as they are executed.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.El
|
||||
.Pp
|
||||
Once the information has been verified,
|
||||
.Nm
|
||||
uses
|
||||
.Xr pwd_mkdb 8
|
||||
to update the user database.
|
||||
This is run in the background, and,
|
||||
at very large sites could take several minutes.
|
||||
Until this update
|
||||
is completed, the password file is unavailable for other updates
|
||||
and the new information is not available to programs.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std useradd
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/usermgmt.conf -compact
|
||||
.It Pa /etc/usermgmt.conf
|
||||
.It Pa /etc/skel/*
|
||||
.It Pa /etc/login.conf
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr chpass 1 ,
|
||||
.Xr passwd 1 ,
|
||||
.Xr pwhash 1 ,
|
||||
.Xr group 5 ,
|
||||
.Xr login.conf 5 ,
|
||||
.Xr passwd 5 ,
|
||||
.Xr usermgmt.conf 5 ,
|
||||
.Xr pwd_mkdb 8 ,
|
||||
.Xr user 8 ,
|
||||
.Xr userdel 8 ,
|
||||
.Xr usermod 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
.Pp
|
||||
Support for setting permissions of home directories was added by Hubert Feyrer.
|
||||
@@ -0,0 +1,168 @@
|
||||
.\" $NetBSD: userdel.8,v 1.32 2006/05/29 01:38:33 hubertf Exp $ */
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd November 16, 2005
|
||||
.Dt USERDEL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm userdel
|
||||
.Nd remove a user from the system
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Fl D
|
||||
.Op Fl p Ar preserve-value
|
||||
.Nm
|
||||
.Op Fl rSv
|
||||
.Op Fl p Ar preserve-value
|
||||
.Ar user
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility removes a user from the system, optionally
|
||||
removing that user's home directory and any subdirectories.
|
||||
.Pp
|
||||
Default values are taken from the information provided in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file, which, if running as root, is created using the built-in
|
||||
defaults if it does not exist.
|
||||
.Pp
|
||||
The first form of the command shown above (using the
|
||||
.Fl D
|
||||
option) sets and displays the defaults for the
|
||||
.Nm
|
||||
utility.
|
||||
.Pp
|
||||
See
|
||||
.Xr user 8
|
||||
for more information about
|
||||
.Dv EXTENSIONS .
|
||||
.Bl -tag -width Ds
|
||||
.It Fl D
|
||||
Without any further options,
|
||||
.Fl D
|
||||
will show the current defaults which will be used by the
|
||||
.Nm
|
||||
utility.
|
||||
Together with one of the options shown for the first version
|
||||
of the command,
|
||||
.Fl D
|
||||
will set the default to be the new value.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl p Ar preserve-value
|
||||
Set the preservation value.
|
||||
If this value is one of
|
||||
.Ql true ,
|
||||
.Ql yes ,
|
||||
or a non-zero number, then the user login information will be
|
||||
preserved.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.El
|
||||
.Pp
|
||||
In the second form of the command,
|
||||
after setting any defaults, and then reading values from
|
||||
.Pa /etc/usermgmt.conf ,
|
||||
the following command line options are processed:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl p Ar preserve-value
|
||||
Preserve the user information in the password file,
|
||||
but do not allow the user to login, by switching the
|
||||
password to an
|
||||
.Dq impossible
|
||||
one, and by setting the user's shell to the
|
||||
.Xr nologin 8
|
||||
program.
|
||||
This option can be helpful in preserving a user's
|
||||
files for later use by members of that person's
|
||||
group after the user has moved on.
|
||||
This value can also be set in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file, using the
|
||||
.Ql preserve
|
||||
field.
|
||||
If the field has any of the values
|
||||
.Ql true ,
|
||||
.Ql yes ,
|
||||
or a non-zero number, then user information preservation will take
|
||||
place.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl r
|
||||
Remove the user's home directory, any subdirectories,
|
||||
and any files and other entries in them.
|
||||
.It Fl S
|
||||
Allow a samba user name (with a trailing dollar sign)
|
||||
to be deleted.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl v
|
||||
Perform any actions in a verbose manner.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.El
|
||||
.Pp
|
||||
Once the information has been verified,
|
||||
.Nm
|
||||
uses
|
||||
.Xr pwd_mkdb 8
|
||||
to update the user database.
|
||||
This is run in the background, and,
|
||||
at very large sites could take several minutes.
|
||||
Until this update
|
||||
is completed, the password file is unavailable for other updates
|
||||
and the new information is not available to programs.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std userdel
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/usermgmt.conf -compact
|
||||
.It Pa /etc/usermgmt.conf
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr passwd 5 ,
|
||||
.Xr usermgmt.conf 5 ,
|
||||
.Xr group 8 ,
|
||||
.Xr nologin 8 ,
|
||||
.Xr pwd_mkdb 8 ,
|
||||
.Xr user 8 ,
|
||||
.Xr useradd 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
@@ -0,0 +1,87 @@
|
||||
.\" $NetBSD: userinfo.8,v 1.15 2008/02/27 19:12:56 reed Exp $ */
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd November 16, 2005
|
||||
.Dt USERINFO 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm userinfo
|
||||
.Nd displays user information
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl e
|
||||
.Ar user
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility retrieves the user information from the system.
|
||||
The
|
||||
.Nm
|
||||
utility is only available if built with
|
||||
.Dv EXTENSIONS .
|
||||
See
|
||||
.Xr user 8
|
||||
for more information.
|
||||
.Pp
|
||||
The following command line option is recognised:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl e
|
||||
Return 0 if the user exists, and non-zero if the
|
||||
user does not exist, on the system.
|
||||
No information is displayed.
|
||||
This form of the command is useful for
|
||||
scripts which need to check whether a particular user
|
||||
name or uid is already in use on the system.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
.Ar user
|
||||
argument may either be a user's name, or a uid.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std userinfo
|
||||
.Sh SEE ALSO
|
||||
.Xr passwd 5 ,
|
||||
.Xr group 8 ,
|
||||
.Xr user 8 ,
|
||||
.Xr useradd 8 ,
|
||||
.Xr userdel 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
@@ -0,0 +1,155 @@
|
||||
.\" $NetBSD: usermgmt.conf.5,v 1.7 2009/12/31 20:14:19 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This document is derived from works contributed to The NetBSD Foundation
|
||||
.\" by Grant Beattie.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd December 31, 2009
|
||||
.Dt USERMGMT.CONF 5
|
||||
.Os
|
||||
.\" turn off hyphenation
|
||||
.hym 999
|
||||
.Sh NAME
|
||||
.Nm usermgmt.conf
|
||||
.Nd user management tools configuration file
|
||||
.Sh SYNOPSIS
|
||||
.Nm usermgmt.conf
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm usermgmt.conf
|
||||
file defines the default values used by the user management tools,
|
||||
.Xr useradd 8
|
||||
and friends.
|
||||
.Pp
|
||||
Options in this file can be set by manually editing
|
||||
.Pa /etc/usermgmt.conf
|
||||
or using the
|
||||
.Fl D
|
||||
option to
|
||||
.Xr useradd 8 .
|
||||
.Pp
|
||||
.Bl -tag -width preserveX
|
||||
.It Ic base_dir
|
||||
sets the base directory name, in which new users' home directories
|
||||
are created when using the
|
||||
.Fl m
|
||||
option to
|
||||
.Xr useradd 8 .
|
||||
.It Ic class
|
||||
sets the default login class for new users.
|
||||
See
|
||||
.Xr login.conf 5
|
||||
for more information on user login classes.
|
||||
.It Ic expire
|
||||
sets the default time at which the current password expires.
|
||||
This can be used to implement password aging.
|
||||
Both the
|
||||
.Ar expire
|
||||
and
|
||||
.Ar inactive
|
||||
fields should be entered in the form
|
||||
.Dq month day year ,
|
||||
where month is the month name (the first three characters are
|
||||
sufficient), day is the day of the month, and year is the year.
|
||||
Time in seconds since the epoch (UTC) is also valid.
|
||||
A value of 0 can be used to disable this feature.
|
||||
.It Ic group
|
||||
sets the default primary group for new users.
|
||||
If this is
|
||||
.Ql =uid ,
|
||||
then a uid and gid will be picked which are both unique
|
||||
and the same, and a line will be added to
|
||||
.Pa /etc/group
|
||||
to describe the new group.
|
||||
It has the format:
|
||||
.br
|
||||
.Bd -ragged -offset indent -compact
|
||||
.Ic group
|
||||
.Ar gid | name | Li =uid
|
||||
.Ed
|
||||
.It Ic homeperm
|
||||
sets the default permissions of the newly created home directory if
|
||||
.Fl m
|
||||
is given to
|
||||
.Xr useradd 8 .
|
||||
The permission is specified as an octal number, with or without a leading zero.
|
||||
.It Ic inactive
|
||||
sets the default time at which new accounts expire.
|
||||
A value of 0 can be used to disable this feature.
|
||||
Also see the
|
||||
.Ar expire
|
||||
field.
|
||||
.It Ic password
|
||||
specifies an already-encrypted default password.
|
||||
.It Ic preserve
|
||||
If this value is one of
|
||||
.Ql true ,
|
||||
.Ql yes ,
|
||||
or a non-zero number, then the user login information will be
|
||||
preserved when removing a user with
|
||||
.Xr userdel 8 .
|
||||
.It Ic range
|
||||
specifies the uid boundaries for new users.
|
||||
If unspecified, the default is
|
||||
.Dq 1000..60000 .
|
||||
It has the format:
|
||||
.Bd -unfilled -offset indent -compact
|
||||
.Ic range Ar starting-uid Ns Li .. Ns Ar ending-uid
|
||||
.Ed
|
||||
.It Ic gid_range
|
||||
specifies the gid boundaries for new groups.
|
||||
If unspecified, the default is
|
||||
.Dq 1000..60000 .
|
||||
It has the format:
|
||||
.Bd -unfilled -offset indent -compact
|
||||
.Ic gid_range Ar starting-gid Ns Li .. Ns Ar ending-gid
|
||||
.Ed
|
||||
.It Ic shell
|
||||
sets the default login shell for new users.
|
||||
.It Ic skel_dir
|
||||
sets the default skeleton directory in which to find files
|
||||
with which to populate the new user's home directory.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/usermgmt.conf -compact
|
||||
.It Pa /etc/usermgmt.conf
|
||||
.It Pa /etc/skel/*
|
||||
.It Pa /etc/login.conf
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr login.conf 5 ,
|
||||
.Xr passwd 5 ,
|
||||
.Xr user 8 ,
|
||||
.Xr useradd 8 ,
|
||||
.Xr userdel 8 ,
|
||||
.Xr usermod 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
configuration file first appeared in
|
||||
.Nx 1.5 .
|
||||
@@ -0,0 +1,47 @@
|
||||
/* $NetBSD: usermgmt.h,v 1.8 2005/11/25 08:00:18 agc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef USERMGMT_H_
|
||||
#define USERMGMT_H_
|
||||
|
||||
int useradd(int, char **);
|
||||
int usermod(int, char **);
|
||||
int userdel(int, char **);
|
||||
int groupadd(int, char **);
|
||||
int groupdel(int, char **);
|
||||
int groupmod(int, char **);
|
||||
|
||||
#ifdef EXTENSIONS
|
||||
int userinfo(int, char **);
|
||||
int groupinfo(int, char **);
|
||||
#endif
|
||||
|
||||
void usermgmt_usage(const char *);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,259 @@
|
||||
.\" $NetBSD: usermod.8,v 1.32 2009/03/11 17:54:03 dyoung Exp $ */
|
||||
.\"
|
||||
.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote
|
||||
.\" products derived from this software without specific prior written
|
||||
.\" permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd January 13, 2009
|
||||
.Dt USERMOD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm usermod
|
||||
.Nd modify user login information
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl FmoSv
|
||||
.Op Fl C Ar yes/no
|
||||
.Op Fl c Ar comment
|
||||
.Op Fl d Ar home-dir
|
||||
.Op Fl e Ar expiry-time
|
||||
.Op Fl f Ar inactive-time
|
||||
.Op Fl G Ar secondary-group
|
||||
.Op Fl g Ar gid | name | Li =uid
|
||||
.Op Fl L Ar login-class
|
||||
.Op Fl l Ar new-login
|
||||
.Op Fl p Ar password
|
||||
.Op Fl s Ar shell
|
||||
.Op Fl u Ar uid
|
||||
.Ar user
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility modifies user login information on the system.
|
||||
.Pp
|
||||
Default values are taken from the information provided in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file, which, if running as root, is created using the built-in defaults if
|
||||
it does not exist.
|
||||
.Pp
|
||||
See
|
||||
.Xr user 8
|
||||
for more information about
|
||||
.Dv EXTENSIONS .
|
||||
.Pp
|
||||
After setting any defaults, and then reading values from
|
||||
.Pa /etc/usermgmt.conf ,
|
||||
the following command line options are processed:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl C Ar yes/no
|
||||
Enable user accounts to be temporary locked/closed.
|
||||
The
|
||||
.Ar yes/no
|
||||
operand can be given as
|
||||
.Dq Ar yes
|
||||
to lock the account or
|
||||
.Dq Ar no
|
||||
to unlock the account.
|
||||
.It Fl c Ar comment
|
||||
Set the comment field (also, for historical reasons known as the
|
||||
GECOS field) for the user.
|
||||
The comment field will typically include
|
||||
the user's full name and, perhaps, contact information for the user.
|
||||
.It Fl d Ar home-directory
|
||||
Set the home directory without populating it; if the
|
||||
.Fl m
|
||||
option is specified, tries to move the old home directory to
|
||||
.Ar home-directory .
|
||||
.It Fl e Ar expiry-time
|
||||
Set the time at which the account expires.
|
||||
This can be used to implement password aging.
|
||||
It should be entered in the form
|
||||
.Dq month day year ,
|
||||
where month is the month name (the first three characters are
|
||||
sufficient), day is the day of the month, and year is the year.
|
||||
Time in seconds since the epoch (UTC) is also valid.
|
||||
A value of 0 can be used to disable this feature.
|
||||
This value can be preset for all users using the
|
||||
.Ar expire
|
||||
field in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file.
|
||||
See
|
||||
.Xr usermgmt.conf 5
|
||||
for more details.
|
||||
.It Fl F
|
||||
Force the user to change their password upon next login.
|
||||
.It Fl f Ar inactive-time
|
||||
Set the time at which the password expires.
|
||||
See the
|
||||
.Fl e
|
||||
option.
|
||||
.It Fl G Ar secondary-group
|
||||
Specify a secondary group to which the user will be added in the
|
||||
.Pa /etc/group
|
||||
file.
|
||||
The
|
||||
.Ar secondary-group
|
||||
may be a comma-delimited list for multiple groups.
|
||||
Or the option may be repeated for multiple groups.
|
||||
(16 groups maximum.)
|
||||
.It Fl g Ar gid | name | Li =uid
|
||||
Give the group name or identifier to be used for the user's primary group.
|
||||
If this is
|
||||
.Ql =uid ,
|
||||
then a uid and gid will be picked which are both unique
|
||||
and the same, and a line will be added to
|
||||
.Pa /etc/group
|
||||
to describe the new group.
|
||||
This value can be preset for all users by using the
|
||||
.Ar group
|
||||
field in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file.
|
||||
See
|
||||
.Xr usermgmt.conf 5
|
||||
for more details.
|
||||
.It Fl L Ar login-class
|
||||
Set the login class for the user.
|
||||
See
|
||||
.Xr login.conf 5
|
||||
for more information on user login classes.
|
||||
This value can be preset for all users by using the
|
||||
.Ar class
|
||||
field in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file.
|
||||
See
|
||||
.Xr usermgmt.conf 5
|
||||
for more details.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl l Ar new-user
|
||||
Give the new user name.
|
||||
It can consist of alphanumeric characters and the characters
|
||||
.Ql \&. ,
|
||||
.Ql \&- ,
|
||||
and
|
||||
.Ql \&_ .
|
||||
.It Fl m
|
||||
Move the home directory from its old position to the new one.
|
||||
If
|
||||
.Fl d
|
||||
is not specified, the
|
||||
.Ar new-user
|
||||
argument of the
|
||||
.Fl l
|
||||
option is used; one of
|
||||
.Fl d
|
||||
and
|
||||
.Fl l
|
||||
is needed.
|
||||
.It Fl o
|
||||
Allow duplicate uids to be given.
|
||||
.It Fl p Ar password
|
||||
Specify an already-encrypted password for the user.
|
||||
This password can then be changed by using the
|
||||
.Xr chpass 1
|
||||
utility.
|
||||
This value can be preset for all users by using the
|
||||
.Ar password
|
||||
field in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file.
|
||||
See
|
||||
.Xr usermgmt.conf 5
|
||||
for more details.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl S
|
||||
Allow samba user names with a trailing dollar sign to be modified.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.It Fl s Ar shell
|
||||
Specify the login shell for the user.
|
||||
This value can be preset for all users by using the
|
||||
.Ar shell
|
||||
field in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file.
|
||||
See
|
||||
.Xr usermgmt.conf 5
|
||||
for more details.
|
||||
.It Fl u Ar uid
|
||||
Specify a new uid for the user.
|
||||
Boundaries for this value can be preset for all users by using the
|
||||
.Ar range
|
||||
field in the
|
||||
.Pa /etc/usermgmt.conf
|
||||
file.
|
||||
See
|
||||
.Xr usermgmt.conf 5
|
||||
for more details.
|
||||
.It Fl v
|
||||
Enable verbose mode - explain the commands as they are executed.
|
||||
This option is included if built with
|
||||
.Dv EXTENSIONS .
|
||||
.El
|
||||
.Pp
|
||||
Once the information has been verified,
|
||||
.Nm
|
||||
uses
|
||||
.Xr pwd_mkdb 8
|
||||
to update the user database.
|
||||
This is run in the background.
|
||||
At very large sites this can take several minutes.
|
||||
Until this update
|
||||
is completed, the password file is unavailable for other updates
|
||||
and the new information is not available to programs.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std usermod
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/usermgmt.conf -compact
|
||||
.It Pa /etc/usermgmt.conf
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr chpass 1 ,
|
||||
.Xr group 5 ,
|
||||
.Xr passwd 5 ,
|
||||
.Xr usermgmt.conf 5 ,
|
||||
.Xr pwd_mkdb 8 ,
|
||||
.Xr user 8 ,
|
||||
.Xr useradd 8 ,
|
||||
.Xr userdel 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility first appeared in
|
||||
.Nx 1.5 .
|
||||
It is based on the
|
||||
.Ar addnerd
|
||||
package by the same author.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility was written by
|
||||
.An Alistair G. Crooks
|
||||
.Aq agc@NetBSD.org .
|
||||
Reference in New Issue
Block a user