Sponsored Content
Operating Systems Solaris Issue with Expect Script for SFTP. Post 302333417 by Hari_Ganesh on Monday 13th of July 2009 03:57:33 AM
Old 07-13-2009
Issue with Expect Script for SFTP.

Hi Experts,

I am learning expect and wrote the below script for automatic sftp into a server:

#!/usr/local/bin/expect -f -d
spawn sftp -v test@mumux503 # logs into mumux503 as test user
expect "password:"
sleep 20
send "test\r"; # sending the password for test user which is "test"
expect "sftp>"
send "get output.txt\r"
expect "sftp>"
send "exit\r"

However i am getting the password prompt. Any idea where the issue is. Also attaching the sftp -v test@mumux503 log below:
[!]root: ./expect.sh
spawn sftp -v test@mumux503
Connecting to mumux503...
Sun_SSH_1.1, SSH protocols 1.5/2.0, OpenSSL 0x0090700f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to mumux503 [172.21.100.44] port 22.
debug1: Connection established.
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.1
debug1: no match: Sun_SSH_1.1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-Sun_SSH_1.1
debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible
mech_dh: Invalid or unknown error
)
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: Peer sent proposed langtags, ctos: i-default
debug1: Peer sent proposed langtags, stoc: i-default
debug1: We proposed langtags, ctos: i-default
debug1: We proposed langtags, stoc: i-default
debug1: Negotiated lang: i-default
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: Remote: Negotiated main locale: C
debug1: Remote: Negotiated messages locale: C
debug1: dh_gen_key: priv key bits set: 121/256
debug1: bits set: 1532/3191
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'mumux503' is known and matches the RSA host key.
debug1: Found key in /.ssh/known_hosts:11
debug1: bits set: 1614/3191
debug1: ssh_rsa_verify: signature correct
debug1: newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: done: ssh_kex2.
debug1: send SSH2_MSG_SERVICE_REQUEST
debug1: got SSH2_MSG_SERVICE_ACCEPT
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
debug1: Next authentication method: gssapi-keyex
debug1: Next authentication method: gssapi-with-mic
debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible
mech_dh: Invalid or unknown error
)
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/id_rsa
debug1: Trying public key: /.ssh/id_dsa
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
Password:


Thanks
HG
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect script issue

HI Al, I have written the following expect script: #!/bin/ksh #!/usr/local/bin/expect-- ##echo "PLease enter the server name" ##read host echo "please enter the instance" read instance set ##password to be entered right before the script is run## ##/usr/local/bin/expect<<-EOF cat... (2 Replies)
Discussion started by: Segwar
2 Replies

2. Shell Programming and Scripting

Help with Expect SFTP script

Hi All, Here is my Expect script, I don't get any error message when I run it. But the file never goes to other system? I also paste the output screen below. When I run the script, the script runs so fast. But when I do it manually, it takes about 10 minutes for the file to transfer. ... (1 Reply)
Discussion started by: samnyc
1 Replies

3. Shell Programming and Scripting

Expect script issue

This is my expect script . set USERNAME set PASSWD set IP set timeout 15 spawn telnet $IP expect "login:" send "$USERNAME\r" expect "Password:" send "$PASSWD\r" expect "Password:" send "$PASSWD\r" expect "*\>" send "show version\r" expect "*\>" send "quit\r" ouput of it (0 Replies)
Discussion started by: robbiezr
0 Replies

4. Shell Programming and Scripting

Issue - Expect Script.

Hi Gurus,I am trying to automate SFTP using expect.I have written a script that logs into a few boxes(one after the other) and pulls a few files from them.The code:#!/bin/kshcat serverlist.conf|wc -l >> tmp #serverlist.conf contains the list of servers.tmp1=$tmpfor tmp1 in listdo while read... (3 Replies)
Discussion started by: Hari_Ganesh
3 Replies

5. Shell Programming and Scripting

help to handle the expect script issue

