Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

as title says I have a centOS 6 machine which uses an dracut, initramfs preboot ssh. I want to create a shell script that at the end of it's execution it closes the console and ssh connection. How can I do that. Escape character ~. does not work.

share|improve this question

You have to determine PID of shell started after SSH-session has been established - and kill it. SSH session terminates automatically. Most shells has variable $$ that contains PID of parent shell. So just add to your script last line:

kill -6 $$
share|improve this answer

Your Answer


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.