1.\" Copyright (c) 1989, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)getpass.3 8.1 (Berkeley) 06/04/93 7.\" 8.Dd 9.Dt GETPASS 3 10.Os 11.Sh NAME 12.Nm getpass 13.Nd get a password 14.Sh SYNOPSIS 15.Fd #include <pwd.h> 16.Fd #include <unistd.h> 17.Ft char * 18.Fn getpass "const char *prompt" 19.Sh DESCRIPTION 20The 21.Fn getpass 22function displays a prompt to, and reads in a password from, 23.Pa /dev/tty . 24If this file is not accessible, 25.Nm getpass 26displays the prompt on the standard error output and reads from the standard 27input. 28.Pp 29The password may be up to _PASSWORD_LEN (currently 128) 30characters in length. 31Any additional 32characters and the terminating newline character are discarded. 33.Pp 34.Nm Getpass 35turns off character echoing while reading the password. 36.Pp 37.Sh RETURN VALUES 38.Nm Getpass 39returns a pointer to the null terminated password. 40.Sh FILES 41.Bl -tag -width /dev/tty - compact 42.It Pa /dev/tty 43.El 44.Sh SEE ALSO 45.Xr crypt 3 46.Sh HISTORY 47A 48.Nm getpass 49function appeared in 50.At v7 . 51.Sh BUGS 52The 53.Nm getpass 54function leaves its result in an internal static object and returns 55a pointer to that object. 56Subsequent calls to 57.Nm getpass 58will modify the same object. 59.Pp 60The calling process should zero the password as soon as possible to 61avoid leaving the cleartext password visible in the process's address 62space. 63