0

There is a shell script execute.sh in a remote system.

#!/bin/bash
echo "Running scp"

/home/lokesh/linuxx86-64/scpview  //scpview is my executable file

I am doing SSH to remote system from a python script.

    def SSH_Server_scp(hostname):
    print('running')
    try:
        client = paramiko.SSHClient()
        
        client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

        client.connect(hostname, port=22, username='username',
                       password='password')

        (stdin, stdout, stderr) = client.exec_command('./executescp.sh')
         
        cmd_output = stdout.read()
        print(cmd_output)
       
        return output_file
    finally:
        client.close()
 
    SSH_Server_scp('hostname')

The shell script is running perfectly fine when I run the script locally in a remote server, but its failing with "Environmental Variable 'TERM' not defined" when I invoke my shell script from python. What is that I am missing here? I tried exporting TERM environmental variable also

export TERM=xterm

Please help

0 Answers0