≡ Menu

ssh client

Download of the Day: OpenSSH Server 5.0 ( security fix release )

OpenSSH Logo
One of the most popular remote server management service has just released security fix version. This version avoid possible hijacking of X11-forwarded connections by refusing to listen on a port unless all address families bind successfully. You can download OpenSHH Server from official project web site or wait for your distro to release updated version.

Download of the day: SSH Menu ~ Save and Open SSH Connections on a single mouse click

For last couple of years I’ve used my own shell script based solution to list and open ssh connections. Now I found a nice applet called SSHMenu:

The SSHMenu is a panel applet that makes all your regular SSH connections a single mouse click away. Each menu option will open an SSH session in a new terminal window. You can arrange groups of hosts with separator bars or sub-menus. You can even open all the connections on a submenu (in separate windows or tabs) with one click.

Overall I'm quite happy with SSHMenu, a must have tool for all admin, IMHO.


a] SSHMenu allows you to add key so that you can run rest of the all session without a problem and password.
b] Every connection you make using using SSHMenu will use the terminal profile you've selected, to set the color scheme, terminal font and other settings.
c] You can open all connection at a time and much more...

SSH Menu ~ Save and Open SSH Connections on a single mouse click
(SSHMenu in action - click to enlarge)

Download SSHMenu

=> Visit official site here ( hat tip to carthik )

Execute Commands on Multiple Linux or UNIX Servers

This is Part I in a series - 'Execute Commands on Multiple Linux or UNIX Servers Simultaneously'. The full series is Part I, Part II, and Part III. Some time it is necessary to execute commands on Multiple Linux or UNIX Servers, for example you would like to find out who is logged on and what they are doing on three Linux or UNIX boxes or better find out system utilization, disk space and much more. With the help of ssh you can easily setup such nice system.

Our Sample Setup

Admin Linux workstation -> Server # 1 with ssh
adm.my.com              -> server1.my.com

SSH client is a program for logging into a remote machine and for executing commands on a remote machine. If command is specified, command is executed on the remote host instead of a login shell.

$ ssh  user@server1.my.com  w

Above command will gather up all logged in users information. However if you put this command in script to gather information from three server as follows it will prompt for a password:

ssh user@server1.my.com w
ssh user@server2.my.com w
ssh user@server3.my.com w

To get rid of password you can setup ssh key based login. Once ssh keys are in place you can simply create a script as follows:

# Linux/UNIX box with ssh key based login
# SSH User name
# Email 
SUBJECT="Server user login report"
# create new file
# connect each host and pull up user listing
for host in $SERVERS
echo "--------------------------------" >>$EMAILMESSAGE
echo "* HOST: $host " >>$EMAILMESSAGE
echo "--------------------------------" >>$EMAILMESSAGE
ssh $USR@$host w >> $EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

You need to setup your hostname and email id and then execute shell script. This is very simple yet powerful method to execute commands simultaneously on multiple Linux/UNIX servers. If you are really interested to see application output then visit here, it was produced by this script (see our forum for more). This is just small script but you are only limited by your own imagination. Few more advanced tools do exist I will cover them some time later.

Running Commands on a Remote Linux / UNIX Host

You would like to execute a command on a remote Linux/FreeBSD/Solaris/UNIX host and have the result displayed locally. Once result obtained it can be used by local script or program. A few examples:
=> File system and disk information

=> Get user information

=> Find out all running process

=> Find out if particular service is running or not etc

You can use rsh or ssh for this purpose. However, for security reason you should always use the ssh and NOT rsh. Please note that remote system must run the OpenSSH server.

Syntax for running command on a remote host:
ssh [USER-NAME]@[REMOTE-HOST] [command or script]


  • ssh: ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine.
  • USER-NAME: Remote host user name.
  • REMOTE-HOST: Remote host ip-address or host name, such as fbsd.cyberciti.biz.
  • command or script: Command or shell script is executed on the remote host instead of a login shell.


(A) Get disk information from a server called www1.cyberciti.biz:
$ ssh vivek@www1.cyberciti.biz df -h

(B) List what ports are open on remote host
$ ssh vivek@www1.cyberciti.biz netstat -vatn

(C) Reboot remote host:
$ ssh root@www1.cyberciti.biz reboot

(D) Restart mysql server (please note enclosed multiple command line arguments using a single or double quotes)
$ ssh root@www1.cyberciti.biz '/etc/init.d/mysql restart'

(E) Get memory information and store result/output to local file /tmp/memory.status:
$ ssh vivek@www1.cyberciti.biz 'free -m' > /tmp/memory.status

(G) You can also run multiple command or use the pipes, following command displays memory in format of "available memory = used + free memory" :
$ ssh vivek@debian.test.com free -m | grep "Mem:" | awk '{ print "Total memory (used+free): " $3 " + " $4 " = " $2 }'

See how to configure ssh for password less login using public key based authentication.

=> Related: shell script to get uptime, disk usage, cpu usage, RAM usage,system load,etc. from multiple Linux servers and output the information on a single server in a html format.