Product Documentation and Knowledge Base - HomeDocumentation


Charon-VAXCharon-AXPCharon-PDPCharon-SSPCharon-PAR

Tips and Tricks

‘vi’ text editor

Notes:

  • When typing text, press ESC once finished. In case you’re blocked, press also ESC before executing commands described below
  • ‘vi’ is case sensitive

Request

Command

To quit without saving

Press ‘:’ then enter ‘q!’

To quit with saving

Press ‘:’ then enter ‘x’ or ‘wq’

Go to  top of file

Press ‘:’ then enter ‘0’

Go to last line

Press ‘G’

Search pattern

Press ‘/’ then enter your search text. Press then ‘n’ for next (forward) or ‘N’ for backward

Remove current character

Press ‘x’

Insert text

Press ‘i’ (press ESC once text completed)

Insert line

Press ‘o’ for a line below cursor, ‘O’ for a line above cursor (press ESC once text completed)

Delete a line

Press ‘dd’

 

‘gedit’ graphical editor

‘gedit’ is a graphical text editor, users familiar with Windows notepad should not encounter difficulties to use it.

Request

Command

To quit

close the window by clicking on the cross top right corner

Save file

Press <CTRL-S>

 

‘nano’ text editor

‘nano’ is a basic text editor, very simple to use and displaying available commands at the bottom of the screen. For example, to leave ‘nano’ , use ^X (press CTRL + X)

 

How to setup ‘ssh’ trusts between Linux and Tru64

Notes

  • The prompts will tell you where to execute the commands, Tru64# (root user) or Linux#  (root user)
  • Remember Linux/Unix is case sensitive
  • If hosts are not knows by each other, fill the /etc/hosts file (using .vi. or .nano. for example)

 

  • Generate the key

Linux# cd /root/.ssh
Linux# ssh-keygen -t dsa
Linux# ssh-keygen -e -f id_dsa.pub > tru64host.pub

 

  • Copy the tru64host.pub file, or use copy/paste, in the /.ssh2 folder on the Tru64 host

  • Define the authorization file:

Tru64# cd /.ssh2
Tru64# echo "Key tru64host.pub" >> authorization

 

  • Initialize the first ssh connection (answer 'yes' to confirm)

Linux# ssh tru64host date

then retry the same command to verify the trust is working.


How to setup ‘ssh’ trusts between Linux and VMS

Notes

  • The prompts will tell you where to execute the commands, VMS# (system user) or Linux#  (root user)
  • Remember Linux/Unix is case sensitive, VMS is not
  • Linux: if VMS host is not known, add it to /etc/hosts (using .vi. or .nano. for example)
  • VMS: if Linux is not known, add it using: $ UCX SET HOST LINUX /ADDR=xx.xx.xx.xx
  • Enable SSH on the VMS server:

VMS$ SET DEF SYS$LOGIN
VMS$ @TCPIP$CONFIG

 

Select then:

  • Option 3 - Server components then enable and start service SSH, option 19
  • then Option 2 - Enable & Start service on this node

 

...
* Create a new default server host key? YES: YES
     Creating private key file: TCPIP$SSH_DEVICE:TCPIP$SSH.SSH2]HOSTKEY
     Creating public key file: TCPIP$SSH_DEVICE:TCPIP$SSH.SSH2]HOSTKEY.PUB
...

 

  • If VMS has to connect to Linux, configure the SSH CLIENT:

 

...
* Do you want to configure SSH CLIENT [NO]: YES
...

Select then:

  • Option 2 - Enable & Start service on this node
  • Exit with E twice

 

  • Copy these files from the default SSH user for the SYSTEM one:

 

VMS$ SET DEF SYS$LOGIN
VMS$ CREATE/DIR [.SSH2]
VMS$ COPY TCPIP$SSH_DEVICE:[TCPIP$SSH.SSH2]HOSTKEY [.SSH2]
VMS$ COPY TCPIP$SSH_DEVICE:[TCPIP$SSH.SSH2]HOSTKEY.PUB [.SSH2]
VMS$ COPY TCPIP$SSH_DEVICE:[TCPIP$SSH.SSH2]SSH2_CONFIG [.SSH2]
VMS$ EDIT [.SSH2]SSH2_CONFIG

(warning) Uncomment: BatchMode      yes

