06-18-2010
Hi
Thanks for the reply.
It's not a cron problem - i haven't got as far as putting in the cron yet.
I can manually connect:
sftp username@host
this automatically connects me as i have already set up the keys.
I can then transfer file: put file
Then disconnect: exit
That is all that is required except for the fact i want to do is automatically via a script so it can go in the cron - just dont know how to get the sftp commands to be read and get the connection to exit without doing it manually
Cheers
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have to write an automated sftp script which uses password authentication method to access the remote server. I want to pass the password as a parameter or to be included in the script itself, so that when i run the sftp script, it should not prompt me to enter the password.
Thanks in advance... (1 Reply)
Discussion started by: Rajeshsu
1 Replies
2. Shell Programming and Scripting
I have written generic script to transfer files from one machine to other machine(By passing the command line arguments like server name, user name ,location of the files, file names etc) but
when i am using sftp, what are the things I have to specify in the code
Is it necessary to specify... (0 Replies)
Discussion started by: gsri
0 Replies
3. UNIX for Dummies Questions & Answers
Hi all.
basically i need to run a script every 30 minutes.
my script is simply an error report:
errpt
thats it, is there anyway to make this happen every 30 minutes
without having to type errpt in, the script will get bigger as i add more things to do but just need to know how to... (8 Replies)
Discussion started by: hassanj
8 Replies
4. Solaris
Hi
We are trying to set up a non-interactive sftp to one of our clients to be able to transfer files to them. For the setup I logged into server1 as user1 and generated RSA public and private keys id_rsa and id_rsa.pub. Then I did an sftp to server2 as user2 and put the id_rsa.pub in the .ssh... (4 Replies)
Discussion started by: vnparo
4 Replies
5. Shell Programming and Scripting
Hi Experts,
Few more words to the title, both the servers are ssh enabled but I have read only access to the second server, so I cannot automate SFTP process using RSA/DSA keys.
I am using Control M to trigger the script and do not want any manual intervention to enter the password to complete... (4 Replies)
Discussion started by: nchourasiya
4 Replies
6. Shell Programming and Scripting
Hi all,
I'm trying to do a script to transfer file between my server and an external server via SFTP protocol. It doesn't use rsa key, but password.
When I run the script, it throw back a prompt that request me to put the password. How should I do for automatic login? Pleaes help :(
... (2 Replies)
Discussion started by: Kapom
2 Replies
7. Shell Programming and Scripting
I had the below sftp script working perfectly but the problem is I am not able to send the echo statements .
#!/bin/sh
echo "Starting to sftp..."
sftp admin@myip << END_SCRIPT
cd /remotepath/
lcd /localpath/
mget myfiles*.csv
bye
END_SCRIPT
echo "Sftp successfully."
echo
echo... (11 Replies)
Discussion started by: scriptscript
11 Replies
8. UNIX for Dummies Questions & Answers
Hello gurus,
I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired
report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup
is shown below:
#!/bin/ksh
db2... (3 Replies)
Discussion started by: okonita
3 Replies
9. Shell Programming and Scripting
Hello,
Recently I have changed some crontab scripts which I execute to do different tasks mainly transfering some files from one server to the other.
The main change was the protocol from ftp transfer to sftp. Ftp server was the MS Windows default service, and Sftp server is an proprietary sw... (4 Replies)
Discussion started by: enux
4 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
I am having an issue with the script execution. I am having a SFTP process that send files to a location . I want to execute a script once it transfer the file to that location. Right now I am leveraging autosys file watcher to do that. Is there any way like MFT PPA that can execute... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies
LEARN ABOUT PHP
ftp_ssl_connect
FTP_SSL_CONNECT(3) 1 FTP_SSL_CONNECT(3)
ftp_ssl_connect - Opens an Secure SSL-FTP connection
SYNOPSIS
resource ftp_ssl_connect (string $host, [int $port = 21], [int $timeout = 90])
DESCRIPTION
ftp_ssl_connect(3) opens an explicit SSL-FTP connection to the specified $host.
Note
Why this function may not exist
ftp_ssl_connect(3) is only available if both the ftp module and the OpenSSL support is built statically into php, this means that on
Windows this function will be undefined in the official PHP builds. To make this function available on Windows you must compile your
own PHP binaries.
Note
ftp_ssl_connect(3) is not intended for use with sFTP. To use sFTP with PHP, please see ssh2_sftp(3).
PARAMETERS
o $host
- The FTP server address. This parameter shouldn't have any trailing slashes and shouldn't be prefixed with ftp://.
o $port
- This parameter specifies an alternate port to connect to. If it is omitted or set to zero, then the default FTP port, 21, will
be used.
o $timeout
- This parameter specifies the timeout for all subsequent network operations. If omitted, the default value is 90 seconds. The
timeout can be changed and queried at any time with ftp_set_option(3) and ftp_get_option(3).
RETURN VALUES
Returns a SSL-FTP stream on success or FALSE on error.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.2.2 | |
| | |
| | The function was changed to return FALSE when it |
| | can't use an SSL connection, instead of fallback- |
| | ing to a non-SSL one as previously. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
ftp_ssl_connect(3) example
<?php
// set up basic ssl connection
$conn_id = ftp_ssl_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
echo ftp_pwd($conn_id); // /
// close the ssl connection
ftp_close($conn_id);
?>
SEE ALSO
ftp_connect(3).
PHP Documentation Group FTP_SSL_CONNECT(3)