History log of /freebsd-current/usr.sbin/adduser/adduser.sh
Revision Date Author Comments
# 0b39b2e2 20-May-2024 Mike Karels <karels@FreeBSD.org>

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


# 46a619c6 15-May-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

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: 170d0882903e
MFC after: 3 days
Reviewed by: karels
Differential Revision: https://reviews.freebsd.org/D45204


# 46c4e86e 06-May-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

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: 170d0882903e
MFC after: 3 days
Reviewed by: karels, allanjude
Differential Revision: https://reviews.freebsd.org/D45098


# 9e861827 28-Apr-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

adduser: Really fix a syntax error

Fixes: 5cafc38f1129
Differential Revision: https://reviews.freebsd.org/D44871


# 5cafc38f 22-Apr-2024 Joseph Mingrone <jrm@FreeBSD.org>

adduser: Fix a syntax error

Reported by: Jose Luis Duran <jlduran@gmail.com>
Fixes: b37333899bd2
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44871


# b3733389 20-Apr-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

adduser: A few more improvements.

MFC after: 1 week
Reviewed by: jrm
Differential Revision: https://reviews.freebsd.org/D44871


# 170d0882 19-Apr-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

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


# 215c0a51 11-Apr-2024 John Grafton <john.grafton@gmail.com>

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


# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# 9efad6f9 18-Jul-2023 Sven Ruediger <freebsd@hackacad.net>

add defaults for adduser.sh (OK? [yes] & additional user [no])

Event: Kitchener-Waterloo Hackathon 202305
Differential Revision: https://reviews.freebsd.org/D40157


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

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


# f5339b09 05-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

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


# 1de7b4b8 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

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.


# a2cdef71 25-Feb-2012 Daniel Eischen <deischen@FreeBSD.org>

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


# 3df5ecac 30-Dec-2011 Ulrich Spörlein <uqs@FreeBSD.org>

Spelling fixes for usr.sbin/


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 05c9bdf5 14-Jan-2010 Joel Dahl <joel@FreeBSD.org>

Fix a few whitespace issues and comment typos that I found while reading
through this file.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 43cb08ce 27-Jan-2008 Mike Makonnen <mtm@FreeBSD.org>

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


# 88b63feb 19-Oct-2007 Mike Makonnen <mtm@FreeBSD.org>

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


# ac3cd471 12-Apr-2007 Mike Makonnen <mtm@FreeBSD.org>

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


# f30cdb6e 12-Apr-2007 Mike Makonnen <mtm@FreeBSD.org>

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


# a80d527f 26-Mar-2007 Lukas Ertl <le@FreeBSD.org>

Check if the new user already exists right after entering the
username instead of watching the final call to pw(8) fail.


# f4c595b7 22-Jan-2006 Matteo Riondato <matteo@FreeBSD.org>

Honour the "uuid" directive in adduser.conf

PR: conf/87914
Approved by: philip (mentor)
MFC after: 3 days


# 989090c0 27-Apr-2005 Robert Drehmel <robert@FreeBSD.org>

- 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


# ce655e04 23-Sep-2004 Peter Pentchev <roam@FreeBSD.org>

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


# a53b524b 28-Aug-2004 Mike Makonnen <mtm@FreeBSD.org>

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.


# e7291a6b 06-Jun-2004 Mike Makonnen <mtm@FreeBSD.org>

Accept full path names in addition to base names for shells.

Make explicit in the documentation that valid shells need to be
supplied only if the -S option is not given.


# 68050033 30-Mar-2004 Colin Percival <cperciva@FreeBSD.org>

Sychronize with reality: nologin(8) is now in /usr/sbin

Reminded by: trhodes


# 0d640c0d 16-Mar-2004 Mike Makonnen <mtm@FreeBSD.org>

o Add an -S option to not attempt to ascertain the validity of a shell.
o Add a -D option to not attempt to create the home directory.
o Treat the /nonexistent home directory specially. It means the user has
no home directory and it should not be created.
o Update Copyright year and my email.


# fdbc43bd 24-Jun-2003 Mike Makonnen <mtm@FreeBSD.org>

Typo.
This has worked so far because the variable was empty by default.

