Using Screen to Manage Multiple Displays in one SSH Session

Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. Screen is very useful to help you administer server via SSH or console. It allows multiple shell session to be controlled by single SSH session.

As server administrator, Screen usually being used to:

  • Create multiple windows with each of the window is running different command
  • Create 2 windows. One window managing local server, another one is managing other remote server
  • Share window with other user remotely. They can see what you type and run in the shell via SSH

Lets install Screen first via SSH (in this example I will use Putty) and I will show you on how to use and take advantages by having this application installed:

RedHat/CentOS/Fedora:

yum install screen -y

Ubuntu/Debian:

apt-get install screen

FreeBSD:

cd /usr/ports/sysutils/screen
make
make install clean

notes: (on FreeBSD, they might have some prompt, just accept the default value)

Installation done. I will show some example so you can follow and understand on how we should use Screen:

1. Type following command to start screen:

[[email protected] ~]# screen

2. You have enter first window of your screen. Run following command:

3. Now, press ‘Ctrl-A-C’ in the keyboard. This will create another window next to it. Run following command afterwards:

[[email protected] ~]# netstat -na

4. Now, press another ‘Ctrl-A-C’ in the keyboard. This will create another windows next to 2nd window (the netstat window). Run following command:

Continue reading “Using Screen to Manage Multiple Displays in one SSH Session” »

Debian/Ubuntu – Make SSH Terminal Run with Colors

For those who actually get used to have colors in SSH terminal session, will surely feels weird if you SSH into Debian/Ubuntu because by default, the terminal session will NOT run with color-enabled mode. It might be small issue but it will help you a lot in administrating and managing the Linux box when you can see and differentiate things with colors.

What you need to do is replace following content into /root/.bashrc or /home/any_user/.bashrc file (this is actually an extended version with some tweak for your .bashrc file to enable colors):

Continue reading “Debian/Ubuntu – Make SSH Terminal Run with Colors” »

Public Key for SSH Authentication

Password-less SSH can really help server administrator on accessing from different node to another. This is possible by setting up the public key for SSH authentication in source and destination server.

1. Create your public and private key pair by typing:

ssh-keygen -t dsa
									

2. The key generator will ask you where you want to save your key. Press Enter to accept the default.

3. Next, the generator will prompt you to enter a passphrase. Press Enter without entering a passphrase. (You must leave this blank to make sure that destination server will not prompt out anything when authenticating SSH user)

You will need to copy your public key to your destination server. Do this by entering the following command (you will need to enter your password just this one time after you press Enter):

ssh-copy-id -i ~/.ssh/id_dsa [email protected]
									

*user = the username of your destination server
*serverIP = the IP address of your destination server

Test your setup by entering: ssh user@serverIP. If you’ve set this up correctly, you shouldn’t have to enter any login details, and now you are ready to connect to the destination server without hassle of remembering the password.