Windows Telnet (telnetd.exe)


After connecting to the telnetd service and giving your password you will be logged into the Windows system in a simple pass-through mode and be sitting at a normal Windows command shell. You may however change the startup program from cmd.exe to any jBASE program including the jsh.exe (jSHELL).

The jBASE telnetd service is supported on all jBASE supported Windows platforms, including Windows NT, Windows 2000, Windows XP Professional (not XP Home), Windows 2003 Server, Windows 7 Professional, Windows 2008 Server (64-bit), Windows 2012 and Windows 2012 R2 (64-bit).

Account Naming Issues

Windows account names can exist in several name spaces.  For example a Windows station in an Advanced Server domain has a local “Administrator” account and also has a corresponding “Administrator” account in its default domain. jBASE TCP Remote Logon Services use the following rules to disambiguate account names:

·         If the account name is qualified (contains a backslash), the name preceding the backslash is first treated as a domain name, if there is no corresponding domain, then it is treated as a machine name. (Example: “MainDomain\Administrator”).

·         If the account name is not qualified (does not contain a backslash), the name is first looked up on the local machine.  If the account name is not found, it is then looked up in the default domain of the machine.

User Environment.

When users logon, their environment will contain all system-wide environment variables that are set on the local system.  They will not receive their normal user environment settings at this moment in time (the Win32 API does not provide this ability), however, this will change in a future release.  To circumvent this omission in the Win32 API, the jBASE TCP Remote Logon Services automatically set the following environment variables:

USERDOMAIN

The domain name in which the user account is defined.
USERNAME The account name of the user.
HOMEPATH The path name of the home directory of the user. If the user’s home directory is a remote path, then this will contain the Universal Naming Convention (UNC) name of the user’s home directory.
HOMESHARE Always set to NULL. See the comments on remote directories below.
HOMEDRIVE If the user’s home directory is local, this contains the drive letter followed by a colon. If the home directory is remote, this is set to NULL.
JBC_TELNET_FLAG This is set so that a user process can determine if it is being run via telnet session or via the console.

Because the remote user shares the drive map with all other users, it is not possible to automatically mount a remote user’s remotely named directory on its normal drive letter.  However many sites may wish to establish conventions whereby remote users are allowed to use certain drive letters remotely.  Further, other environment variables may need to be set at logon.  Thus the jBASE TCP Remote Logon Services execute the file “remote.cmd” if present in the user’s home directory. If a remote user’s home directory is specified as a remote directory, the user’s initial directory will be “C:\”.  If desired, this can be overridden in “remote.cmd”.

If the user's home directory does not exist or is not defined in the user's Profile, they will go to the default C:\users\default. If this directory does not exist then an error message will be displayed and the user will not be allowed to login. If the directory contains a remote.cmd file then it will be executed.

By default if the user has a “
remote.cmd” file, this will be read by the telnet process, and parsed, the first command it finds will be executed.  This file is intended mainly to allow the user to set up the environment, and so this parsing is primitive, for example only the first command it finds is executed, so a remote.cmd” created by the jBASE “iju” for instance this will be the jsh.  To disable this feature and have the Windows command proceessor read the file, the registry setting ParseProfile should be set to 0. (see below).  You should therefore avoid using commands such as “cd” and “call”.

If supported by the telnet client, then the TERM variable will also be set.

 

Customization 

WARNING : You can edit the registry by using Registry Editor (Regedit.exe or Regedt32.exe). If you use Registry Editor incorrectly, you can cause serious problems that may require you to reinstall your operating system. jBASE does not guarantee that problems that you cause by using Registry Editor incorrectly can be resolved. Use Registry Editor at your own risk.

NOTE: If you change or create any of the registry entries below, you will need to stop and then restart the jBASE telnetd service with the new or changed values before those entries will take effect.

NOTE: The location of the jBASE telnetd registry entries is different on Windows 64-bit systems. This is notated where appropriate.

1.      Presenting a banner to the remote user after logon.

