The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > SCO
.
google unix.com



SCO Santa Cruz Operation (SCO) was a software company based in Santa Cruz, California which was best known for selling three UNIX variants for Intel x86.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[REQ] Automatic script kill process onisoc Shell Programming and Scripting 3 05-25-2009 06:17 AM
automatic execution of shell script rajamohan Shell Programming and Scripting 1 09-29-2008 06:48 AM
Script for automatic count the file i have summerpeh SUN Solaris 13 09-05-2008 10:41 AM
Automatic script TShirt UNIX for Advanced & Expert Users 5 06-05-2008 04:34 AM
Automatic login script dayanand Shell Programming and Scripting 3 01-08-2006 07:46 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-02-2009
texastig texastig is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 6
Question Automatic FTP script

We are using SCO OS 5.05 server and we are doing a manual ftp to another SCO OS 5.05 server to backup our database.
We are using the Bourne shell.
We would like to automate the ftp backup of our database instead of doing it manually.
It would be nice to run a script.
Also would there be anyway to hide the ftp password?
Any tips or help would be appreciated.
Please advise and thanks.
  #2 (permalink)  
Old 06-02-2009
BubbaJoe's Avatar
BubbaJoe BubbaJoe is offline
Registered User
  
 

Join Date: Oct 2008
Location: St Louis
Posts: 153
Here is a simple simple ftp script you can follow: Not much luck on encrypting the password so you can not read it though.

Code:
 
#! /usr/bin/ksh

HOST=remote.host.name
USER=whoever
PASSWD=whatever

exec 4>&1
ftp -nv >&4 2>&4 |&

print -p open $HOST
print -p user $USER $PASSWD
print -p cd directory
print -p binary
print -p put tar.gz
print -p bye

wait
exit 0
  #3 (permalink)  
Old 06-02-2009
texastig texastig is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 6
That isn't working at all.
Please advise.
Thanks
  #4 (permalink)  
Old 06-02-2009
TonyFullerMalv's Avatar
TonyFullerMalv TonyFullerMalv is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2008
Location: Malvern, Worcs. U.K.
Posts: 720
You could store the password in a file encrypted by crypt(1) get your script to decrypt it as it uses it, not very secure but it would hide the password from the casual observer.

I've used ftp with an input file to give the commands before, e.g.:
Code:
$ cat cmdfile.template
open _FTPSERVER_
user _USER_ _PASSWORD_
cd directory
binary
put tar.gz
bye
$
And then a script like this:
Code:
HOST=remote.host.name
USER=whoever
PASSWD=whatever

sed -e 's/_FTPSERVER_/'${HOST}'/' -e 's/_USER_/'${USER}'/' -e 's/_PASSWORD_/'${PASSWD}'/' cmdfile.template > cmdfile
ftp < cmdfile
If you wanted to hide the password then encrypt it into a file using crypt, e.g.:
Code:
$ echo passwdofchoice > clear
$ echo keyofchoice > key.file
$ crypt `cat key.file` < clear > password.crypt
$ rm clear
Changing key to be the decryption key and password to ones of your choice.

The in the above script "PASSWD=whatever" would change to:
Code:
KEY=`cat key.file`
PASSWD=`crypt ${KEY} < password.crypt`
The filenames could be made more obscure and as I said the whole thing is not secure but it would hide things a bit...

Using scp to transfer files via SSH with passwordless SSH would be preferable and more secure if your ftp server is also running sshd.

Last edited by TonyFullerMalv; 06-02-2009 at 06:20 PM..
  #5 (permalink)  
Old 06-02-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,147
For FTP passwords, try a .netrc file in $HOME for the FTP user with permissions 600 owned by root.
Code:
man .netrc
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0