Submitted by: Kostyuk Oleg <cub@cub.org.ua>


# 0e08168e 20-Jun-2003 Mike Makonnen <mtm@FreeBSD.org>

s/warn/info/


# 8923e98b 20-Jun-2003 Mike Makonnen <mtm@FreeBSD.org>

Add support for the special shell nologin.

Prodded by: mikeh


# 22884fdd 20-Jun-2003 Mike Makonnen <mtm@FreeBSD.org>

Update my email address.


# b0c151b8 20-Jun-2003 Mike Makonnen <mtm@FreeBSD.org>

Don't forget the -r on the second password prompt.

PR: bin/53550


# e33b8d97 23-Mar-2003 Mike Makonnen <mtm@FreeBSD.org>

Document the -g option in the usage message.

Approved by: markm (mentor)(implicit)


# 642a7af5 20-Mar-2003 Mike Makonnen <mtm@FreeBSD.org>

Add a -g option to specify a default login group.

Approved by: markm (mentor)(implicit)


# 187a97aa 19-Mar-2003 Mike Makonnen <mtm@FreeBSD.org>

o initialize a couple of local flags so the user can re-edit groups
next time the subroutine is re-entered
o s/configrun/configflag/
o Make the prompt make sense if the user was creating a configuration file

Approved by: markm (mentor)(implicit)


# fc895860 16-Feb-2003 Mike Makonnen <mtm@FreeBSD.org>

Update copyright.


# c95c14d4 09-Feb-2003 Mike Makonnen <mtm@FreeBSD.org>

Revisit the shell special characters issue and settle it once-and-forall.
All characters will be accepted, and pw(8) can sort out which ones it
will allow and which ones it won't.

Approved by: markm (mentor)
Prodded by: Philippe Bourcier <philippe@cyberabuse.org>


# 3386ded6 08-Feb-2003 Adrian Chadd <adrian@FreeBSD.org>

Change the behaviour of adduser to match the previous incarnation a little more.

If any of the given groups do not exist complain and let the user try again.
This saves the user from discovering at the end of the process that they've
forgotten to add a group or they've typoed.

Thanks to cmc/dougb for pointing out how bad my sh fu actually is.

Original code by: me
Scary sh rewrite by: dougb

Reviewed by: dougb


# cf8a185d 23-Jan-2003 Max Khon <fjoe@FreeBSD.org>

back out logging to /var/log/adduser
(/usr/sbin/pw already logs to /var/log/userlog)


# 21084fe3 23-Jan-2003 Mike Makonnen <mtm@FreeBSD.org>

In interactive mode, ask the user if he/she wants to add another
user and re-run interactive questions or quit depending on the
answer.

Submitted by: Scot Hetzel <hetzels@westbend.net>
Approved by: markm (mentor)


# e63bd70a 23-Jan-2003 Max Khon <fjoe@FreeBSD.org>

- restore an ability to write log of added users (default to
/var/log/adduser, disabled if empty or adduserlog="no")
- do not ask for password in configure mode
- print $passwdtype instead of password in configure mode
- add DATECMD, GREPCMD (not overridable but with full path)


# c8336599 22-Jan-2003 Mike Makonnen <mtm@FreeBSD.org>

*blush*
While I'm here properly quote all the other input I neglected
to quote.

Approved by: markm (mentor)(implicit)


# acb3f07a 20-Jan-2003 Mike Makonnen <mtm@FreeBSD.org>

Don't forget to properly quote input.

Approved by: markm (mentor)(implicit)
Submitted by: Robin Breathe <robin@isometry.net>


# 8b6caf26 20-Jan-2003 Max Khon <fjoe@FreeBSD.org>

do not loose trailing space when asking uid


# 7cdfce09 02-Dec-2002 Scott Long <scottl@FreeBSD.org>

Replace the perl versions of adduser and rmuser with shell script versions.

Submitted by: Mike Makonnen <mtm@identd.net>
Approved by: re


# a5b996a7 30-Dec-1995 Peter Wemm <peter@FreeBSD.org>

recording cvs-1.6 file death


# 4298bedc 29-Dec-1994 Andrey A. Chernov <ache@FreeBSD.org>

Yet one cleanup