1. Computing & Technology
Linux / Unix Command: getpass
Command Library

NAME

getpass - get a password  

SYNOPSIS

#include <unistd.h>

char *getpass( const char * prompt );  

DESCRIPTION

This function is obsolete. Do not use it.

The getpass() function opens /dev/tty (the controlling terminal of the process), outputs the string prompt, turns off echoing, reads one line (the "password"), restores the terminal state and closes /dev/tty again.  

RETURN VALUE

The function getpass returns a pointer to a static buffer containing the (first PASS_MAX bytes of) the password without the trailing newline, terminated by a NUL. This buffer may be overwritten by a following call. On error, the terminal state is restored, errno is set appropriately, and NULL is returned.  

ERRORS

The function may fail if
ENXIO
The process does not have a controlling terminal.
 

SEE ALSO

crypt(3)  

Important: Use the man command (% man) to see how a command is used on your particular computer.

>> Linux/Unix Command Library

>> Shell Command Library

Discuss in my forum

©2012 About.com. All rights reserved.

A part of The New York Times Company.