Re: remote login desktop shortcuts




On Oct 20, 5:48 am, "pawright23" <mr_scro...@xxxxxxxxx> wrote:
I have a small shell script I wrote to automate everything, actually.
It reads a list of hosts from a file and presents with a menu for
choosing a host to connect and creates a new screen window for it, with
an appropriate name.

Thanks a lot for the info. Is there any chance I could nab this script
off you?


Sure, just create a list of hosts, one per line, in ~/.hosts and it
will work.

You can also just type partial names and it will take the first match.
Like if you have a biglonghostname.example.com in your list, you can
just type 's biglong' and it will match it and start an ssh session to
that host.

Also, in your ~/.screenrc, add the lines:

bind w windowlist -b
bind W windowlist -m

This will give you the nice menu for choosing windows when you hit
ctrl-a w, because the regular windowlist can't show very menu names in
its list.



#!/bin/sh

#
# usage:
#
# s l = screen -list
#
# s r = screen -r
#
# s d = screen -d
#
# s d r = screen -d -r
#
# s = show hosts
#
# s <string> = new screen window to matching host
#
# "s looking" would automatically match
# lookingglass.metrocast.net
#
# s sh = create a plain new screen window
#
# s root = create a screen window as root
#
# s con = console window using /dev/cuaU0


if [ -z "$1" ] ; then
grep -n ^ ~/.hosts
printf Number:
read CHOICE
SEARCH="^$CHOICE:"
elif [ "$1" = "r" ] ; then
screen -r
elif [ "$1" = "d" ] ; then
screen -d
elif [ "$1" = "d" ] && [ "$1" = "r" ] ; then
screen -d -r
elif [ "$1" = "l" ] ; then
screen -list
elif [ "$1" = "sh" ] || [ "$1" = "tcsh" ] ; then
screen -t aharrison
elif [ "$1" = "root" ] ; then
screen -t root su
elif [ "$1" = "con" ] || [ "$1" = "console" ] ; then
screen -t console su root -c "/usr/bin/cu -l /dev/cuaU0"
else
SEARCH="$1"
fi

if [ -n "$SEARCH" ] ; then
HOST=`grep -n ^ ~/.hosts | grep $SEARCH | awk -F\: '{print $2}' |
head -1`
if [ -n "$HOST" ] ; then

#
# A couple of the hosts in my list have special
# requirements to connection...
#
if [ "$HOST" = "server42" ] || [ "$HOST" =
"server42.example.com" ] ; then
screen -t $HOST ssh -i /mnt/key/.ssh/id_rsa $HOST
elif [ "$HOST" = "server99.example.com" ] ; then
screen -t $HOST ssh -p 5000 $HOST
else
screen -t $HOST ssh $HOST
fi
else
echo Host not found
fi
fi

#
# vim: filetype=sh et sw=4 ts=4
#

.



Relevant Pages

  • Re: Can not authenticate to home page
    ... FP SE - FrontPage Server Extensions ... Verify w/ your host that they support the FP SE and have them installed for your URL ... | window asking for user name and password. ... Shortly thereafter, I get a pop-up ...
    (microsoft.public.frontpage.client)
  • Re: One computer cant see the other.
    ... When I net view from the client computer to the host computer I get my ... When I click on the shared folders in My Network Places(on ... command prompt on my host machine and my client machine when I ping the host. ... Open a command prompt window first, ...
    (microsoft.public.windowsxp.network_web)
  • Re: TSC Explorer Window Error HELP!
    ... I can't do anything at the host end to monitor these ... I have noticed that if I can get any other window to cover ... differs from time to time (almost like it takes the client ... a little bit to "realize" that the explorer window is ...
    (microsoft.public.windowsxp.work_remotely)
  • Re: TalkTalk Broadband Problem
    ... If I click on it a small window opens, ... Another item in the Network configuration window is 'Resolver'. ... the Host name as 'Babylon' and Primary Name Server as '192.168.1.1'. ...
    (comp.sys.acorn.networking)
  • User Mode Linux = Network Problem
    ... For UML, root filesystem is Debian 3.0, ip adress 192.168.1.101, ... On the host: ... Initializing software serial port version 1 ... Configuring network interfaces: done. ...
    (comp.os.linux.networking)