- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- SFTP using expect script (02)
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2004 03:27 PM
09-15-2004 03:27 PM
Sorry I post this again since I still can not find the answer.
I am running SFTP using expect script below as my company has not decided yet using public/private keys :
#!/usr/local/bin/expect
spawn sftp -b batchFile
expect "password:"
send "
interact
Is there any way how to prevent from hard-coded password in the script? Can we hidden the password? I just want to mitigate the security risk for the script.
Pls help. High score will be given.
Thanks and Best Regards,
Negara
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2004 06:40 PM
09-15-2004 06:40 PM
Re: SFTP using expect script (02)
Are you using this from cron or interactive?
What if you vi a script wich sets the password to a variable like: MYPW=12ab34cd. Give this script root:sys rights and r-x------
Then execute this script before the sftp session, and afterwards set the password again to some dummy pwd. You can also put the script file to some place where ordinary users cannot get.
Regards, MB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2004 08:36 PM
09-15-2004 08:36 PM
SolutionCheck Michael Tully's reply in this thread:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=350086
Regards,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2004 09:27 PM
09-15-2004 09:27 PM
Re: SFTP using expect script (02)
Thanks alot for your help.
It looks fine for me now. I can avoid the hard-coded password from the script and put it into a hidden file. Even it is not 100% secure, but it is much better than hard-code the password in the script.
Thanks alot.
Best Regards,
Negara
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 03:05 PM
11-04-2004 03:05 PM
Re: SFTP using expect script (02)
It seems that you got the answer. Could you give me the sample. Our company also need to use sftp without public/private keys. I have the situation the same as yours. Many thanks for your help !!
:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 08:28 PM
11-04-2004 08:28 PM
Re: SFTP using expect script (02)
I use the script below. It looks fine so far. Hope this help.
Thanks.
Dewa
#!/usr/local/bin/expect
# Initialisation
set authFile "/home/myuser/transfer/.password"
# Check the authorisation file exists
if {![file exists $authFile]} { ;# Does file exist
send_user "$authFile does not exist; aborting\n"
exit 1
}
set fileFD [open $authFile r] ;# Open the auth file
gets $fileFD authLine ;# Read in 1 line to authLine
close $fileFD
# Transfer file(s)
spawn sftp -b batchFile user01@hostname
expect "password:"
send "$authLine\n";
interact