Create a registry entry of type REG_SZ with the name Banner under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion   (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

In the "Value data:" string, the sequence "\n" generates an end of line output, to use the '\' characters in the banner string use two '\' characters in a row.

Example:  

Name Type Data
Banner REG_SZ Welcome to jBASE\nThe Multi-value database of the future\n

2.      Presenting a banner to the remote user prior to logon.

Create a registry entry of type REG_SZ with the name PreBanner under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

In the "Value data:" string, the sequence "\n" generates an end of line output, to use the '\' characters in the banner string use two '\' characters in a row.

Example:

Name Type Data
PreBanner REG_SZ jBASE telnet process\nPlease log into system\n

3.      Changing the logon prompt.

Create a registry entry of type REG_SZ with the name LogonPrompt under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

Example:

Name Type Data
LogonPrompt REG_SZ Windows User Name:

If this registry value is not present, the default logon prompt is "Account Name: ".

4.      Changing the password prompt.

Create a registry entry of type REG_SZ with the name PasswordPrompt under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

Example:

Name Type Data
PasswordPrompt REG_SZ Windows Password:

If this registry value is not present, the default password prompt is "Password: ".

5.      Changing the Failed logon message.

Create a registry entry of type REG_SZ with the name FailedLogonMessage under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

In the "Value data:" string, the sequence "\n" generates an end of line output, to use the '\' characters in the banner string use two '\' characters in a row.

Example:

Name Type Data
FailedLogonMessage REG_SZ \nFailed logon...Valid "WINDOWS" USER/PASSWORD?\n

If this registry value is not present, the default message  is:

"Logon failed: unknown user name, password or privilege incorrect."

6.      Logging user logon/logoff messages in the registry.

Create a registry entry of type REG_DWORD with the name LogEventLogon under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

If this registry entry is present and set to 0, then normal logon and logoff events will not be logged into the registry.  If this entry is either not present, or it is set to 1, then an entry will be written into the registry whenever a user logs on or off the system.

 

7.      Changing the default command processor.

Create a registry entry of type REG_SZ with the name CommandProcessor under registry key::

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

Example:

Name Type Data
CommandProcessor REG_SZ C:\JBASE30\BIN\JSH.EXE -

This will cause the jSHELL to start up and execute the login PROC in your MD if you have one.

By default, all services invoke CMD.EXE as the command processor. By adding the registry value you can override the command processor used by all users.  NOTE: if you override the command processor, then the automatic environment setup using the REMOTE.CMD script will no longer be available.

8.      Bump up priority while logging on.

Create a registry entry of type REG_DWORD with the name IncreaseLogonPriority under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

On loaded systems, the logon process can be slow.  You can set this registry value to 1 if you want to increase the priority of the logon, AT THE EXPENSE OF OTHER PROCESSES ON THE SYSTEM.

If this registry entry is present and set to 1 then the priority of the logon process will be increased.

9.      Changing default exit detection timeout.

Create a registry entry of type REG_DWORD with the name ExitDetectionTimeout under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

Example:

Name Type Data
ExitDetectionTimeout REG_DWORD 0x000001f4 (500)

Due to a technical issue related to pipes, the telnetd server has to “guess” when a command prompt is about to exit.  This will be corrected in a later release. At those times when it this guess occurs, the telnetd server waits before doing a read of input. If this read timeout is too short, the exit detection doesn’t work, and so users need to type an extra input before the telnetd exit.  (In other words, when the user types “exit” to CMD.EXE, the telnet client will not “hang up” until the user types an extra character.)  Through internal experimentation we have found that a value of 400 milliseconds works well under most circumstances.  However some customers have found this inadequate, so we provide this value.  The value should be set to as small a value as provides the desired behavior.

If this registry value is not present, the default value is 400 milliseconds "0x00000190 (400)".

10.    Changing the number of logon attempts

Create a registry entry of type REG_DWORD with the name LogonAttempts under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

Example:

Name Type Data
LogonAttempts REG_DWORD 0x00000005 (5)

If this registry value is not present, the default value is 3 attempts "0x00000003 (3)".

11.    Parsing the “remote.cmd” file

Create a registry entry of type REG_DWORD with the name ParseProfile under registry key:

HKEY_LOCAL_MACHINE\Software\JAC\jBASE Telnetd Server\CurrentVersion    (32-bit)
HKEY_LOCAL_MACHINE\Software\Wow6432Node\JAC\jBASE Telnetd Server\CurrentVersion   (64-bit)

Example:

Name Type Data
ParseProfile REG_DWORD 0x00000000 (0)

By default the telnet service will read any remote.cmd file that it finds in a user's home directory, and execute the first command it finds.  This is efficient and avoids having a command processor for each port, however, the commands that are supported are restricted to setting environment variables (set) and echoing text (echo).  If you want the Windows command processor to parse the file then set the value to 0.

12.    Changing the jBASE telnet port number

Like all Windows services, the telnet port number used by jBASE telnetd is in the '%SYSTEMROOT%\system32\drivers\etc\services' file.

jBASE will first use the port number designated by a 'jtelnet' entry in this file. If no 'jtelnet' entry exists in the 'services' file then telnetd will use the port number designated by a 'telnet' entry.

The industry standard telnet port is 23 but it can be changed to any port number.

To change the port for jBASE telnetd, so as not to affect port number 23, you must add a 'jtelnet' entry with the desired port number. For example, the following entry in the Windows 'services' file will start the jBASE telnetd service on port 2323:

     jtelnet  2323/tcp

If jBASE telnetd is the only telnet server on the system, you could change the original 'telnet' entry to a different port number with:

     telnet  2323/tcp

This would eliminate the need for a 'jtelnet' entry.

Important: The jBASE Telnetd Server must be stopped and restarted in the Windows Services panel for this change to take affect.

 

Troubleshooting / Technical Support

Event Log

The jBASE TCP Remote Logon Services report error messages to the Application Event Log.  This log can be viewed using the Event Viewer application which can usually be launched by double clicking its icon in the Program Manager group:  Administrative Tools.  Make sure the Application event log is selected. (Its entry in the Log menu should have a check mark beside it... if not, select it.)

All jBASE TCP Remote Logon Services entries begin with the tag “jBASE”.  Most of the error messages are self explanatory.  Any error codes mentioned are standard Windows error codes as returned by GetLastError(). Your VAR should be able to help you with any errors here.

On rare occasions you may have a service failure.  These are logged by the Service Control Manager in the System Log.

List of known problems

1.             Eventlog says: jBASE Command Starter: CreateProcess: 5

This means that an account with Administrator privileges tried to logon, but that account does not have sufficient rights to execute transcmd.exe. The error cannot be caught sooner as Administrator accounts have a large number of privileges that allow all other operations up to this point to succeed.

2.             Service Manager can’t find .exe or Start failed: 2

Usually this error means that you’ve moved the software after you installed it.  Services cannot be moved after installation as an absolute path name is stored.  To correct the problem, remove, then reinstall the software.

3.             Access denied when accessing a drive mounted with NET USE.

Because Windows wasn’t initially designed with the idea of more than one interactive user logged on at the same time, oddities often occur when accessing remote drives via a drive letter in the shared drive map. Most users seem to have better results when accessing remote drives via the SUBST command.  Accessing remote drives via UNC names also works and is recommended.

4.             Login failure messages in the Event Log every minute.

This is due to a bug in Compaq’s Insight Manager program.  Compaq has provided a work-around:  Upgrade to version 2.60b or newer of the Insight Manager product, then use the Control Panel for the Insight Manager product to disable telnet detection.  Compaq is working on a better solution.

5.             Program exits immediately with no output.

The most likely problem is that you have a needed DLL missing from your PATH. Because telnetd users need to see the error messages in a non-GUI form, we set things so that Windows will not let an error pop-up box occur for this error, but rather cause the error code to be returned to the calling program.  In most instances this setting has the desired effect of letting a remote error see the error message,  however, for reasons unknown to us, Microsoft has made the CMD.EXE suppress the error message for a missing DLL.  This is particularly odd because it would be necessary for Microsoft to have written CMD.EXE to explicitly ignore that error.