sshpass

Linux(11):期中架构(3)--- SSH远程管理服务 & ansible 批量管理服务

旧街凉风 提交于 2020-04-30 16:17:08
SSH远程管理服务 1. 远程管理服务知识介绍 # 1.1 SSH远程登录服务介绍说明 SSH是Secure Shell Protocol的简写,由 IETF 网络工作小组(Network Working Group)制定; 在进行数据传输之前,SSH先对联机数据包通过加密技术进行加密处理,加密后在进行数据传输。确保了传递的数据安全。 SSH是专为远程登录会话和其他网络服务提供的安全性协议。 利用SSH协议可以有效的防止远程管理过程中的信息泄露问题,在当前的生产环境运维工作中, 绝大多数企业普遍采用SSH协议服务来代替传统的不安全的远程联机服务软件,如telnet(23端口,非加密的)等。 在默认状态下,SSH服务主要提供两个服务功能: a 一是提供类似telnet远程联机服务器的服务,即上面提到的SSH服务;  b 另一个是类似FTP服务的sftp - server,借助SSH协议来传输数据的,提供更安全的SFTP服务(vsftp,proftp)。 # 1.2 SSH远程登录服务排错思路 01. 检查链路是否通畅---ping(icmp协议)/tracert/ traceroute 02. 检查链路是否阻断--- 将防火墙功能关闭 03. 检查服务是否开启---ss/netstat -lntup(服务端检查) /telnet/nmap/ nc(客户端检查) #

一个简单的连续调用脚本部署代码的案例

喜你入骨 提交于 2020-04-06 01:03:17
先简单描述一下环境,Jenkins部署在私有云,从git拉取代码并编译后会调用脚本将jar包部署到阿里云的应用服务器。 阿里云应用服务器无公网IP,通过跳板机登录。就产生了连续调用脚本,穿透跳板机部署到阿里云内网的需求。 服务器信息: 主机名称 IP git server 10.150.27.51 jenkins server 10.150.27.52 jump server 1.1.1.1/192.168.2.20 app server1 192.168.2.21 app server1 192.168.2.22 拓扑图如下: 1.部署脚本01-backend-earphone-8888.sh (Jenkins server) 主要实现功能: 将跳板机1.1.1.1上面临时目录/data/deploy/pccode/earphone内容情况 拷贝Jenkins编译生成的jar包文件(earphone-1.08888.jar)至跳板机/data/deploy/pccode/earphone目录 调用跳板机脚本进行部署/data/deploy/script/earphone.sh [root@bobo365 prod]# more backend-earphone-8888.sh #!/bin/bash . /etc/init.d/functions node="1.1.1.1"

sshpass: command not found error

a 夏天 提交于 2020-01-11 05:09:18
问题 I am trying to automate the file transfer or FTP from one server to the other. #!/bin/bash ### In this model, the same filename is processed on each run. ### A timestamp is added to the result file and data file is copied to the archive or error folder with a timestamp after processing. # Set current directory cd `dirname "$0"` # Set the environment variables . ./Environment.sh $0 ####################################################################################################### # #######

运用Jupyter Notebook进行系统管理

谁说我不能喝 提交于 2020-01-10 09:26:49
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> Jupyter Notebook可以将系统信息作为页面进行展示,将python等信息和shell等执行工具集成到统一的页面(参考《 IPython 6/Jupyter的magic操作符 》、 IPython的Magics魔法操作符 ),从而提供一个完整的自定义动态视图。Jupyter Notebook Server还提供Text/HTML/Markdown/JSON/YAML等多种文档编辑器以及可以打开多个并随意布局的Web shell支持,不仅可用于数据分析,也是系统管理、维护的利器。 上图,在Notebook中运行GlusterFS存储系统和Kubernetes的管理工具。 1、安装步骤 包括: JupyterLab的本地安装和使用(Ubuntu 18.04) 将Jupyter/JupyterHub/JupyterLab运行为系统服务 Jupyter notebook中的sudo问题详解 2、使用方法 Jupyter Notebook是在服务器上运行的,默认是安装(或服务)的账号。因此,所有的状态是持续的,上次打开的窗口下次在任何地方打开都是上次的状态,如果多个页面同时打开,普通页面可以刷新同步,终端shell是自动更新的。 Python代码 普通的python代码在打开notebook后,输入代码

