# init "c" is not working



## lamacont (Sep 13, 2012)

Hi all. Please help me.

I read about init(8) from FreeBSD manual page. 

```
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.


----------



## mamalos (Sep 13, 2012)

Please write down how you evaluated it (ssh? local-logins?).


----------



## lamacont (Sep 13, 2012)

I tried for each of them with different users.
And each of them could login to system.


----------



## lamacont (Sep 14, 2012)

I test with FreeBSD 8.2 i386 and x64 too.

Same result.


----------



## mamalos (Sep 14, 2012)

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:

ask the freebsd-stable mailing list.
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.


----------



## glocke (Sep 14, 2012)

*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:

```
/* session won't be restarted */
```

The init(8) page states:

```
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):

```
c            SIGTSTP    Block further logins
```

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

hth glocke


----------



## lamacont (Sep 15, 2012)

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


----------



## lamacont (Sep 17, 2012)

Sorry but I test in FreeBSD 8.3 x64 from console and from SSH. 
'kill -TSTP 1' is not worked


----------



## glocke (Sep 17, 2012)

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?


----------



## lamacont (Sep 18, 2012)

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.


----------



## lamacont (Sep 18, 2012)

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.


----------

