Created
May 11, 2011 12:28
-
-
Save linuxbender/966372 to your computer and use it in GitHub Desktop.
SSH with plink (putty) = remote send linux command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ $- != *i* ]] ; then | |
ON_A_TTY=No | |
else | |
ON_A_TTY=Yes | |
fi | |
# check that an ssh-agent is running | |
if [ -x /usr/bin/ssh-agent ] | |
then | |
SSH_AGENT_PID=-1 | |
if [ -r ${HOME}/.ssh/agent_info ] | |
then | |
# | |
## ##################################################################### | |
## Share an already existing agent that I have started | |
## ##################################################################### | |
# | |
source ${HOME}/.ssh/agent_info | |
fi | |
# | |
## ######################################################################### | |
## Make sure the agent is still running | |
## ######################################################################### | |
# | |
if [ ! -r /proc/${SSH_AGENT_PID} ] | |
then | |
ssh-agent > ${HOME}/.ssh/agent_info | |
chmod u=rw,g=,o= ${HOME}/.ssh/agent_info | |
source ${HOME}/.ssh/agent_info # > /dev/null 2>&1 | |
# | |
## ################################################################# | |
## Newly created agent, load up my id_dsa and id_rsa identities | |
## ################################################################# | |
# | |
# now, we have an ssh-agent running, add my identity | |
# if [ "${ON_A_TTY}" = "Yes" ] | |
# then | |
# xterm -e ssh-add ${HOME}/.ssh/identity | |
# fi | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# daniel glenn | |
# | |
Wurden mit PUTTYGEN erzeugt: | |
Public Key - File Name enden mit _pub z.B: dsa_2_1024_storage.pub | |
Private Key mit der File extension *.ppk z.B: dsa_2_1024_storage.ppk | |
Beschreibung: | |
Verschlüsselungs Art : dsa | |
SSh Version : 2 | |
verschlüsselungs Stärke : 1024 bit | |
Name : storage | |
Public or private Key: .pub or *.ppk | |
Key Passphrase : password | |
#01 Den Public Key im Home {cd ~ } Profile vom User ablegen unter dem Folder { cd .ssh } | |
#02 Den Public key am ssh-again registrieren | |
#03 Test z.b mit plink unter MS Windows | |
C:\TMP\plink.exe -ssh -P 22 -2 -4 -i dsa_2_1024_storage.ppk DemoUser@www.demo.dev "cat ls -l" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#01 eval $(ssh-agent) | |
#02 chmod 0600 .ssh/dsa_2_1024_demo_pub: | |
#03 ssh-add .ssh/dsa_2_1024_demo_pub: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\TMP\plink.exe -ssh -P 22 -2 -4 -i dsa_2_1024_storage.ppk DemoUser@www.demo.dev "cat ls -l" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment