Is there a reason not to exchange ssh-keys which will automate the sftp login and therefore you can exploit the functionality of sftp?
It would leave you with far neater code something like:
It might be possible to set it up as a here document too:-
Would this help you make things neater, easier and remove the reliance on expect?
Robin
I will speak with my Admins to see if I can get ssh-keys set up.
Hello all,
I've written an automated SFTP script to work with the Expect command. It recently occurred to me however, that if the client side box does not have the known host entry for the server, it will not work correctly. So I have added an expect for the known host prompt, and that part... (2 Replies)
Hi all, i got a really strange problem
i wrote a script, when i run this script manually everything works fine
but when i make a cronjob for it, with the same user, the EXPECT script will not work.
Only the first line will be executed
this is the SHell bash script
#!/bin/sh;
php -q... (2 Replies)
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)
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... (3 Replies)
hello All,
I am doing SFTP using expect. We just change our server from sun solaris 8 to sun solaris 10.
The script was working good on sun solaris 8.
But it is giving problem on 10. from shell, SFTP is working fine.Please help me.
What can be the problem.
LIB_sftp_get()
{
... (0 Replies)
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)
I am trying to use a for loop in my expect cmdFile that I am calling.
I want to be able to call either one file name or a series of file names in the working directory (that I won't know the names before hand) and then pass the names to the sftp program.
Something like for i in (ls *txt)
do (0 Replies)
Hi,
I am writing a script to enter into a list of servers and take the backup of the cronjobs on that servers...
==============================
-bash-3.00$ expect spawn.exp ssh rcdn6-vm59-33
spawn ssh servers1 /CODE]====================
-bash-3.00$ cat spawn.exp
#!/usr/bin/expect
eval... (1 Reply)
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)
Hi,
I am trying to sftp using expect, but not getting through as it prompt for password is coming
Following is the code
#/usr/bin/expect > output.log
sftp medcdr@10.130.254.50
expect "password:"
send "Med@Cdr12\n"
expect "sftp>"
send "put ZTE_*201505*\r"
expect "sftp>"
send "bye\r"... (7 Replies)
Discussion started by: siramitsharma
7 Replies
LEARN ABOUT LINUX
ssh_sftpd
ssh_sftpd(3erl) Erlang Module Definition ssh_sftpd(3erl)NAME
ssh_sftpd - Specifies a channel process to handle a sftp subsystem.
DESCRIPTION
Specifies a channel process to handle a sftp subsystem.
COMMON DATA TYPES
subsystem_spec() = {subsystem_name(), {channel_callback(), channel_init_args()}}
subsystem_name() = "sftp"
channel_callback() = atom() - Name of the erlang module implementing the subsystem using the ssh_channel behavior see ssh_channel(3erl)
channel_init_args() = list() - The one given as argument to function subsystem_spec/1.
EXPORTS
subsystem_spec(Options) -> subsystem_spec()
Types Options = [{Option, Value}]
Should be used together with ssh:daemon/[1,2,3]
Options are:
{cwd, String} :
Sets the initial current working directory for the server.
{file_handler, CallbackModule} :
Determines which module to call for communicating with the file server. Default value is ssh_sftpd_file that uses the file and
filelib API:s to access the standard OTP file server. This option may be used to plug in the use of other file servers.
{max_files, Integer} :
The default value is 0 , which means that there is no upper limit. If supplied, the number of filenames returned to the sftp
client per READDIR request, is limited to at most the given value.
{root, String} :
Sets the sftp root directory. The user will then not be able to see any files above this root. If for instance the root is set
to /tmp the user will see this directory as / and if the user does cd /etc the user will end up in /tmp/etc .
Ericsson AB ssh 2.0.4 ssh_sftpd(3erl)