NaviServer Programmable Web Server

nscp(n)

NaviServer Modules – 5.0.0a


[ Main Table Of Contents | Table Of Contents | Keyword Index ]

Name

nscp - NaviServer Control Port Guide

Table Of Contents

Synopsis

Description

This document describes the NaviServer control port interface provided by the nscp module. The control port offers a Tcl-based administration interface that allows you to connect to a designated host and port, and to perform server management and database operations while the server is running.

Introduction

NaviServer provides a control port interface that can be enabled by loading the nscp module. This interface lets you connect to a specified host and port using a telnet client to administer the server and execute database commands on the running system.

The control port offers direct access to the Tcl API of the running server. Once logged in, you can execute nearly any Tcl command available in the Tcl libraries with the exception of commands that require a dedicated connection thread (for example, all subcommands of ns_conn except ns_conn isconnected).

To effectively manage the server through the control port, ensure that:

Authentication

To use the control port, a user must connect via telnet to the configured port and log in with a username and password. Authentication is handled as follows:

Configuring the Control Port Interface

Below is an example configuration that demonstrates how to enable and configure the control port. This example shows three configuration sections:

  1. The nscp module is loaded in the /modules section for $server.

  2. The /module/nscp section defines the control port parameters.

  3. The /module/nscp/users section defines optionally the configured control port users.

 #
 # Control port -- nscp
 #
 ns_section ns/server/${server}/module/nscp {
   ns_param   port                   9999       ;# Control port listens on port 9999
   ns_param   address                127.0.0.1  ;# For security, use 127.0.0.1 only
   #ns_param  allowLoopbackEmptyUser on         ;# default: off
   ns_param   echopasswd             off
   ns_param   cpcmdlogging           off
}
 
 # Optional configuration of control port users
 ns_section ns/server/${server}/module/nscp/users {
   #
   # The default password for nsadmin is "x". You should change it.
   # For example, type "ns_crypt /newpassword/ /salt/" and put the encrypted string
   # below.
   
   ns_param user "nsadmin:t2GqvvaiIUbF2:" ;# sample user="nsadmin", pw="x".
 }
 
 ns_section ns/server/${server}/modules {
   # ...
   ns_param nscp nscp.so
 }

Important points regarding this configuration:

See the Configuration Reference for complete information on configuration.

COMMANDS

The nscp module defines a single command:

nscp users

Returns the list of usernames permitted to connect via the control port.

Using the Control Port Interface

To use the control port interface, follow these steps:

  1. Connect via Telnet: Telnet to the IP address and port specified in the /module/nscp section. For example:

     telnet 127.0.0.1 9999
    

    Upon connecting, the session will display:

     Trying 127.0.0.1...
     Connected to localhost.
     Escape character is '^]'.
     login:
    
  2. Login: At the login prompt, enter a valid username as defined in the /module/nscp/users section. For example:

      login: nsadmin
    

    The session will then prompt for a password:

     password:
    
  3. Enter Password: Type the password associated with the username (the default is "x"). We assume here, that the nsperm module is not loaded. If the credentials are correct, the session will display a welcome message similar to:

     Welcome to SERVER running at /usr/local/ns/bin/nsd (pid NNNNNN)
     NaviServer/MAJOR.MINOR:PATCHLEVEL for linux built on MON/DAY/YEAR at HH:MM:SS
     SERVER:nscp 1>
    
  4. Execute Commands: At the control port prompt, you can execute nearly any Tcl command available in NaviServer's Tcl libraries and ADP pages.

  5. Exit: To log off from the control port, simply type exit.

Useful Commands

When connected via the the control port, you might the find the following plain Tcl commands to be useful:

 lsort [info commands]

This command returns a complete list of available commands. You can also execute nearly any Tcl command, including core Tcl commands and any ns_* commands. To see a sorted list of NaviServer Tcl commands, type:

 lsort [info commands ns*]

Some useful NaviServer commands for nscp are:

See Also

admin-maintenance, ns_conn, ns_info, ns_shutdown

Keywords

configuration, module, nscp