- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Want to automate SCP transfers
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
03-25-2009 09:24 PM
03-25-2009 09:24 PM
I am now wanting to use a script to automate transfer of database afer image files from my production machine to dr machine.
Since both systems have SSH installed i figured i'd use SSH, but SCP always requires a password to be entered, even if is in a script.
So, from what i've learned today.. I need to 'generate keys' which will somehow make this work.
OK, here's my setup:
TWO HP UX machines
prod <- production box
prodbk <- production backup box
I have a user account called 'Bob' on the prod box who wants to send a file to user 'Fred' on the prodbk box via SCP.
I want to be able to put the following command in a script:
scp testfile1.txt Fred@prodbk:/dbase/repldst/testfile1.txt
Without having 'scp' come back and ask for a password.
I'm after really simply basic baby step instructions here, i've tried to look at other threads but they often have very complicated examples.
Any help is once again most appreciated.
-John
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2009 10:02 PM
03-25-2009 10:02 PM
Re: Want to automate SCP transfers
Not clear about your question.
what you want file should go into prodbk without passwd and using fred login ?
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2009 10:10 PM
03-25-2009 10:10 PM
Re: Want to automate SCP transfers
ssh passwordless
should find any number of old threads which
cover this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2009 10:37 PM
03-25-2009 10:37 PM
Re: Want to automate SCP transfers
here is the steps to login without passwd
login with Bob into prod server go to /home/Bob/.ssh
Bob@prod $ ssh-keygen -v -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (.ssh/id_rsa): press return key
Enter passphrase (empty for no passphrase): press return key
Enter same passphrase again: press return key
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
2d:47:41:2d:5e:89:e7:10:85:31:36:f8:e6:e2:d4:23
Bob@prod $ cat id_rsa.pub >authorized_keys
Bob@prod $ Fred@prodbk:/home/Fred/.ssh/.
now you can scp, ssh without passwd into prod to prodbk server.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2009 12:39 AM
03-26-2009 12:39 AM
Re: Want to automate SCP transfers
Ok. Understood your requirement. As you understand, you need to setup SSH password less login between those two users. Follow the below instructions.
1.Login to Prod server as Bob user.
2.$ssh-keygen -t dsa
Press enter for all the questions.It will create the private/public key files under $HOME/.ssh/
File names are id_rsa and id_rsa.pub
3.Now you need to copy the id_rsa.pub file content into Fred's $HOME/.ssh/authorized_keys file on prodbk server
Prod#scp ~Bob/.ssh/id_rsa.pub Prodbk:/tmp
Login to Prodbk server
Prodbk#cat /tmp/id_rsa.pub >> ~Fred/.ssh/authorized_keys
Make sure the following permissions on Prodbk server.
Home directory should have 755 permission (Fred's home directory)
$HOME/.ssh directory should have 700 permission
$HOME/.ssh/authorized_keys file should have 600 or 640 permission
That's it. Now you can scp without password and automate the transfer
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2009 02:01 AM
03-26-2009 02:01 AM
Re: Want to automate SCP transfers
I would also check at rsync which can be used with SSH for automated process.
rsync -avre ssh filename fred@
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2009 02:29 AM
03-26-2009 02:29 AM
Re: Want to automate SCP transfers
- The key is very long. Either append using something like cat id_dsa.pub >> .ssh/authorized_keys, or if you use vi, be sure to turn off ai and set wm=0 (hint :set noai wm=0). Then use wc on the authorized_keys file to make sure there is a single line per key.
- .ssh permissions must be 700, the files under .ssh should be 600.
The public key is generated on your local system, and copied to the userID's home directory on the remote system.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2009 03:00 PM
03-26-2009 03:00 PM
Re: Want to automate SCP transfers
I'll give it a shot and post back here letting you know how it all went.
-John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2009 03:02 PM
03-26-2009 03:02 PM
SolutionTry this document:
http://www.hpux.ws/?p=10
SEP
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
03-26-2009 08:24 PM
03-26-2009 08:24 PM
Re: Want to automate SCP transfers
Problem solved, had some help at this end too.
Much appreciation once again!
Regards
John O'Neill
p.s. Points assigned.