10-09-2008
####################my_shell_script.exp #################
#!/usr/bin/expect -f
exp_internal 1
spawn /usr/bin/scp -i /root/Test/abcds test.txt root@192.168.1.6:/tmp/
expect "*?assword:*"
send "pass_word\r"
send -- "\r"
expect eof
###################Output ###########################
spawn /usr/bin/scp -i /root/Test/abcds test.txt root@192.168.1.6:/tmp/
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {4384}
expect: does "" (spawn_id exp7) match glob pattern "*?assword:*"? no
expect: timed out
send: sending "pass_word\r" to { exp7 }
send: sending "\r" to { exp7 }
pass_word
expect: timed out
can anybody guide me whats wrong in this script ?
Thanks In Advance
Last edited by jagnikam; 10-10-2008 at 05:06 PM..
10 More Discussions You Might Find Interesting
1. SuSE
OK, this is the problem. I have 2 machines TestA ( Suse 9.0 ) TestB ( Mandrake 10 ) and one of our guys wants to scp from TestA to TestB without the password prompt appearing. Sounds simple so far....
Ok, I haven't used ssh-keygen before, so I create identical logins to test what I'm doing...... (4 Replies)
Discussion started by: PaulC
4 Replies
2. Shell Programming and Scripting
I have 2 separate systems having same userid with home directory nfs mounted which is shared by both the boxes. I want to make ssh connection from server1 to server2 which should not ask for password. I have ssh installed on both the systems. Can anyone guide me in generating ssh-key using dsa... (2 Replies)
Discussion started by: deo_kaustubh
2 Replies
3. Shell Programming and Scripting
Hi,
I have two Unix servers A and B. I have a script in server A. I want to connect to server B from A using ssh only and without giving passwords everytime i connect. I went through other posts regarding this and I generated a public key in server A and copied that in server B. Now when I... (3 Replies)
Discussion started by: mick_000
3 Replies
4. Solaris
I'm trying to generate this key but getting an error "file not found"
Here is the command:
# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (//.ssh/id_dsa): /export/home/bartadm/.ssh/id_dsa
Enter passphrase (empty for no passphrase):
Enter... (2 Replies)
Discussion started by: Kjons76
2 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I am new to unix, recently i was exploring password less remote connection to the ftp server and in that I was exploring the ssh-keygen utility, that it generates private & public keys that helps in transmitting files in encrypted format.Could you please explain me in detail about the... (1 Reply)
Discussion started by: rahul125
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I was going thruough the password less authentication of keygen-ssh that will help us in generating keys...One thing that is not clear to me that if in nearby future we conncet to remote ftp server in that case now we need to only provide the user id itself that is password would not be... (1 Reply)
Discussion started by: rahul125
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I using ssh-keygen for passwordless authenciation firstly
and I am following these steps mentioned below...
1) Login to pngpcdb1 using your user/pass
2) type 'bash' (without quotes)
3) ssh-keygen #generates private and public key.
4) copy this private key to the location of your sftp... (1 Reply)
Discussion started by: karan2597
1 Replies
8. Shell Programming and Scripting
sftp username@host <<EOF
lcd /home/dirA
cd /home/dirB
mput *.txt
exit
EOF
Hi,
i have done the keygen-ssh settings but rite now I log through putty I enter my credentials and then when i successfully log in, then I issue the command ssh server name then I again enter into the server but... (1 Reply)
Discussion started by: rahulsxn660
1 Replies
9. AIX
Hi ,
I am trying to create public key on my AIX server on other than home directory.However the command does not ask for
Enter file in which to save the key :
It is directly taking me to Enter the passphrase.
I don't want to save the key in home dir as that is the home dir for other userID... (6 Replies)
Discussion started by: saurau
6 Replies
10. UNIX for Beginners Questions & Answers
For some reason, when I try copying my public key to the server, despite it showing as being successful:
rob@linux044:~$ ssh-copy-id -i /home/rob/Work/Keys/keys.txt.pub !@#$%.com
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/rob/Work/Keys/keys.txt.pub"... (7 Replies)
Discussion started by: Circuits
7 Replies
LEARN ABOUT FREEBSD
ssh-add
SSH-ADD(1) BSD General Commands Manual SSH-ADD(1)
NAME
ssh-add -- adds private key identities to the authentication agent
SYNOPSIS
ssh-add [-cDdkLlXx] [-t life] [file ...]
ssh-add -s pkcs11
ssh-add -e pkcs11
DESCRIPTION
ssh-add adds private key identities to the authentication agent, ssh-agent(1). When run without arguments, it adds the files ~/.ssh/id_rsa,
~/.ssh/id_dsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ed25519 and ~/.ssh/identity. After loading a private key, ssh-add will try to load corresponding
certificate information from the filename obtained by appending -cert.pub to the name of the private key file. Alternative file names can be
given on the command line.
If any file requires a passphrase, ssh-add asks for the passphrase from the user. The passphrase is read from the user's tty. ssh-add
retries the last passphrase if multiple identity files are given.
The authentication agent must be running and the SSH_AUTH_SOCK environment variable must contain the name of its socket for ssh-add to work.
The options are as follows:
-c Indicates that added identities should be subject to confirmation before being used for authentication. Confirmation is performed by
the SSH_ASKPASS program mentioned below. Successful confirmation is signaled by a zero exit status from the SSH_ASKPASS program,
rather than text entered into the requester.
-D Deletes all identities from the agent.
-d Instead of adding identities, removes identities from the agent. If ssh-add has been run without arguments, the keys for the default
identities and their corresponding certificates will be removed. Otherwise, the argument list will be interpreted as a list of paths
to public key files to specify keys and certificates to be removed from the agent. If no public key is found at a given path,
ssh-add will append .pub and retry.
-e pkcs11
Remove keys provided by the PKCS#11 shared library pkcs11.
-k When loading keys into or deleting keys from the agent, process plain private keys only and skip certificates.
-L Lists public key parameters of all identities currently represented by the agent.
-l Lists fingerprints of all identities currently represented by the agent.
-s pkcs11
Add keys provided by the PKCS#11 shared library pkcs11.
-t life
Set a maximum lifetime when adding identities to an agent. The lifetime may be specified in seconds or in a time format specified in
sshd_config(5).
-X Unlock the agent.
-x Lock the agent with a password.
ENVIRONMENT
DISPLAY and SSH_ASKPASS
If ssh-add needs a passphrase, it will read the passphrase from the current terminal if it was run from a terminal. If ssh-add does
not have a terminal associated with it but DISPLAY and SSH_ASKPASS are set, it will execute the program specified by SSH_ASKPASS and
open an X11 window to read the passphrase. This is particularly useful when calling ssh-add from a .xsession or related script.
(Note that on some machines it may be necessary to redirect the input from /dev/null to make this work.)
SSH_AUTH_SOCK
Identifies the path of a UNIX-domain socket used to communicate with the agent.
FILES
~/.ssh/identity
Contains the protocol version 1 RSA authentication identity of the user.
~/.ssh/id_dsa
Contains the protocol version 2 DSA authentication identity of the user.
~/.ssh/id_ecdsa
Contains the protocol version 2 ECDSA authentication identity of the user.
~/.ssh/id_ed25519
Contains the protocol version 2 ED25519 authentication identity of the user.
~/.ssh/id_rsa
Contains the protocol version 2 RSA authentication identity of the user.
Identity files should not be readable by anyone but the user. Note that ssh-add ignores identity files if they are accessible by others.
EXIT STATUS
Exit status is 0 on success, 1 if the specified command fails, and 2 if ssh-add is unable to contact the authentication agent.
SEE ALSO
ssh(1), ssh-agent(1), ssh-keygen(1), sshd(8)
AUTHORS
OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH. Markus Friedl contributed the support for SSH
protocol versions 1.5 and 2.0.
BSD
December 7, 2013 BSD