| 1 |
'\" t |
| 2 |
.\" Copyright 1993, David Metcalfe <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH getusershell 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
getusershell, setusershell, endusershell \- get permitted user shells |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <unistd.h> |
| 16 |
.P |
| 17 |
.B char *getusershell(void); |
| 18 |
.B void setusershell(void); |
| 19 |
.B void endusershell(void); |
| 20 |
.fi |
| 21 |
.P |
| 22 |
.RS -4 |
| 23 |
Feature Test Macro Requirements for glibc (see |
| 24 |
.BR feature_test_macros (7)): |
| 25 |
.RE |
| 26 |
.P |
| 27 |
.BR getusershell (), |
| 28 |
.BR setusershell (), |
| 29 |
.BR endusershell (): |
| 30 |
.nf |
| 31 |
Since glibc 2.21: |
| 32 |
.\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8 |
| 33 |
_DEFAULT_SOURCE |
| 34 |
In glibc 2.19 and 2.20: |
| 35 |
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) |
| 36 |
Up to and including glibc 2.19: |
| 37 |
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) |
| 38 |
.fi |
| 39 |
.SH DESCRIPTION |
| 40 |
The |
| 41 |
.BR getusershell () |
| 42 |
function returns the next line from the file |
| 43 |
.IR /etc/shells , |
| 44 |
opening the file if necessary. |
| 45 |
The line should contain |
| 46 |
the pathname of a valid user shell. |
| 47 |
If |
| 48 |
.I /etc/shells |
| 49 |
does not exist or |
| 50 |
is unreadable, |
| 51 |
.BR getusershell () |
| 52 |
behaves as if |
| 53 |
.I /bin/sh |
| 54 |
and |
| 55 |
.I /bin/csh |
| 56 |
were listed in the file. |
| 57 |
.P |
| 58 |
The |
| 59 |
.BR setusershell () |
| 60 |
function rewinds |
| 61 |
.IR /etc/shells . |
| 62 |
.P |
| 63 |
The |
| 64 |
.BR endusershell () |
| 65 |
function closes |
| 66 |
.IR /etc/shells . |
| 67 |
.SH RETURN VALUE |
| 68 |
The |
| 69 |
.BR getusershell () |
| 70 |
function returns NULL on end-of-file. |
| 71 |
.SH FILES |
| 72 |
.I /etc/shells |
| 73 |
.SH ATTRIBUTES |
| 74 |
For an explanation of the terms used in this section, see |
| 75 |
.BR attributes (7). |
| 76 |
.TS |
| 77 |
allbox; |
| 78 |
lbx lb lb |
| 79 |
l l l. |
| 80 |
Interface Attribute Value |
| 81 |
T{ |
| 82 |
.na |
| 83 |
.nh |
| 84 |
.BR getusershell (), |
| 85 |
.BR setusershell (), |
| 86 |
.BR endusershell () |
| 87 |
T} Thread safety MT-Unsafe |
| 88 |
.TE |
| 89 |
.SH STANDARDS |
| 90 |
None. |
| 91 |
.SH HISTORY |
| 92 |
4.3BSD. |
| 93 |
.SH SEE ALSO |
| 94 |
.BR shells (5) |