击:控制SSH [英] Bash: controlling SSH

查看:128
本文介绍了击:控制SSH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个庆典文件,要求IP,密码等使用OpenSSH的设备。

现在,如果我使用 SSH根@ IP ,我必须输入密码。这真是让人恼火。其次;我不能让我的脚本命令发送到它。

这是我想要的 - >


  1. 不是密码的事情;我已经发现了一些;但它告诉我的命令都没有发现?

    #!的/ usr / bin中/期望-f

    重生SSH根@ $ IPADDR

    期望密码:

    睡眠1

    发送$ rpass \\ R


    1. 我希望用户能够看到某些菜单它可以选择;之后;每一个命令是为他做。因此,像一个新的窗口,或者类似的东西?


    2. 我不希望使用:
      - 任何外部的东西
      SSH连接的额外 - 无修改



BASH信息:GNU猛砸,V 4.0.33(1) - 释放(的i486-PC-Linux的GNU),在Linux上运行的薄荷。但它必须是可用于多个Linux发行版的,而且也可以在Mac?


解决方案

很多工具去竭尽全力prevent你在做什么。我建议使用ssh公共密钥,而不是来解决密码这个问题。

大方法是编写基于开源你自己修改SSH客户端,以便采取密码管理的控制权。

哦,我忘了。你也许可以用PTY智取这一点,因为然后是/ dev / tty的将是你控制什么。希望可以帮助你们。

I have this bash file, which asks for IP, password, etc. for OpenSSH to a device.

Now, if i use ssh root@ip, i have to enter the password. This is really irritating. Secondly; i cannot let my script send commands to it.

This is what i want->

  1. Not the password thing; i already found something; but it tells me the commands are not found?:

    #!/usr/bin/expect -f

    spawn ssh root@$IPADDR

    expect "password:"

    sleep 1

    send "$rpass\r"

    1. I want the user to be able to see some menus where it can choose from; after that; every command is done for him. So like a new window, or something like that?

    2. I do not want to use: -Any external stuff -No extra editing of the SSH connection

BASH INFO: GNU Bash, v. 4.0.33(1)-release (i486-pc-linux-gnu), running on Linux Mint. But it got to be available for several linux distro's, and also on Mac?

解决方案

Many tools to go great lengths to prevent what you are doing. I recommend using ssh public keys to solve this problem instead of passwords.

The big alternative is to write your own modified ssh client based on the open source so as to take control of the password management.

Oh, well, I forgot. You can probably outsmart this with a pty, since then /dev/tty will be what you control. expect might help you with this.

这篇关于击:控制SSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