{"id":7242,"date":"2022-12-20T19:35:58","date_gmt":"2022-12-20T22:35:58","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/getpass-man3\/"},"modified":"2022-12-20T19:35:58","modified_gmt":"2022-12-20T22:35:58","slug":"getpass-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/getpass-man3\/","title":{"rendered":"GETPASS (man3)"},"content":{"rendered":"<h1 align=\"center\">GETPASS<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#ERRORS\">ERRORS<\/a><br \/> <a href=\"#FILES\">FILES<\/a><br \/> <a href=\"#ATTRIBUTES\">ATTRIBUTES<\/a><br \/> <a href=\"#CONFORMING TO\">CONFORMING TO<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#BUGS\">BUGS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COLOPHON\">COLOPHON<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">getpass \u2212 get a password<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <unistd.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>char *getpass(const char *<\/b><i>prompt<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:5%; margin-top: 1em\">Feature Test Macro Requirements for glibc (see <b>feature_test_macros<\/b>(7)):<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getpass<\/b>():<\/p>\n<p style=\"margin-left:17%;\">Since glibc 2.2.2:<\/p>\n<p style=\"margin-left:23%;\">_XOPEN_SOURCE &#038;&#038; ! (_POSIX_C_SOURCE\u00a0>=\u00a0200112L) <br \/> || \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var Glibc since 2.19: bodies\/ usr\/ _DEFAULT_SOURCE <br \/> || \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var Glibc versions <= 2.19: bodies\/ usr\/ _BSD_SOURCE<\/p>\n<p style=\"margin-left:17%;\">Before glibc 2.2.2:<\/p>\n<p style=\"margin-left:23%;\">none<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This function is obsolete. Do not use it. If you want to read input without terminal echoing enabled, see the description of the <i>ECHO<\/i> flag in <b>termios<\/b>(3).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>getpass<\/b>() function opens <i>\/dev\/tty<\/i> (the controlling terminal of the process), outputs the string <i>prompt<\/i>, turns off echoing, reads one line (the &#8220;password&#8221;), restores the terminal state and closes <i>\/dev\/tty<\/i> again.<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The function <b>getpass<\/b>() returns a pointer to a static buffer containing (the first <b>PASS_MAX<\/b> bytes of) the password without the trailing newline, terminated by a null byte (&#8216;\u0000&#8217;). This buffer may be overwritten by a following call. On error, the terminal state is restored, <i>errno<\/i> is set appropriately, and NULL is returned.<\/p>\n<h2>ERRORS <a name=\"ERRORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The function may fail if<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><b>ENXIO<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"75%\">\n<p>The process does not have a controlling terminal.<\/p>\n<\/td>\n<td width=\"3%\"> <\/td>\n<\/tr>\n<\/table>\n<h2>FILES <a name=\"FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>\/dev\/tty<\/i><\/p>\n<h2>ATTRIBUTES <a name=\"ATTRIBUTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">For an explanation of the terms used in this section, see <b>attributes<\/b>(7).<\/p>\n<p align=\"center\" style=\"margin-top: 1em\"><img decoding=\"async\" src=\"grohtml-1663311.png\" alt=\"Image grohtml-1663311.png\"><\/p>\n<h2>CONFORMING TO <a name=\"CONFORMING TO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Present in SUSv2, but marked LEGACY. Removed in POSIX.1-2001.<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">In the GNU C library implementation, if <i>\/dev\/tty<\/i> cannot be opened, the prompt is written to <i>stderr<\/i> and the password is read from <i>stdin<\/i>. There is no limit on the length of the password. Line editing is not disabled.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">According to SUSv2, the value of <b>PASS_MAX<\/b> must be defined in <i><limits.h><\/i> in case it is smaller than 8, and can in any case be obtained using <i>sysconf(_SC_PASS_MAX)<\/i>. However, POSIX.2 withdraws the constants <b>PASS_MAX<\/b> and <b>_SC_PASS_MAX<\/b>, and the function <b>getpass<\/b>(). The glibc version accepts <b>_SC_PASS_MAX<\/b> and returns <b>BUFSIZ<\/b> (e.g., 8192).<\/p>\n<h2>BUGS <a name=\"BUGS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The calling process should zero the password as soon as possible to avoid leaving the cleartext password visible in the process\u2019s address space.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>crypt<\/b>(3)<\/p>\n<h2>COLOPHON <a name=\"COLOPHON\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This page is part of release 5.10 of the Linux <i>man-pages<\/i> project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https:\/\/www.kernel.org\/doc\/man\u2212pages\/.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  getpass \u2212 get a password <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[2538,3568,3007],"class_list":["post-7242","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-getpass","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7242"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7242\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}