Saturday, February 15, 2014

RHEL - Trouble Shoot with 2 screen in 1 SSH session


Install the screen package.
  • Create a screen RC file called /root/monitor.scr:

screen -t "Log Monitor" 1 tail -f /var/log/messages
screen -t "Command Window" 2 bash
split
select 1
focus
select 2
startup_message off

 
  • Start the split screen log monitor:

# screen -c /root/monitor.scr
 
  • Send an update to /var/log/messages:

# logger "This is a test"
  • To scroll back on the top window use CTRL+a, release, then press TAB.
    • Enter copy mode, use CTRL+a, release, then press [.
    • When in copy mode you can use j for up and k for down or use the up/down arrow keys.
    • Use CTRL+a then press TAB to toggle back to the command line screen.
  • To exit screen, use CTRL+a, release, then type :quit.
  • Create a copy of the /etc/ssh/sshd_config file.
  • Make a change to it
  • See how diff can find differences between files:

# cp /etc/ssh/sshd_config /root/mysshd_config
# vim /root/mysshd_config

 

LogLevel DEBUG
Port 2222

 

# diff /etc/ssh/sshd_config /root/mysshd_config
 
  • Create a screen RC file called /root/monitor_sshd.scr , this will start a test instance of SSHD when you start screen:

# screen -t "SSHD Monitor" 1 /usr/sbin/sshd -De -f
/root/mysshd_config
screen -t "Command Window" 2 bash
split
select 1
focus
select 2
startup_message off

 
  • Start the split screen SSHD monitor:

# screen -c /root/monitor_sshd.scr
 
  • SSH into the test SSHD instance from the bottom screen:

# ssh localhost -p 2222
 

No comments:

Post a Comment