2.7.3. SSH connection and script execution
Here are the steps to perform to establish the connection to the machine using SSH/WinSCP. The goal is to bring the edited script to the machine with the customer data.
To perform the configuration, you will have to edit our script to have the client data before generating the user in the database - the appropriate editions for the script and how to run it is described in the following sections.
You can edit the script on our own system, send it to the remote system via WinSCP and run it from our SSH login.
Since the script has few lines, we could also not use WinSCP, and simply paste the contents of the script into a terminal text editor (nano, vi, ...) in our SSH login and then run it.
In order to make the connections, it will also be necessary that you are connected to the VPN of b+dgtal, our user should have been previously authorized.
The process is described below:
1- Before carrying out the connection to the machine it will be necessary to have: |
|
2- Connection via PuTTY. |
|
Once you have started SSH, you should have access to the machine's file system. Moves to the download directory: |
If you do not want to use WinSCP, once you have made the necessary edits to the script, you can open a text editor and create the corresponding file. Press i, and paste the contents once copied with right click. Save and leave with: wq |
3- Connection via WinSCP |
|
Once logged in, and once you have completed the necessary script edits described in the following sections, you can drag the script file from the local file system to the remote file system using the WinSCP graphical interface. |
4- Once we have changed the data of the script, we execute it, there are two methods to execute it: From terminal command or from graphic interface with pgadmin. |
a- You can execute the script directly from a terminal, indicating as an argument the location of the script |
Fuse Case |
psql -U fuseadmin -d siiprod_db -a -f ~/Downloads/fuse_conf/scripts-sql/GeneraciondetablasPostgreSQLv1.sql |
Pasarela Cse |
psql -U fuseadmin -d siiprod_db -a -f ~/Downloads/fuse_conf/scripts-sql/GeneraciondetablasPostgreSQLPASARELAv1.sq |
b- Execution using pgadmin (if graphic option is available from SSH) |
|
5- Verify proper script execution |
psql -U fuseadmin -d siiprod_db –x -c 'SELECT * FROM "AGRUPACION_EXT";' |
6- Change the tenant and security key |
Change the values of "wsaeat.clave", with a key (UUID) generated to secure the encryption of certificate data (the key must be unique for each environment). |
Avvale 2024