The Open Source Swiss Army Knife

/unix/shells/bash/
/unix/shells/bash/ + sub-categories
http://www.sirfsup.com/
web directory content
    
      

Not logged in
Chat Register Login
return to:  http:/www.sirfsup.com      /unix   /shells   /bash 
sub-categories and articles

                                                  
direxpansion add
dirfile-tests add
dirfunctions examples of some stdlib functions: rand, printf, strtok
dirmenus bash processing ARGV command line options
dirpos_params add
   --->create new sub-category


2.html
shell script to copy and run a shell script to another server over SSH connection

Re: mysterious connection breakdown - resolved

 Forum:   SecurePoint - OpenSSH mailing list archive
 Date:      2002, May 07
 From:      Tino Schwarze <tino.schwarze@informatik.tu-chemnitz.de>

On Tue, May 07, 2002 at 10:22:44AM +1000, Damien Miller wrote:
> > Hi there,
> > I was able to get things working. I do not get "Corrupted check bytes on
> > input" any more. I'm not sure what the cause was though. First, I
> > installed OpenSSH 3.1p1. Then, I explicitly disabled anything not
> > needed: ssh -2 -4 -a -n -T -x $host $script
> 
> Can you post a full debug trace "ssh -v -v -v host"? We can't really 
> debug if we don't see the full error.
Additional information: If I add "-n", everything works fine:
>----------------trace.sshbug.3----------------
From: root@agricola-gymnasium.de (Cron Daemon)
To: tisc@agricola-gymnasium.de
Subject: Cron <root@fserver> /root/bugtrace.ssh
X-Cron-Env: <MAILTO=tisc>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Status: RO
Content-Length: 3982
Lines: 129
+++ 07.05,10:18 -   we currently execute this script:
#!/bin/bash
#
# test des SSH-Bugs
function log_event ()
{
 echo "+++ `date +%d.%m,%H:%M` - $*"
}
if [ "$1" = "remote" ] ; then
 log_event "    we're on the remote host."
 # just some random messages to produce output
 echo cleaning $MOVEDFILES
 echo cp /dev/null "$MOVEDFILES"
 echo cleaning $CHANGEDFILES
 echo cp /dev/null "$CHANGEDFILES"
 echo set -x
 set -x
 echo starting
 sleep 5
 log_event "    remote script ended."
 exit 0
fi
log_event "  we currently execute this script:"
cat $0
log_event "  copying script to remote host."
scp $0 www-intern:$0
log_event "  running script on remote host"
ssh -n -v -v -v www-intern $0 remote
# it works this way:
#ssh -2 -4 -a -n -T -x www-intern $0 remote
log_event "  done."
+++ 07.05,10:18 -   copying script to remote host.
+++ 07.05,10:18 -   running script on remote host
OpenSSH_3.1p1, SSH protocols 1.5/2.0, OpenSSL 0x0090601f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: restore_uid
debug1: ssh_connect: getuid 0 geteuid 0 anon 1
debug1: Connecting to www-intern [10.1.2.1] port 22.
debug1: temporarily_use_uid: 0/0 (e=0)
debug1: restore_uid
debug1: temporarily_use_uid: 0/0 (e=0)
debug1: restore_uid
debug1: Connection established.
debug1: read PEM private key done: type DSA
debug1: read PEM private key done: type RSA
debug1: identity file /root/.ssh/identity type 0
debug1: identity file /root/.ssh/id_rsa type 0
debug3: Not a RSA1 key file /root/.ssh/id_dsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: no key found
debug3: key_read: no space
debug3: key_read: no space
debug3: key_read: no space
debug3: key_read: no space
debug3: key_read: no space
debug3: key_read: no space
debug3: key_read: no space
debug3: key_read: no space
debug3: key_read: no space
debug3: key_read: no space
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: no key found
debug1: identity file /root/.ssh/id_dsa type 2
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.1p1
debug1: match: OpenSSH_3.1p1 pat OpenSSH*
debug1: Local version string SSH-1.5-OpenSSH_3.1p1
debug1: Waiting for server public key.
debug1: Received server public key (768 bits) and host key (1024 bits).
debug3: check_host_in_hostfile: filename /root/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug3: check_host_in_hostfile: filename /root/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug1: Host 'www-intern' is known and matches the RSA1 host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: Encryption type: blowfish
debug1: Sent encrypted session key.
debug1: Installing crc compensation attack detector.
debug1: Received encrypted confirmation.
debug1: Trying RSA authentication with key '/root/.ssh/identity'
debug1: Received RSA challenge from server.
debug1: Sending response to host key RSA challenge.
debug1: Remote: RSA authentication accepted.
debug1: RSA authentication accepted by server.
debug3: clear hostkey 0
debug3: clear hostkey 1
debug3: clear hostkey 2
debug1: Sending command: /root/bugtrace.ssh remote
debug1: Entering interactive session.
debug2: fd 0 is O_NONBLOCK
debug1: fd 1 setting O_NONBLOCK
debug2: fd 2 is O_NONBLOCK
debug1: Sending eof.
+ echo starting
+ sleep 5
+++ 07.05,10:18 -     we're on the remote host.
cleaning
cp /dev/null 
cleaning
cp /dev/null 
set -x
starting
+ log_event '    remote script ended.'
++ date +%d.%m,%H:%M
+ echo '+++ 07.05,10:18 -     remote script ended.'
+ exit 0
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug2: fd 2 is not O_NONBLOCK
+++ 07.05,10:18 -     remote script ended.
debug1: Transferred: stdin 0, stdout 153, stderr 147 bytes in 5.0 seconds
debug1: Bytes per second: stdin 0.0, stdout 30.4, stderr 29.2
debug1: Exit status 0
+++ 07.05,10:18 -   done.
>----------------trace.sshbug.3----------------