Hi experts I know the expect script can match the terminal output to run the the following cmd I write a script with expect named "test", I want to run ten "test" with background running, for ((i=1;i<=10;i++) do ./test -n $i done I find all the output of test will print on one... (0 Replies)
Discussion started by: yanglei_fage
0 Replies

6. Shell Programming and Scripting

How to automate sftp without using expect script?

How to automate sftp with out using expect script? My batch file has the password but it is not taking. Please see below. I want to use this sftp connection in a loop for pushing new files in a directory one at a time. Hence I can not use an expect script. bash-2.05$... (5 Replies)
Discussion started by: Tuxidow
5 Replies

7. Shell Programming and Scripting

Expect Script for SFTP Upload

I am attempting to utilize an expect script (that is called from a parent bash script) to perform a file transfer over sftp. The script works except I cannot catch timeouts. I need to be able to tell in the parent bash script when the expect script has timed out, or completed successfully. It... (3 Replies)
Discussion started by: thaller
3 Replies

8. Shell Programming and Scripting

expect script issue

Hi All, I have the problem to run the commands in expect script from shell script. Mentioned below is the shell and expect script. ##Shell Script## cat bscfile.txt | while read line do NODE=$line ./expect.sh $line $NAME done line= 1st input NAME=2nd input... (1 Reply)
Discussion started by: yadvinder_singh
1 Replies

9. Shell Programming and Scripting

Bash Script: Send files to SFTP using Expect

I have to send few gzipped files from local server to SFTP server. My Server Info Distributor ID: Ubuntu Description: Ubuntu 12.04.4 LTS Release: 12.04 Codename: precise Created a bash script and could able to send files to sftp, but i want to send email if transfer is successful. ... (1 Reply)
Discussion started by: krux_rap
1 Replies

10. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies
AFPD(8) 							   Netatalk 2.2 							   AFPD(8)

NAME
afpd - Apple Filing Protocol daemon SYNOPSIS
afpd [-duptDTI] [-f defaultvolumes] [-s systemvolumes] [-n nbpname] [-c maxconnections] [-g guest] [-P pidfile] [-S port] [-L message] [-F configfile] [-U uams] [-m umask] afpd -v | -V | -h DESCRIPTION
afpd provides an Apple Filing Protocol (AFP) interface to the Unix file system. It is normally started at boot time from /etc/rc. /etc/netatalk/afpd.conf is the configuration file used by afpd to determine the behavior and configuration of the different virtual file servers that it provides. The list of volumes offered to the user is generated from /etc/netatalk/AppleVolumes.system and one of /etc/netatalk/AppleVolumes.default, ~/AppleVolumes, ~/.AppleVolumes, ~/applevolumes, or ~/.applevolumes. The AppleVolumes files is used to specify volumes to mount and file name extension mappings. OPTIONS
-d Specifies that the daemon should not fork. If netatalk has been configured with --enable-debug1, a trace of all AFP commands will be written to stdout. -p Prevents clients from saving their passwords. (Equivalent to -nosavepasswd in afpd.conf.) -t Allows clients to change their passwords. (Equivalent to -setpasswd in afpd.conf.) -D Use DDP (AppleTalk) as transport protocol. (Equivalent to -ddp in afpd.cond.) -T Use TCP/IP as transport protocol. (Equivalent to -tcp in afpd.conf.) -v Print version information and exit. -V Print verbose information and exit. -h Print help and exit. -I Use a platform specific icon. (Equivalent to -icon in afpd.conf.) (Recent Mac OS don't display it.) -f defaultvolumes Specifies that defaultvolumes should be read for a list of default volumes to offer, instead of /etc/netatalk/AppleVolumes.default. -s systemvolumes Specifies that systemvolumes should be read for a list of volume that all users will be offered, instead of /etc/netatalk/AppleVolumes.system. -u Read the user's AppleVolumes file first. This option causes volume names in the user's AppleVolumes file to override volume names in the system's AppleVolumes file. The default is to read the system AppleVolumes file first. Note that this option doesn't effect the precendence of filename extension mappings: the user's AppleVolumes file always has precedence. -n nbpname Specifies that nbpname should be used for NBP registration, instead of the first component of the hostname in the local zone. -c maxconnections Specifies the maximum number of connections to allow for this afpd. The default is 20. -g guest Specifies the name of the guest account. The default is 'nobody'. -P pidfile Specifies the file in which afpd stores its process id. -S port Specifies the port to register with when doing AFPoverTCP. Defaults to 548. (Equivalent to -port in afpd.conf.) -L message Specifies the login message that will be sent to clients. (Equivalent to -loginmsg in afpd.conf.) -F configfile Specifies the configuration file to use. (Defaults to /etc/netatalk/netatalk/afpd.conf.) -U uams Comma-separated list of UAMs to use for the authentication process. (Equivalent to -uamlist in afpd.conf.) -m umask Use this umask for the creation of folders in Netatalk. SIGNALS
To shut down a user's afpd process it is recommended that SIGKILL (-9) NOT be used, except as a last resort, as this may leave the CNID database in an inconsistent state. The safe way to terminate an afpd is to send it a SIGTERM (-15) signal and wait for it to die on its own. SIGTERM and SIGUSR1 signals that are sent to the main afpd process are propagated to the children, so all will be affected. SIGTERM Clean exit. Propagates from master to childs. SIGQUIT Send this to the master afpd, it will exit leaving all children running! Can be used to implement AFP service without downtime. SIGHUP Sending a SIGHUP to afpd will cause it to reload its configuration files. SIGINT Sending a SIGINT to a child afpd enables max_debug logging for this process. The log is sent to fhe file /tmp/afpd.PID.XXXXXX. Sending another SIGINT will revert to the original log settings. SIGUSR1 The afpd process will send the message "The server is going down for maintenance." to the client and shut itself down in 5 minutes. New connections are not allowed. If this is sent to a child afpd, the other children are not affected. However, the main process will still exit, disabling all new connections. SIGUSR2 The afpd process will look in the message directory configured at build time for a file named message.pid. For each one found, a the contents will be sent as a message to the associated AFP client. The file is removed after the message is sent. This should only be sent to a child afpd. FILES
/etc/netatalk/afpd.conf configuration file used by afpd /etc/netatalk/AppleVolumes.default list of default volumes to mount /etc/netatalk/AppleVolumes.system list of volumes to offer all users ~/AppleVolumes, ~/.AppleVolumes, ~/applevolumes, ~/.applevolumes user's list of volumes to mount /etc/netatalk/afp_signature.conf list of server signature /etc/netatalk/afp_voluuid.conf list of UUID for Time Machine volume /etc/netatalk/afp_ldap.conf configuration file for LDAP and ACL support /etc/netatalk/msg/message.pid contains messages to be sent to users. BUGS
SEE ALSO
hosts_access(5), afpd.conf(5), AppleVolumes.default(5), afp_signature.conf(5), afp_voluuid.conf(5), afp_ldap.conf(5), dbd(1). Netatalk 2.2 08 Mar 2011 AFPD(8)
All times are GMT -4. The time now is 01:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy