Setting up ssh and rsh connection using the pwdutil.pl utility

The password utility, pwdutil.pl, is bundled under the scripts directory. The users can run the utility in their script to set up the ssh and rsh connection automatically.

# ./pwdutil.pl -h
Usage:

Command syntax with simple format:

    pwdutil.pl check|configure|unconfigure ssh|rsh <hostname|IP addr> 
				[<user>] [<password>] [<port>]

Command syntax with advanced format:

    pwdutil.pl [--action|-a 'check|configure|unconfigure']
               [--type|-t 'ssh|rsh']
               [--user|-u  '<user>']
               [--password|-p '<password>']
               [--port|-P '<port>']
               [--hostfile|-f '<hostfile>']
               [--keyfile|-k '<keyfile>']
               [-debug|-d]
               <host_URI>

    pwdutil.pl -h | -?

Table: Options with pwdutil.pl utility

Option

Usage

--action|-a 'check|configure|unconfigure'

Specifies action type, default is 'check'.

--type|-t 'ssh|rsh'

Specifies connection type, default is 'ssh'.

--user|-u '<user>'

Specifies user id, default is the local user id.

--password|-p '<password>'

Specifies user password, default is the user id.

--port|-P '<port>'

Specifies port number for ssh connection, default is 22

--keyfile|-k '<keyfile>'

Specifies the private key file.

--hostfile|-f '<hostfile>'

Specifies the file which list the hosts.

-debug

Prints debug information.

-h|-?

Prints help messages.

<host_URI>

Can be in the following formats:

<hostname>

<user>:<password>@<hostname>

<user>:<password>@<hostname>:

<port>

You can check, configure, and unconfigure ssh or rsh using the pwdutil.plutility. For example:

You can see the contents of the configuration file by using the following command:

# cat /tmp/sshrsh_hostfile
user1:password1@hostname1
user2:password2@hostname2
user3:password3@hostname3
user4:password4@hostname4

# all default: check ssh connection with local user
hostname5
The following exit values are returned:

0     Successful completion.
1     Command syntax error.
2     Ssh or rsh binaries do not exist.
3     Ssh or rsh service is down on the remote machine.
4     Ssh or rsh command execution is denied due to password is required.
5     Invalid password is provided.
255   Other unknown error.