Skip to content

cannot upload file to remote server  #248

@joeydan1

Description

@joeydan1

I am creating a scripts which to upload some files to remote server by a gateway server as below codes and met some errors, not sure if some things are missed, thanks.

gateway_session = SSHSession(gateway_ip, gateway_username, password=gateway_password).open()

remote_session = gateway_session.get_remote_session(remote_host_ip, remote_host_username, password=remote_host_password)

remote_session.put('/path/to/local_file', '/path/to/remote_file')

Error Message:

Traceback (most recent call last):
File "/usr/local/python3.7/lib/python3.7/site-packages/paramiko/sftp_client.py", line 130, in init
server_version = self._send_version()
File "/usr/local/python3.7/lib/python3.7/site-packages/paramiko/sftp.py", line 134, in _send_version
t, data = self._read_packet()
File "/usr/local/python3.7/lib/python3.7/site-packages/paramiko/sftp.py", line 201, in _read_packet
x = self._read_all(4)
File "/usr/local/python3.7/lib/python3.7/site-packages/paramiko/sftp.py", line 188, in _read_all
raise EOFError()
EOFError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test.py", line 26, in
print(remote_session.put('/fa/autoFa/fail_info', '/home/fail_info'))
File "/usr/local/python3.7/lib/python3.7/site-packages/jumpssh/session.py", line 618, in put
use_sudo=use_sudo, owner=owner, permissions=permissions, username=username, silent=True)
File "/usr/local/python3.7/lib/python3.7/site-packages/jumpssh/session.py", line 706, in file
sftp_client = self.get_sftp_client()
File "/usr/local/python3.7/lib/python3.7/site-packages/jumpssh/session.py", line 551, in get_sftp_client
return paramiko.sftp_client.SFTPClient.from_transport(self.ssh_transport)
File "/usr/local/python3.7/lib/python3.7/site-packages/paramiko/sftp_client.py", line 170, in from_transport
return cls(chan)
File "/usr/local/python3.7/lib/python3.7/site-packages/paramiko/sftp_client.py", line 132, in init
raise SSHException("EOF during negotiation")
paramiko.ssh_exception.SSHException: EOF during negotiation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions