Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to display a customized message for "/usr/sbin/nologin". As far as I remember this can be accomplished by creating the file "/etc/nologin.txt" with the desired text in it.

But it doesn't work in Ubuntu 12.04 (LTS (GNU/Linux 3.2.0-38-generic x86_64)) - it displays only the "standard" message:

$ cat /etc/nologin.txt
Sorry, there is no login shell
$ nologin
This account is currently not available.

Am I missing something?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You can check the output of

 strace /usr/sbin/nologin 2>&1 | grep open

These files are accessed by nologin. I don't have Ubuntu, but in Debain there's the following output:

 open("/etc/ld.so.cache", O_RDONLY)      = 3
 open("/lib/libc.so.6", O_RDONLY)        = 3
 open("/var/run/utmp", O_RDONLY|O_CLOEXEC) = 3
 open("/etc/localtime", O_RDONLY)        = 3

Compared with a system, where /etc/nologin.txt is displayed (openSuSE 11), the important line is missing

 open("/etc/nologin.txt", O_RDONLY)      = -1 ENOENT (No such file or directory)

Hence, it looks like the changing of the default message is not provided.

man 5 nologin states

If the file /etc/nologin exists, login(1) will allow access only to root. Other users will be shown the contents of this file and their logins will be refused.

But that's probably not, what you want either...

share|improve this answer
    
Thank you very much for clearing things up. Seems that Debian / Ubuntu are not accessing the nologin.txt whereas Feodora, Suse does. –  jaltek Mar 12 '13 at 16:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.