and.sh
control operators the || & && ;; () |

# from /etc/rc.d/init.d/dhcpd # the script which takes care of starting and stopping the daemon # CONTROL OPERATOR: # a token that performs a control function. It is one of the following symbols: # the || & && ;; () | <newline>

backup.log
add


chmod.txt
add

#!/bin/bash cd /web/home/horsecon/public_html/wwwboard; for i in `ls `; do chmod o+rw $i done

double_brackets.txt
add

Assume that the variable filename holds the Korn shell also accepts the external [] and test commands. The [[ ]] construct has many more options and is better integrated into the Korn shell language: specifically, word splitting and wildcard expansion aren't done within [[ and ]], making quoting less necessary. SAME AS AN IF STATEMENT IN THE KORN SHELL [4] The Korn shell also accepts the external [] and test commands. The [[ ]] construct has many more options and is better integrated into the Korn shell language: specifically, word splitting and wildcard expansion aren't done within [[ and ]], making quoting less necessary. argument in question, and that ccom is the name of the program that actually compiles a C source file into object code. Assume further that ccom and as (assembler) take arguments for the names of the source and object files:

firewall.sh
add

#!/bin/bash IPTABLES="/bin/iptables" # changed from /sbin for purposes of illustration PROXY="localhost:3128" # Redirect for Squid or other transparent proxy. # Syntax to specify the proxy is "host:port". INTERNAL_LAN=192.168.0.0/24

for_loop.sh
add

#!/bin/bash # Two ways to count up to 10. echo # Standard syntax. for a in 1 2 3 4 5 6 7 8 9 10

jvm.cfg
add

# # @(#)jvm.cfg 1.10 00/08/01 # # Copyright 1999 by Sun Microsystems, Inc., # 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.

matching.sh
add

#!/bin/sh # back reference match for i in `ls` do filename=${i%.*php}

or.sh
add

# from /etc/rc.d/init.d/dhcpd # the script which takes care of starting and stopping the daemon # CONTROL OPERATOR: # a token that performs a control function. It is one of the following symbols: # the || & && ;; () | <newline>

output_redirection.txt
output redirection bash: postmaster -i -D .... -d 10 > logfile 2> &1

postmaster -i -D .... -d 10 > logfile 2> &1

prompting_echo.sh
add

I have created a shell script but I get stuck on the part where it asks to input password. How do I get the script to input the password that I put in? So far my script looks like this: ./mysql -u 'root' -p

scp.sh
scp /var/www/cgi-bin/lcgi/index.html.ko.euc-kr joesp@freebsd.sirfsup.com:~/lcgi/dict/data/

#!/bin/sh scp /var/www/cgi-bin/lcgi/index.html.ko.euc-kr joesp@freebsd.sirfsup.com:~/lcgi/dict/data/

sed1.sh
add

#!/bin/sh man command

tryit.sh
run the man command inside a shell script

#!/bin/sh PREV=1; echo $1 if [ $PREV -ne 0 ] ; then

unixenv.sh
add

# from teh installation of oracle on linux #!/bin/sh # # $Header: unixenv 22-jun-00.17:29:42 menash Exp $ Copyr (c) 1994 Oracle #
   --->upload your article


User submitted category site links


(None)

-->submit a page from your site dealing with bash to the sirfsup! web directory for listing

return to top