I wrote a kill_all_ssh CLI program in Linux using C code, and use a secure shell to connect with the ssh server. When I issue the CLI command to close all ssh sessions, I can get a prompt that said ssh session closed as follow:
cc@server:~$ ./cli-kill-all-ssh
Connection to 192.168.1.102 closed by remote host.
Connection to 192.168.1.102 closed.
I also have a program that can change the IP address of the ssh server, but when I change the IP address of the ssh server, I lost the connection with the server, and the ssh console hang without any response.
I try to fork a child to kill all ssh session and change IP address in the parent at the same time, but it doesn't work.
Can anyone give me a hint?
Thanks in advance!