(warning) Find and set: AllowedAuthentications               publickey, password

 

  • Generate the key and convert it to be readable by VMS

 

...
* Do you want to configure SSH CLIENT [NO]: YES
...

Linux# ssh-keygen -t dsa (then 3 times Enter with default values)
Linux# ssh-keygen -e -f /root/.ssh/id_dsa.pub > /root/.ssh/linux.pub

 

  • Copy the file /root/.ssh/linux.pub, or use copy/paste, to the VMS system in the SYS$SYSROOT:[SYSMGR.SSH2] directory

 

  • Copy the hostkey.pub file from the VMS system to the Linux one:

 

Linux# ssh system@VMS "type [.SSH2]HOSTKEY.PUB" >/root/.ssh/VMS.orig.pub

(warning) Enter YES then the VMS system password

 

  • Import the VMS public key and add it to the authorized keys:

Linux# ssh-keygen -i -f /root/.ssh/VMS.orig.pub >/root/.ssh/VMS.pub
Linux# cat /root/.ssh/VMS.pub >>/root/.ssh/authorized_keys

 

  • Define the VMS identification file:

 

VMS$ SET DEF SYS$SYSLOGIN
VMS$ SET DEF SYS$SYSROOT:[.SSH2]
VMS$ OPEN/WRITE TMP IDENTIFICATION.
VMS$ WRITE TMP "IDKEY HOSTKEY"
VMS$ CLOSE TMP

(warning) Do not forget the dot at the end of the identification file name


  • On the VMS system add the Linux key to the authorized keys:

 

VMS$ SET DEF SYS$SYSLOGIN
VMS$ SET DEF SYS$SYSROOT:[.SSH2]
VMS$ OPEN/WRITE TMP AUTHORIZATION.
VMS$ WRITE TMP "KEY LINUX.PUB"
VMS$ CLOSE TMP

(warning) Do not forget the dot at the end of the authorization file name

 

  • Perform tests (examples)


Charon server name "charon", vms system name "pluto":

charon# ssh system@pluto "show system"
OpenVMS V7.3-2 on node PLUTO 27-SEP-2013 11:50:14.37 Uptime 0 19:20:07
Pid Process Name State Pri I/O CPU Page flts Pages
00000201 SWAPPER HIB 16 0 0 00:00:02.55 0 0
00000204 LANACP HIB 14 70 0 00:00:00.05 109 135
...

 

Shutdown guests with Expect tool

Introduction

In case SSH cannot be used to perform clean shutdown of the guests, the ‘expect’ tool can be used to connect to the console and perform the login operation then execute the shutdown command.

(info) In that case the password is sent without encryption.

To facilitate use of ‘expect’ for shutdown, an example is provided in the script 'guest_shutdown.exp' located in the /opt/charon/utils folder. It is recommended not to use directly this script but to create a copy if you plan to customize the script, otherwise it could be overwritten with new distribution kit.

(warning) Console locked: one must kill any ‘telnet’ session connected to the localhost/port (this is not done inside the expect script) before using the expect script

This script can handle the following situations:

  • Guest console not connected
    • Expect: ‘Username: ’ (VMS) or ‘login: ‘ (Tru64)
    • Action: An interactive session will be initiated based on <user> and <password> provided
  • Guest console with user connected
    • Expect: prompt
    • This user must have privileges to perform shutdown
    • Action: Depending on the Operating system parameter (see <opsys> below), the shutdown command will be sent
  • Guest console at SRM prompt
    • Expect: ‘>>>’ (so works with VAX and Alpha with ‘P00>>>’)
    • Action: A 'power off' command will be issued. If it does not succeed the F6 key will be sent (must be enabled within the configuration file). If the F6 key did not stop the emulator the script will exit with error code 9 meaning you will have to kill the emulator process yourself. Examples are provided within the '/opt/charon/utils/charon_gstart.stop.example' file.

 

Script usage

Usage:

# path/script <port> <user> <password> <prompt> <opsys>

 

Parameters:

ParameterDescription
<port>telnet port number (example: 10003)
<user>username for login (must be able to perform shutdown)
<password>password
<prompt>shell prompt (including end space)
<opsys>VMS or UNIX

 

Example: (example is given in charon_gstart.stop.example)

 



© Stromasys, 1999-2024  - All the information is provided on the best effort basis, and might be changed anytime without notice. Information provided does not mean Stromasys commitment to any features described.