init "c" is not working

Hi all. Please help me.

I read about init(8) from FreeBSD manual page.
Code:
 Run-level    Signal     Action
 0            SIGUSR2    Halt and turn the power off
 1            SIGTERM    Go to single-user mode
 6            SIGINT     Reboot the machine
 c            SIGTSTP    Block further logins
 q            SIGHUP     Rescan the ttys(5) file
How I understood init c means, in command prompt when I will use this, other users cannot login to system. If so is not worked. I tested this in 7.4, 8.3 and 9.0

Thank you for answers.
 
I can confirm that it doesn't work for me either on a 9-STABLE amd64 machine, through ssh.

Since this feature does not seem very documented to me, I think you have two alternatives:
  1. ask the freebsd-stable mailing list.
  2. read the code of /usr/source/sbin/init/init.c and see why it fails. From one quick glimpse that I threw, I was not able to understand much, since the catatonia() function that is called when calling init with the 'c' parameter, is only called if some conditions occur (which I haven't taken the time to decipher). Nevertheless, if you're more acquainted with FreeBSD's code then I am, you can look at lines 1479-1488 and see if the actions taken are what you expect them to be.

If you come to any conclusion, please post them.
 
works here...

when loggin in via a real tty (no pseudo), after logout no new session/tty will be spawned, e.g. the consoloe does not give a new Login: prompt but "hangs" after the logout.
This does not prevent new logins via ssh/serial and does also not prevent new logins on other ttys (correct me if I'm wrong, this was try'n error).

The comment for the SE_SHUTDOWN flag states:
Code:
/* session won't be restarted */

The init(8) page states:
Code:
The init utility will cease creating new processes and allow the system
to slowly die away, if it is sent a terminal stop (TSTP) signal, i.e.
“kill -TSTP 1”.
which is the same as init -c (see below in the man page):
Code:
c            SIGTSTP    Block further logins

Maybe this thread is helpful: http://forums.freebsd.org/showthread.php?t=3208

hth glocke
 
No I don't need this. if 'init c' working how I uderstoood. Then I can say minimun from console this is must be work.

But I tested on releases which I wrhote before. For all of the it is not worked from Console and
 
init -c and kill -TSTP 1 do the same things. If you want to prevent users from log in (console or ssh) I would use some of the suggestions in the above links thread. Did you try any of those?
 
Thank all for answers but I don't need them. Because with 'pw lock' command I will lock different user.

I will say My situation. In one FreeBSD machine have 2 System Administrator.
When one of them working with root account, other administrator can login to system with root account and use ttysnooping for first session.

For that I need 'init c' command.
 
Yes it is possible kill second tty session from processes. But think it is not right.
Each time I will kill the session and he will open other session.
 
Back
Top