sshpass 绕过ssh 密码交互式验证
经常我们使用脚本登入服务器的时候,如果使用ssh 命令,经常会提示密码输入,我们不得不手动输入密码,因为ssh 没有 密码的选项。
为了能绕过交互式验证,我们使用sshpass命令解决这个问题:
1. 安装
➜ Desktop sudo yum install sshpass
[sudo] password for xuyaowen:
Last metadata expiration check: :: ago on Mon Jul :: AM CST.
Package sshpass-1.06-.fc28.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!
检查是否安装
[root@yaowenxu Desktop]# rpm -qa sshpass
sshpass-1.06-.fc28.x86_64
2. 查看 sshpass 命令帮助, 也可以使用 man sshpass
NAME
sshpass - noninteractive ssh password provider SYNOPSIS
sshpass [-ffilename|-dnum|-ppassword|-e] [options] command arguments DESCRIPTION
This manual page documents the sshpass command. sshpass is a utility designed for running ssh using the mode referred to as "keyboard-interactive" password authentication, but in non-interactive mode. ssh uses direct TTY access to make sure that the password is indeed issued by an interactive keyboard user. Sshpass runs ssh in a dedicated tty, fooling
it into thinking it is getting the password from an interactive user. The command to run is specified after sshpass' own options. Typically it will be "ssh" with arguments, but it can just as well be any other command. The
password prompt used by ssh is, however, currently hardcoded into sshpass.
[root@yaowenxu Desktop]# sshpass
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
-f filename Take password to use from file
-d number Use number as file descriptor for getting password
-p password Provide password as argument (security unwise)
-e Password is passed as env-var "SSHPASS"
With no parameters - password will be taken from stdin -P prompt Which string should sshpass search for to detect a password prompt
-v Be verbose about what you're doing
-h Show help (this screen)
-V Print version information
At most one of -f, -d, -p or -e should be used
3. 使用密码验证登录
➜ ~ sshpass -p ssh root@10.66.65.15
4. ssh 第一次登录提示问题使用:
ssh -o StrictHostKeyChecking=no
来解决
➜ Desktop sshpass -p ssh -o StrictHostKeyChecking=no root@10.66.8.142
Warning: Permanently added '10.66.8.142' (ECDSA) to the list of known hosts.
Last login: Mon Jul ::
5. 优缺点
优点: 快速,便捷
缺点: 密码明文暴露,可以使用 history 命令查找到
sshpass 绕过ssh 密码交互式验证的更多相关文章
- sshpass: 用于非交互的ssh 密码验证
ssh登陆不能在命令行中指定密码,也不能以shell中随处可见的,sshpass 的出现,解决了这一问题.它允许你用 -p 参数指定明文密码,然后直接登录远程服务器. 它支持密码从命令行,文件,环境变 ...
- 终端-Linux命令之非交互SSH密码验证-Sshpass
Sshpass是使用SSH所谓的"交互式键盘密码身份验证"以非交互方式执行密码身份验证的工具 通俗来说就是 使用ssh密码登录 是需要在连接时手动输入密码的,没办法明文连接,如下图 ...
- sshpass非交互SSH密码验证
1.yum安装yum install sshpass -y1.1编译安装yum install wget -ywget http://sourceforge.net/projects/sshpass/ ...
- sshpass-Linux命令之非交互SSH密码验证
sshpass-Linux命令之非交互SSH密码验证 参考网址:https://www.cnblogs.com/chenlaichao/p/7727554.html ssh登陆不能在命令行中指定密码. ...
- 【转】sshpass-Linux命令之非交互SSH密码验证
sshpass-Linux命令之非交互SSH密码验证 ssh登陆不能在命令行中指定密码.sshpass的出现,解决了这一问题.sshpass用于非交互SSH的密码验证,一般用在sh脚本中,无须再次 ...
- [原创]内网SSH密码爆破工具sshcrack(配合Cscan批量弱口令检测)
0x000 前言 sshcrack是一个命令行下的SSH密码爆破工具,适用于内渗中SSH密码检测 当然也可用于外网SSH密码爆破,支持Windows/Linux,其它系统未测.Tip1 0x001 目 ...
- [原创]内网渗透专用SSH连接工具sshcmd/sshshell/ssh密码破解以及Kali开启SSH
目录 1.Kali开启SSH 2.SSH连接工具优缺点 3.渗透专用SSH连接工具 4.ssh执行cmd源码 5.批量SSH密码破解 6.相关工具下载 0x001 SSH配置 1.打开文件 etc/s ...
- ssh免密验证,shell批量设置
ssh免密验证,shell批量设置 #ssh免密验证,shell自动设置 echo '#!/bin/sh . /etc/init.d/functions [[ -f /usr/bin/expect ] ...
- 简单绕过Chrome密码查看逻辑,查看浏览器已保存的密码
简单绕过Chrome密码查看逻辑,查看浏览器已保存的密码 利用场景: 同事或朋友外出有事,电脑未锁屏离开座位.可以利用这一间隙,查看Ta在Chrome浏览器上保存的账号密码 查看逻辑: 当我们要查 ...
随机推荐
- Linux编辑启动停止重启springboot jar包脚本
springboot的配置文件中,配置文件的名字都有各自的意义跟用途 dev 开发环境 prod 生产环境(默认) test 测试环境 加载指定配置文件 --spring.profiles.activ ...
- [NOI 2016]网格
Description 题库链接 给出一张 \(n\times m\) 的网格,在其中删去 \(c\) 个格子,问至少再删去几个能使得图上存在两点不连通,或输出无解. 多组询问,询问组数 \(T\) ...
- 常见移动设备的 CSS3 Media Query 整理(iPhone/iPad/Galaxy/HTC One etc.)
@charset "utf-8"; /** * iPhone 4/4s landscape & portrait */ @media only screen and (mi ...
- 给RadioButtonList绑定Selected的值
有一个案例,是读取Excel的资料显示于ASP.NET的GridView控件.在GridView控件中,有一列是用RadioButtonList来显示性别信息(男或女). 另外来看看Excel的数据: ...
- 使用pl/sql的文本导入器时如何设置主键自增长
在使用文本导入器批量导入数据时,如果需要设置主键自增长,可以先创建一个序列: create sequence SEQ_Userinf start with 1 increment by 1nomaxv ...
- 数据结构与算法--最短路径之Floyd算法
数据结构与算法--最短路径之Floyd算法 我们知道Dijkstra算法只能解决单源最短路径问题,且要求边上的权重都是非负的.有没有办法解决任意起点到任意顶点的最短路径问题呢?如果用Dijkstra算 ...
- Java基础——TreeSet
TreeSet是SortedSet接口的实现类,Sorted的英文意思是分类的:选择的. TreeSet可以确保集合元素处于排序状态.与HashSet集合相比,TreeSet还提供了如下几个额外方法: ...
- Color the ball(hdu1556)(hash)或(线段树,区间更新)
Color the ball Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- 修改VS类模板自动添加public修饰符和版权注释信息
在开发过程中,我们经常需要给类或接口添加public修饰符(默认没有)和一些相关的注释信息,这个工作是机械而枯燥的,而这个简单的需求其实是可以通过修改VS自带的类模板来实现的,下面是详细的修改步骤. ...
- 线程基础的一些理解(一)(java)
一.多线程的基本概念 线程是指进程中的一个执行场景,也就是执行流程,所以我们首先要聊一聊进程,以及进程和线程的关系 1.什么是进程? 一个进程对应一个应用程序,就像我们在windows系统中启动Wo ...