Commit Graph

214 Commits

Author SHA1 Message Date
Mike Karels
0b39b2e2dd adduser: create dataset only if home is directly within dataset
Currently, if the prefix of the new home directory is a subdirectory
of a ZFS dataset, adduser will create a new dataset up one or more
levels from the intended destination.  "pw useradd" will then create
a normal directory in the desired location, leaving an unused dataset.
Check for this situation when determining whether to create a dataset,
and let pw create the directory.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D45229
MFC after:	3 days
2024-05-20 08:43:34 -05:00
Dag-Erling Smørgrav
46a619c6d4 adduser: Additional variable fixes.
One function used `_input` without making it local, causing its value to
leak into other functions.  This broke the `-f` case.  Fix that instance
and initialize all local variables that weren't already initialized.

Fixes:		170d088290
MFC after:	3 days
Reviewed by:	karels
Differential Revision:	https://reviews.freebsd.org/D45204
2024-05-15 14:13:49 +02:00
Dag-Erling Smørgrav
46c4e86ebf adduser: Fix confusion between uclass and _class.
This caused adduser to produce an invalid `pw(8)` command line.  Due to
bugs in `pw(8)`, the command line was silently accepted and led to the
user being created, but locked out and with no home directory.

Also fix the default value for the “Another user?” prompt.

Fixes:		170d088290
MFC after:	3 days
Reviewed by:	karels, allanjude
Differential Revision:	https://reviews.freebsd.org/D45098
2024-05-06 18:18:47 +02:00
Dag-Erling Smørgrav
9e8618276f adduser: Really fix a syntax error
Fixes:		5cafc38f11
Differential Revision:	https://reviews.freebsd.org/D44871
2024-04-29 12:29:35 +02:00
Joseph Mingrone
5cafc38f11
adduser: Fix a syntax error
Reported by:	Jose Luis Duran <jlduran@gmail.com>
Fixes:		b37333899b
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44871
2024-04-22 16:06:38 -03:00
Dag-Erling Smørgrav
b37333899b adduser: A few more improvements.
MFC after:	1 week
Reviewed by:	jrm
Differential Revision:	https://reviews.freebsd.org/D44871
2024-04-20 21:35:32 +02:00
Dag-Erling Smørgrav
170d088290 adduser: Overhaul.
Most importantly:

* Make local variables local.
* Use `$()` instead of backticks.
* Avoid unsafe use of `-a` and `-o` operators in `test` expressions.
* Remove a hack intended to ease the transition from Perl 22 years ago.

MFC after:	1 week
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44863
2024-04-19 17:13:30 +02:00
John Grafton
215c0a5158 adduser(8): support creation of ZFS dataset
On systems utilizing ZFS, default to creating a ZFS dataset for a new
user's home directory if the parent directory resides on a ZFS dataset.
Add a flag that disables this behavior if the administrator explicitly
does not want it.

If run during installation from within a chroot, set mountpoint to legacy
after dataset creation and mount directly into the chroot.  Then umount
and reset the mountpoint to inherit from parent.

Also support ZFS default encryption on user's home directory.

Feedback by: delphij
Reviewed by: imp, kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/881
2024-04-11 12:13:05 -06:00
Warner Losh
fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Sven Ruediger
9efad6f9e1 add defaults for adduser.sh (OK? [yes] & additional user [no])
Event:		Kitchener-Waterloo Hackathon 202305
Differential Revision:	https://reviews.freebsd.org/D40157
2023-07-18 10:37:48 -07:00
Warner Losh
4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Kyle Evans
f5339b097a adduser: allow standard IFS characters in passwords
Notably, the default IFS contains space/tab, thus any leading/trailing
whitespace characters tend to be removed.

Set IFS= for just the read lines to mitigate this, allowing the user to be
less surprised when their leading/trailing spaces weren't actually captured
in the password as they are with other means of setting a user's password.

PR:		245342
Submitted by:	dereks_lifeofadishwasher.com
Reviewed by:	jilles
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24292
2020-04-05 19:25:46 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Eitan Adler
1888bce26a Remove 'adding_user.7'
Not to be confused with adduser.
Not to be confused with useful information.

Differential Revision: https://reviews.freebsd.org/D12848
2017-11-01 01:22:33 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Isabell Long
6b63b7b726 Remove a reference to CVS and to freefall from a user-facing man page.
PR:		docs/171658
Reported by:	Chris Petrik (c dot petrik dot sosa at gmail dot com)
Approved by:	gabor (mentor)
MFC after:	5 days
2012-09-15 16:24:03 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Joel Dahl
e1656a8810 mdoc: add missing width argument to Bl -tag. 2012-06-03 06:57:47 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Daniel Eischen
a2cdef71d1 When using uidstart in /etc/adduser.conf, get the next
available user id and show it in the "Uid [xxx]" prompt.

PR:		163863
Submitted by:	Moritz Wilhelmy (mw at wzff dot de)
MFC after:	2 weeks
2012-02-25 07:58:59 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Ulrich Spörlein
0afc94c17a mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the
bottom of the manpages and order them consistently.

GNU groff doesn't care about the ordering, and doesn't even mention
CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put
them.

Found by:	mdocml lint run
Reviewed by:	ru
2010-05-13 12:07:55 +00:00
Joel Dahl
05c9bdf579 Fix a few whitespace issues and comment typos that I found while reading
through this file.
2010-01-14 22:04:08 +00:00
John Baldwin
662c90c800 The original adduser/rmuser scripts in Perl used to modify the PATH
setting.  When the scripts were converted to Bourne shell, this was
removed.  The adduser script was changed to use an explicit path for
the pw(8) command so that /usr/sbin did not have to be in the user's
PATH.  The rmuser script continued to assume that /usr/sbin was in the
user's path, however.  This fixes the rmuser script to use an explicit
path for pw(8) similar to adduser.

