GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: SFTP in a script
Operating System - HP-UX
1847243
Members
2851
Online
110263
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
01-08-2009 12:31 PM
01-08-2009 12:31 PM
SFTP in a script
Hello, My company is switching from standard FTP to secure FTP. I had a shell script that used the -n switch in FTP to have the user account information be entered via the script. SFPT does not have this option. I tried using ID:Password@server for the connection, but still I am prompted for the password. Is there any way to do this with SFTP? I know that scripting a password isn't the pinnacle of security, but this is a low risk function.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2009 12:40 PM
01-08-2009 12:40 PM
Re: SFTP in a script
Hi Jeff:
You can setup public keys. This thread has a very good discussion of how to setup public keys in ssh:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1254688
The 'known_hosts' file contains the public host keys for all known hosts. The per-user version is maintained automatically. Thus, whenever a user connects from an unknown host, its key is added to the per-user file if you choose to acknowledge the fingerprint. If you don't, the connection can still be made, but you will be prompted the next time as if you had never connected.
See the manpages for 'sshd' and 'ssh' for more information.
As for the script, once you have public keys in place:
# cat ./mysftp
set -u
typeset HOST=$1
typeset FILE=$2
typeset RC
sftp -v -b - < lcd /tmp
cd /tmp
get -P ${FILE} ${FILE}.local
EOF
RC=$?
echo "\nSFTP returned ${RC}"
exit ${RC}
...run as ./mysftp hostname filename
Regards!
...JRF...
You can setup public keys. This thread has a very good discussion of how to setup public keys in ssh:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1254688
The 'known_hosts' file contains the public host keys for all known hosts. The per-user version is maintained automatically. Thus, whenever a user connects from an unknown host, its key is added to the per-user file if you choose to acknowledge the fingerprint. If you don't, the connection can still be made, but you will be prompted the next time as if you had never connected.
See the manpages for 'sshd' and 'ssh' for more information.
As for the script, once you have public keys in place:
# cat ./mysftp
set -u
typeset HOST=$1
typeset FILE=$2
typeset RC
sftp -v -b - <
cd /tmp
get -P ${FILE} ${FILE}.local
EOF
RC=$?
echo "\nSFTP returned ${RC}"
exit ${RC}
...run as ./mysftp hostname filename
Regards!
...JRF...
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP