December 2005
Beginner
480 pages
13h 27m
English
Desktop launchers and a simple shell script make a great combo for quick telnet and SSH connections to remote systems.
Many of us work with a large number of servers and often have to log in and out of them. Using KDE or GNOME's Application Launcher applet and a simple shell script, you can create desktop shortcuts that enabled you to quickly connect to any host using a variety of protocols.
To do this, create a script called connect, make it executable, and put it in a directory that is located in your PATH. This script should look like the following:
#!/bin/bash progname='basename $0' type="single" if [ "$progname" = "connect" ] ; then proto=$1 fqdn=$2 shift shift elif [ "$progname" = "ctelnet" ]; then proto="telnet" fqdn=$1 shift elif [ "$progname" = "cssh" ]; then proto="ssh" fqdn=$1 shift elif [ "$progname" = "mtelnet" ]; then proto="telnet" fqdn=$1 hosts=$* type="multi" elif [ "$progname" = "mssh" ]; then proto="ssh" fqdn=$1 hosts=$* type="multi" fi args=$* # # Uncomment the xterm command and comment out the following if/else/fi clause # if you just want to use xterms everywhere # # xterm +mb -sb -si -T "${proto}::${fqdn}" -n ${host} -bg black -fg yellow - e ${proto} ${fqdn} ${args} # # Change Konsole to gnome-console and specify correct options if KDE is not installed # if [ "$type" != "multi" ]; then konsole -T "${proto}::${fqdn}" --nomenubar --notoolbar ${extraargs} -e ${proto} ${fqdn} ${args} else multixterm ...Read now
Unlock full access