使用Python和Paramiko连接到自定义SSH子系统(HP NonStop上的TACL进程)

2024-05-23 13:35:27 发布

您现在位置:Python中文网/ 问答频道 /正文

如何通过Python和Paramiko建立与HP NonStop TACL流程的直接连接,而不涉及任何OSS功能

在HP NonStop SSH手册中,我可以看到以下内容(http://www.nonstoptools.com/manuals/FTP-SSH.pdf):

To Get a TACL Prompt Using a Remote SSH Client

You can also directly establish a connection to a TACL process, without involving any OSS functionality. Direct TACL access is provided by SSH2 as an SSH2 subsystem. You may connect to the TACL subsystem by specifying starting the remote SSH client with the –s option and "tacl" as subsystem name. Like with an ordinary shell session, you have to specify the Guardian userid and the IP address or host name, where SSH2 is listening on as parameters for the SSH command:

m.horst@np-dev02:~> ssh -s comf.mh@10.0.0.199 tacl    
comf.mh@10.0.0.199's password:    
TACL (T9205D46 - 19OCT2004), Operating System G06, Release G06.25.00    
(C)1985 Tandem (C)2004 Hewlett-Packard Development Company, L.P.    
CPU 1, process has no backup    
February 10, 2006 13:09:41    
(Invoking $SYSTEM.SYSTEM.TACLLOCL)    
(Invoking $DATA1.MHHOME.TACLCSTM)    
Current volume is $DATA1.MHHOME    
1>

我的问题是如何通过Paramiko指定子系统名称tacl

在腻子中,它是这样做的:连接->;SSH->;远程命令->;“tacl”

你知道我怎么能在帕拉米科做同样的事吗


Tags: thetogtyouparamikossh2isas
1条回答
网友
1楼 · 发布于 2024-05-23 13:35:27

My question is that how I can specify the subsystem name tacl via Paramiko?

ssh = paramiko.SSHClient()

# authenticate here
chan = ssh.get_transport().open_session()
chan.invoke_subsystem("tacl")
stdin = chan.makefile_stdin("wb", bufsize)
stdout = chan.makefile("r", bufsize)
stderr = chan.makefile_stderr("r", bufsize)

In PuTTY it is done like this: Connections->SSH->Remote command->tacl

不,不是。PuTTY无法执行自定义子系统。因此,如果您可以在PuTTY中使用tacl,这意味着您不需要使用子系统。在PuTTY中,您只需执行tacl命令

在帕拉米科,这很简单:

(stdin, stdout, stderr) = ssh.exec_command("tacl")

相关问题 更多 >