我可以用python做吗?关于xterm和telnet [英] Can I do it using python?? about xterm and telnet
问题描述
我是大约20个unix服务器的网络管理员,我需要经常
telnet到他们并配置他们。
这是一个累人的工作打开一个xterm和telnet,用户名,密码到每个服务器
。
我能用python自动完成吗?之后,有20个xterm
控制台打开并通过电话发送到相应的服务器。然后我
可以开始在这些xterms中输入命令。
任何建议都表示赞赏。非常感谢。
I''m a net admin for about 20 unix servers, and I need to frequently
telnet on to them and configure them.
It is a tiring job to open a xterm and telnet, username, password to
each server.
Can I do it automatically by python? After that, there have 20 xterm
consoles opened and telneted to their corresponding servers. Then I
could start to type command in these xterms.
Any suggestion appreciate. Much thanks.
推荐答案
文章< 11 ***************** ****@b68g2000cwa.googlegroups。 com>,
valpa< va ******** @ gmail.comwrote:
In article <11*********************@b68g2000cwa.googlegroups. com>,
valpa <va********@gmail.comwrote:
>我是大约20个unix服务器的网络管理员,我需要经常telnet到他们并配置他们。
打开一个xterm和telnet,用户名,密码是一个累人的工作
每个服务器。
>I''m a net admin for about 20 unix servers, and I need to frequently
telnet on to them and configure them.
It is a tiring job to open a xterm and telnet, username, password to
each server.
不要使用telnet。它很笨拙并且存在安全问题。
使用带RSA或DSA密钥的ssh。然后你只需:
ssh用户名@ machine_name
在xterm中你被记录为服务器上的用户名
machinename。它更安全,更可靠。
如果你在谈论机器的初始设置(操作系统安装或
无论如何),我们的解决方案是安装后的CD或软盘,以获取标准服务器配置数据。这包括我们的ssh-key发行版的ssh
公钥,因此在运行
安装后光盘后,我们可以推出员工ssh-key并登录
可用。
-
Jim Segrave(je*@jes-2.demon.nl)
Don''t use telnet. it''s clumsy and has security issues.
Use ssh with RSA or DSA keys. Then you simply do:
ssh username@machine_name
in an xterm and you are loggedis as user username on server
machinename. It''s vastly more secure and more reliable.
If you''re talking about initial setup of a machine (OS installation or
whatever), our solution was to have a post-install CD or floppy which
fetched standard server configuration data. This included an ssh
public key for our ssh-key distribution, so after running the
post-install disc, we could push out staff ssh-keys and logins were
available.
--
Jim Segrave (je*@jes-2.demon.nl)
Jim Segrave写道:
Jim Segrave wrote:
文章< 11*********************@b68g2000cwa.googlegroups。 com>,
valpa< va ******** @ gmail.comwrote:
In article <11*********************@b68g2000cwa.googlegroups. com>,
valpa <va********@gmail.comwrote:
我是网络管理员对于大约20个unix服务器,我需要经常对他们进行
telnet并配置它们。
打开xterm和telnet,用户名,密码是一件很累的工作每个服务器
。
I''m a net admin for about 20 unix servers, and I need to frequently
telnet on to them and configure them.
It is a tiring job to open a xterm and telnet, username, password to
each server.
不要使用telnet。它很笨拙并且有安全问题。
Don''t use telnet. it''s clumsy and has security issues.
如果你在防火墙后面那么无关紧要。
if youre behind a firewall then it shouldnt matter.
>
将ssh与RSA或DSA密钥一起使用。然后你只需:
ssh用户名@ machine_name
在xterm中你被记录为服务器上的用户名
machinename。它更安全,更可靠。
如果你在谈论机器的初始设置(操作系统安装或
无论如何),我们的解决方案是安装后的CD或软盘,以获取标准服务器配置数据。这包括我们的ssh-key发行版的ssh
公钥,因此在运行
安装后光盘后,我们可以推出员工ssh-key并登录
可用。
>
Use ssh with RSA or DSA keys. Then you simply do:
ssh username@machine_name
in an xterm and you are loggedis as user username on server
machinename. It''s vastly more secure and more reliable.
If you''re talking about initial setup of a machine (OS installation or
whatever), our solution was to have a post-install CD or floppy which
fetched standard server configuration data. This included an ssh
public key for our ssh-key distribution, so after running the
post-install disc, we could push out staff ssh-keys and logins were
available.
我不认为OP想要进行安装后配置(我可能是错误的b $ b!)但是要改变一些配置文件。
您应该能够创建一个包含用户名=密码的字典,
然后迭代这个字典并使用os.system(" xterm - e telnet -u
%s -p%s")其中-u是用户名,-p是密码(我不太确定
,如果telnet有这些参数或者如果它的工作方式也是如此)
干杯
I dont think the OP wants to do post-install configuration (i may be
wrong! ) but to change for example some config file.
You should be able to create a dictionary containing username=password,
then iterate over this dictionary and use os.system("xterm -e telnet -u
%s -p %s") where -u is username and -p is password (im not quite sure
if telnet has these arguments or if it works like this too)
Cheers
尝试pexpect。
http://pexpect.sourceforge.net/
valpa写道:
try pexpect.
http://pexpect.sourceforge.net/
valpa wrote:
我是大约20台unix服务器的网络管理员,我需要经常
telnet on和配置它们。
打开一个xterm和telnet,用户名,密码到每个服务器的
这是一项很累人的工作。 br />
我可以通过python自动完成吗?之后,有20个xterm
控制台打开并通过电话发送到相应的服务器。然后我
可以开始在这些xterms中输入命令。
任何建议都表示赞赏。非常感谢。
I''m a net admin for about 20 unix servers, and I need to frequently
telnet on to them and configure them.
It is a tiring job to open a xterm and telnet, username, password to
each server.
Can I do it automatically by python? After that, there have 20 xterm
consoles opened and telneted to their corresponding servers. Then I
could start to type command in these xterms.
Any suggestion appreciate. Much thanks.
这篇关于我可以用python做吗?关于xterm和telnet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!