HPE GreenLake Administration
Operating System - HP-UX
1830899
Members
2897
Online
110017
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
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
05-07-2004 06:00 AM
05-07-2004 06:00 AM
ssh/sftp
I would like to write a script that will sftp a file from one server to another. Exmaple: I will ssh from master/host to slave/server. Then want to do an sftp of a file from the slave/server to the master/host. I want to set up a cron file to have this run automatically. Any suggestions?
I'm an apprentice among journeymen who spend a lot of time on the virtual road.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2004 06:07 AM
05-07-2004 06:07 AM
Re: ssh/sftp
Rather than scripting with sftp use scp and set prefered auth to use public key 1st.
your script would use scp similar to...
scp /local_path/file username@remote:/remote_path
You'd also have to setup the user's ~/.ssh/authorized_keys file and keep the passphrase empty. This would make it so that the cron job could run without user interaction.
-denver
your script would use scp similar to...
scp /local_path/file username@remote:/remote_path
You'd also have to setup the user's ~/.ssh/authorized_keys file and keep the passphrase empty. This would make it so that the cron job could run without user interaction.
-denver
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2004 06:10 AM
05-07-2004 06:10 AM
Re: ssh/sftp
This would be the same as a regular ftp script.
Here is my cut.
If you exchange public keys, you can use scp for one line command copies between any servers running openssh.
Attaching a doc:
sftp usrname@hostname << END
put filename
bye
END
SEP
Here is my cut.
If you exchange public keys, you can use scp for one line command copies between any servers running openssh.
Attaching a doc:
sftp usrname@hostname << END
put filename
bye
END
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2004 07:27 AM
05-07-2004 07:27 AM
Re: ssh/sftp
generate your ssh keys on both systems. Then copy your public to the oher server in the .ssh/authorized_keys2 file.
Note you will need to coonect manually each directions if that is what you intend once and answer yes to add the hostnames to the known hosts.
This way you can sftp without a password, assuming you do not have a passphrase.
You can get fancier specify a passphase and set up the keys agent to pass the passphrase for you. In the long run this might be more secure.
next set up a cron to scp the file
file as the correct user you are using. If you run the job as root and send the file as a user you will have more to do in the sense you will need to specify the key location with the -i scp option and put the keys in root. This is a bit more overhead than you may want to deal with.
scp hosta:/tmp/yourfile hostb:/yourdirectory.
Note you will need to coonect manually each directions if that is what you intend once and answer yes to add the hostnames to the known hosts.
This way you can sftp without a password, assuming you do not have a passphrase.
You can get fancier specify a passphase and set up the keys agent to pass the passphrase for you. In the long run this might be more secure.
next set up a cron to scp the file
file as the correct user you are using. If you run the job as root and send the file as a user you will have more to do in the sense you will need to specify the key location with the -i scp option and put the keys in root. This is a bit more overhead than you may want to deal with.
scp hosta:/tmp/yourfile hostb:/yourdirectory.
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 2025 Hewlett Packard Enterprise Development LP