Уход от com соединения. Как можно заменить для linux?
Всем привет.
Есть модуль в котором идет обращение к приложению
Как можно переписать данный вызов под Linux?
Есть модуль в котором идет обращение к приложению
sessionOptions = Новый COMОбъект("WinSCP.SessionOptions"); //Создаем объект SessionOptions
sessionOptions.HostName = HostName;
sessionOptions.UserName = UserName;
sessionOptions.Password = Password;
sessionOptions.SshHostKeyFingerprint = SshHostKeyFingerprint;
session = Новый COMОбъект("WinSCP.Session"); //Создаем объект SessionOptions
// Подключаемся
session.Open(sessionOptions);
ПоказатьКак можно переписать данный вызов под Linux?
Ответы
Подписаться на ответы
Инфостарт бот
Сортировка:
Древо развёрнутое
Свернуть все
(7) запили это на приличном языке программирования или сделай скрипт, который всегда можнго запустить, выполнив команду системы bash -c commandline. Для доступа к sftp есть
NAME
scp — OpenSSH secure file copy
SYNOPSIS
scp [-346BCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file]
[-J destination] [-l limit] [-o ssh_option] [-P port] [-S program]
source ... target
DESCRIPTION
scp copies files between hosts on a network. It uses ssh(1) for data
transfer, and uses the same authentication and provides the same security
as ssh(1). scp will ask for passwords or passphrases if they are needed
for authentication.
The source and target may be specified as a local pathname, a remote host
with optional path in the form [user@]host:[path], or a URI in the form
scp://[user@]host[:port][/path]. Local file names can be made explicit
using absolute or relative pathnames to avoid scp treating file names
containing ‘:’ as host specifiers.
Показатьscp — OpenSSH secure file copy
SYNOPSIS
scp [-346BCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file]
[-J destination] [-l limit] [-o ssh_option] [-P port] [-S program]
source ... target
DESCRIPTION
scp copies files between hosts on a network. It uses ssh(1) for data
transfer, and uses the same authentication and provides the same security
as ssh(1). scp will ask for passwords or passphrases if they are needed
for authentication.
The source and target may be specified as a local pathname, a remote host
with optional path in the form [user@]host:[path], or a URI in the form
scp://[user@]host[:port][/path]. Local file names can be made explicit
using absolute or relative pathnames to avoid scp treating file names
containing ‘:’ as host specifiers.
(13) https://linuxize.com/post/how-to-setup-passwordless-ssh-login/ - возможно поможет. SCP спасет отцов и матерей русской демократии (может быть).
(8) а как его подключить? Вот получилось написать такое, только как проверить в работе с 1с....
Очень нужна помощь. Первый опыт написания таких вещей и вызов их из 1с
Очень нужна помощь. Первый опыт написания таких вещей и вызов их из 1с
#import functools
import paramiko
from io import StringIO
class AllowAnythingPolicy(paramiko.MissingHostKeyPolicy):
def missing_host_key(self, client, hostname, key):
return
adress = '10.10.10.10'
username = 'CM'
password = 'PASS'
key = 'ssh-ed22211 222 21:4r:5y:7u:1s:55:96'
keyfile = StringIO(key)
# key = paramiko.RSAKey.from_private_key(keyfile)
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #AllowAnythingPolicy())
client.connect(adress, username = username, password = password, pkey = keyfile)
def my_callback(filename, bytes_so_far, bytes_total):
print ('Transfer of %r is in progress' % filename)
sftp = client.open_sftp()
sftp.chdir('/CM-CDR-EXP/')
for filename in sorted(sftp.listdir()):
#if filename.startswith('Temat'):
#callback_for_filename = functools.partial(my_callback, filename)
sftp.get(filename, 'D:/') #callback=callback_for_filename)
client.close()
Показать
У меня выдает ошибку 127 при попытке запуска приложения
127 - "команда не найдена" (Проблема связана либо с переменной окружения $PATH, либо с неверным написанием имени команды)
Не знаете в чем может быть дело?
КомандаЗапускаСкрипта = timeout 10s /bin/bash '/tmp/v8_7UBmWF_11.sh' >> '/tmp/v8_7UBmWF_12.log'
127 - "команда не найдена" (Проблема связана либо с переменной окружения $PATH, либо с неверным написанием имени команды)
Не знаете в чем может быть дело?
Для получения уведомлений об ответах подключите телеграм бот:
Инфостарт бот