MFC after:	2 weeks
2008-07-30 18:37:21 +00:00
Christian Brueffer
eb95fd3362 In the description of the password field, -w was meant, not the
nonexistant -p flag.

PR:		120122
Submitted by:	Andy Kosela <andy.kosela@gmail.com>
MFC after:	3 days
2008-03-16 21:36:05 +00:00
Mike Makonnen
43cb08ceb6 Add the -M command-line option, which will set home directory permissions.
Works both in interactive or batch mode. This is a heavily modified version
of the patch submitted in the PR.

PR: bin/105060
MFC after: 1 week
2008-01-27 10:15:36 +00:00
Mike Makonnen
88b63feb56 Allow adding a user(s) to additional groups in batch mode as well.
Submitted by: Eygene Ryabinkin <rea-fbsd@codelabs.ru> (modulo minor changes)
MFC after: 2 weeks
2007-10-20 00:45:31 +00:00
Mike Makonnen
017568b3c6 The POP daemon's temporary mail file has a leading dot ('.'). This was
lost in the shell script rewrite of the rmuser command.

Submitted by: Ian Smith <smithi@nimnet.asn.au>
2007-10-19 07:18:56 +00:00
Ceri Davies
959bf73928 Bump .Dd for r1.5; fix grammatical problem. 2007-04-12 08:39:13 +00:00
Mike Makonnen
bda8f479f5 Specify the correct way to modify this file, and warn that the
user should not depend on the internal variables documented in
this man page.

MFC After: 2 weeks
2007-04-12 08:35:58 +00:00
Mike Makonnen
ac3cd4717c There are a couple of bugs in rev. 1.27:
1) The man page should describe the code, not the other way around.
2) Internal variables should not be documented or exposed, except in
   controlled circumstances (i.e. - That's what the -C flag is for).
   The variable should have been saved to the config file in save_config().
3) The next available userid doesn't get automatically updated. The
   end-result is the same (user gets added with the correct uid),
   but in an interactive session the default uid doesn't get updated in
   the display.

So,

o Use the uidstart variable instead of uuid (bug #3)
o Actually save the variable to adduser.conf (bug #2)
o (bug #1 to be fixed in an upcomming commit to adduser.conf.5)

MFC After: 2 weeks
2007-04-12 08:17:56 +00:00
Mike Makonnen
f30cdb6e7d Errm... I don't see how rev. 1.26 could have possibly worked or been tested.
Fix it for real.

Submitted by: Johnny Lee <johnny@bmtk.com>
MFC After: 2 weeks
2007-04-12 07:38:26 +00:00
Lukas Ertl
a80d527f45 Check if the new user already exists right after entering the
username instead of watching the final call to pw(8) fail.
2007-03-26 22:22:10 +00:00
Ceri Davies
3f61998e1c Flush my typo fix queue for this directory. 2006-12-05 23:20:14 +00:00
Ceri Davies
b3bd9a1702 Fix typos. 2006-12-05 23:05:53 +00:00
Ruslan Ermilov
bc84aa4ba3 Markup fixes. 2006-09-29 17:57:04 +00:00
Tom Rhodes
15b2a87f8d Add adding_user.8 to SEE ALSO, note that usernames may contain any character
but not being with a hyphen, similar to adding_user.8.

PR:	35732
2006-06-07 04:58:54 +00:00
Matteo Riondato
f4c595b794 Honour the "uuid" directive in adduser.conf
PR:		conf/87914
Approved by:	philip (mentor)
MFC after:	3 days
2006-01-22 18:37:51 +00:00
Adam Weinberger
d72fd3f9e4 Fix a particularly egregious grammar error.
Approved by:	wpaul
MFC after:	1 day
2005-05-24 04:50:07 +00:00
Robert Drehmel
989090c052 - Act according to the documentation (man page):
When adding users from a preformatted file, do not exit
   silently when empty lines or lines starting with a '#'
   are encountered - ignore them instead.
 - Fix a spelling error in a comment.

PR:		bin/80058
2005-04-28 12:44:02 +00:00
Peter Pentchev
ce655e042c In fullpath_from_shell(), move the nologin detection before the cat | while
loop to avoid an incorrect display of the nologin path twice.

PR:		71786
Submitted by:	Andrew Hayden <andrew.hayden@gmail.com>
Reviewed by:	mtm
MFC after:	3 days
2004-09-23 13:09:42 +00:00
Mike Makonnen
a53b524bb4 Also, match the full path to the special nologin shell.
Previously, it would recognize it as a valid shell only
if the basename (nologin) was specified. Now, it will
recognize both the basename and the full path.

NOTE: The full path as adduser(8) understands it is /usr/sbin/nologin.
      There is a symlink, /sbin/nologin, but that's deprecated and
      only there for backwards compatibility.
2004-08-28 14:32:10 +00:00
Ruslan Ermilov
9cdb6ee164 Assorted markup, grammar, and spelling fixes. 2004-06-13 18:03:44 +00:00
Christian S.J. Peron
3d2f5612cd Add note that rmuser will clean up any IPC mechanisms owned by the user.
Approved by:	bmilekic (mentor)
2004-06-08 14:52:55 +00:00