sshpass not working properly

◇◆丶佛笑我妖孽 提交于 2020-01-02 04:35:48
问题 I'm using sshpass to pass the password non-interactive on ubuntu 11.04. when I use sshpass with scp sshpass -p '123' scp sayuj@192.168.1.51:/home/sayuj/examples.desktop ~/Desktop/ it works fine but it doesn't work with ssh sshpass -p '123' ssh sayuj@192.168.1.51 What could be the problem and how do I fix it? 回答1: I found a solution: The problem is that the new version of ssh client still has and old version of sshpass (from 2008 not changed). You can find the patch here sshpass source All

How does ssh receive password from tty?

社会主义新天地 提交于 2019-12-14 03:34:18
问题 I was wondering how openssh gets the password when login, cause I got stuck in automating entering passwords to the similar tools in linux which requires getting password from tty like ssh. Tried to understand sshpass and found that sshpass forks a child process with the same pid then enters the password under the child process. Don't know if my guess was right that ssh needs to check the right pid since I cannot stdin to the current tty using another process to enter the ssh password. 回答1:

How to get HPUX to adopt a TTY as controlling

*爱你&永不变心* 提交于 2019-12-13 03:07:46
问题 A question that came through on the sshpass mailing list (and also on stack overflow). Sshpass does not work on HP-UX. Looking at the truss output, I see the following: -u [/tmp/sshpass][14066]{3783827} fork() ................... (returning as child ...) ......... = 14064 {3783821} The child process is 14066. -u [/tmp/sshpass][14066]{3783827} setpgrp3(2)................................................. [entry] -u [/tmp/sshpass][14066]{3783827} setpgrp3(2)......................................

sshpass does not work at HPUX 11.31

旧街凉风 提交于 2019-12-11 02:58:18
问题 Does anyone successfully run sshpass at HPUX 11.31 ? I’ve compiled sshpass 1.06 at HPUX 1131, but when I run it, I got errors. The command I run : sshpass -p Abcd1234 ssh -vvv nledfd02 date I am able to connect by entering a password. Thus, the command ssh -vvv nledfd02 date works fine. The error message in the console output : debug1: read_passphrase: can't open /dev/tty: No such device or address debug3: packet_send2: adding 64 (len 50 padlen 14 extra_pad 64) debug2: we sent a password

Docker RUN fails with “returned a non-zero code: 6”

允我心安 提交于 2019-12-10 13:47:43
问题 I have the following in my docker file: RUN sudo apt-get install sshpass -y RUN sshpass -p userPassword scp -r user@server:~/data/* ./ But when I try and build my image it fails with: Exception caught: The command '/bin/sh -c sshpass -p userPassword scp -r user@server:~/data/* ./' returned a non-zero code: 6 -> [Help 1] However, if I remove these lines, build the image, ssh onto the container and manually run the command from bash it works perfectly. Can anyone tell me how to get around this?

Ubuntu上使用sshpass远程脚本免密安全交互

梦想的初衷 提交于 2019-12-10 08:42:41
在使用ssh对服务器进行远程操作时,都需要停下来输入密码,这在批量执行脚本时很不方便。 可以使用sshpass来进行执行,将password通过命令行、环境变量或者文件传递进去,从而可以完全在脚本里面跑执行命令,实现自动化的操作。这里主要分享Ubuntu上面的使用情况。 安装 sshpass,基于Debian / Ubuntu Linux 参考: https://www.cyberciti.biz/faq/noninteractive-shell-script-ssh-password-provider/ 输入命令: $ sudo apt-get install sshpass 在MacOS上安装使用:brew install http://git.io/sshpass.rb 在Linux使用sshpass 安装完毕后,直接输入sshpass将显示帮助信息。 Login 到 ssh server(server.example.com),password 为 t@uyM59bQ: $ sshpass -p 't@uyM59bQ' ssh username@server.example.com 对于shell script,你可能需要 disable host key 检查: $ sshpass -p 't@uyM59bQ' ssh -o StrictHostKeyChecking