nologin program

Robert Connolly robert at linuxfromscratch.org
Tue Jan 25 21:26:25 PST 2005


Is anyone interested in having an /sbin/nologin(8) ? This is an alternative 
to /bin/false, but while false(1) displays nothing and returns 1, nologin can 
display a hardcoded message, or one from /etc/nologin.txt, and return 1.

Both false and nologin are equally safe to use. nologin is intended to let 
users know an account is disabled instead of giving them no explanation, 
assuming they get the password right.

Some distro's patch this into util-linux. Its a simple program:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DEFAULT_MESG    "This account is currently not available.\n"
int main(int argc, char *argv[])
{
        write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG));
        exit (1);
}

Its no big deal, and really just a vanity thing. But nologin is more suitable 
for use with login rejection than what false does. It would only really get 
used if root tried 'su - sshd', or if you choose to disable a real account.

robert



More information about the hlfs-dev mailing list