Linux Training

Linux training for private, public & voluntary sector.

0793 572 8612

City LinUX sample scripts - rhost

NAME

rhost - start a ssh session on a remote host in a new terminal window.

SYNOPSIS

rhost [ -c <config_file> ] [ -l <login name> ] [ -v ] <hostname>
or
<hostname> -l <login_name> ] [ -v ]

AVAILABILITY

rhost is a Bourne shell script which should work equally well on all versions of UNIX and Linux.

DESCRIPTION

In the first form, using the command rhost , an X windows terminal session is started and a ssh session to the nominated remote host <hostname> is initiated.

In the second form <host name> is a symbolic link to the script rhost and the basename of the command is assumed to be a valid hostname.

In the event of no host name being set, an error message is printed on standard error but the ssh session will attempt to connect to localhost.

Before attempting the direct connection rhost will attempt to ping the remote host. If no route to the host is found rhost will look up the hostid in the default vn-connect configuration file and if it appears a VPN connection is required rhost will invoke vn-connect to establish a virtual network connection before proceeding.

The script is most useful when different background colours are used for each host that is frequently accessed. Where an administrator is servicing multiple clients several concurrent sessions that are readily identifiable can be displayed. The virtual terminal will be xterm by default but alternatives may be set in configuration file. Background and foreground colours may also be set in the config file provided that application supports setting colours on the command line.

OPTIONS

-c    <configuration_file>

Use the named configuration file in preference to the default " /usr/local/etc/rhost.cf "

-l    <login_name>

The ssh will attempt to login with the username <login_name> .

-v   

Verbose mode, the script will run with the -x    option set.

EXAMPLES

	rhost -l william 10.0.0.3

Start a virtual terminal window with a ssh session to the host at 10.0.0.3. The virtual terminal background will be yellow (see the example configuration file below), the text will use the default "blue". Use the login name "william"

	dougal&

Start a virtual terminal window with a ssh session to the host "dougal" with white text on a dark blue background (see the configuration file below). Use the current effective user name as the login name for ssh. NB. Foreground and background colours are set in the configuration file as in the example below.

FILES

rhost.cf.

BUGS

The script has very little input error checking. Name resolution and network availability is not checked. It is designed to be used with frequently used host names where ssh keys have already been exchanged.

SEE ALSO

vn-connect.

AUTHOR

Clifford W Fulford, City Linux. Contact fulford@fulford.net or +44 (0)709 229 5385.


The layout and associated style sheets for this page are taken from the World Wide Web Consortium and used here under the W3C software licence.