Sun Microsystems V20Z Server User Manual


 
56 Sun Fire V20z and Sun Fire V40z Servers, Server Management Guide May, 2004
Using Shell Scripts
An administrator can make configuration changes for a single SP by using SSH to
log in and run commands. For a multi-system environment in which configurations
for all SPs must be synchronized, you can automate configuration changes.
As a Unix/Linux administrator, you can use SSH, trusted host relationships or
public key authentication, and Unix/Linux shell scripting to automate tasks that
need to be performed on multiple SPs.
1. Set up your system for scripting.
Sun Fire V20z and Sun Fire V40z remote scripting solutions depend on SSH for
authentication and data encryption. If you do not already have SSH, you can
obtain a free implementation, OpenSSH, available at www.openssh.org. The SP
allows the use of SSH v2 only. Refer to “Remote Scripting Using SSH” on page 56.
2. Create a trusted host relationship or add your public key for SSH authentication.
In order to use SSH in a scripted environment such that you are not prompted for
a password upon the execution of each command, you can establish a trusted host
relationship between the machine from which the commands are sent and the SP
on which the commands are executed. (This requires the prior creation of a
manager-level user on the SP.) Refer to “Creating Trusted Host Relationships”
on page 58.
You can also add a public key for SSH authentication, allowing you to log in via
SSH and execute remote commands without being prompted for a password.
Refer to “Adding Public Keys” on page 58.
3. Configure your client for scripting.
You must configure the client machine on which you will be running scripts.
4. Create your scripts.
Remote Scripting Using SSH
Remote scripting to the SP is done by using a program called SSH. For example, as a
user on the UNIX machine client.company.com with the SP name sp.company.com,
you could execute a command on the SP from the UNIX client using the following
format:
# ssh sp.company.com command
Because the SSH server must authenticate the remote user, the user must either enter
a password, or a trusted host relationship must exist, or the remote user’s public key
must be installed on the SP.