Shell Command sshpass non-interactive SSH password verification, sshpassssh
Shell Command sshpass non-interactive SSH password verification
# Install sshpasssshpass
: Http://sourceforge.net/projects/sshpass/
Download it as a tar.gz compressed package.
$ Tar-zxvf sshpass-1.05.tar.gz
$ Sshpass-1.05 cd
$./Configure -- prefix =/opt/sshpass
# Specify the installation directory
$ Make
$ Make install
$ Cp/opt/sshpass/bin/sshpass/usr/bin/
Installation Complete
# View help
Sshpass-h
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
-H Show help (this screen)
-V Print version information
At most one of-f,-d,-p or-e shoshould be used
#! /Bin/bash
Cd $ (dirname $0)
Source./config. sh
Date = 'date + % Y-% m-% d'
# Upload the DUMP script to the server
Sshpass-pyour_pwd scp-P22./dump. sh your_user@192.168.1.10 :~ /
#-O StrictHostKeyChecking = no to avoid public key check during the first logon.
Sshpass-pyour_pwd scp-o StrictHostKeyChecking = no-P22./dump. sh your_user@192.168.1.10 :~ /
# Log on to the server address and run the DUMP script to write the execution result to a local file.
Sshpass-pyour_pwd ssh-p22 your_user @ 192.168.1.10 "sh ~ /Dump. sh "> local_result.txt
# Use the password in the file
Sshpass-f pwd. file ssh-p22 your_user@192.168.1.10 "sh ~ /Dump. sh "> local_result.txt
# Read the password from the environment variable (SSHPASS)
Sshpass-e ssh-p22 your_user@192.168.1.10 "sh ~ /Dump. sh "> local_result.txt
In linux, how does one remotely log on to another machine using shell scripts to execute the command username/password for stopping the process: test/12345 h?
Enter the password for the ssh test@10.1.1.8.
Ps-ef view process pid
Or netstat-ntpl
Kill-9 process pid
When python calls shell commands, you sometimes need to manually enter the password (such as ssh ).
Dedicated CT is dedicated to this de
I have searched for a lot of information on the Internet. I have done this, so it is roughly as follows:
Secondary CT
Spawn ssh 192.168.1.1
Wrong CT "login :"
Send "wuhuhu"
CT "Pasword :"
Send "123456"