- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Automating SCP and SFTP
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
01-24-2003 09:59 AM
01-24-2003 09:59 AM
server ip address: 192.168.1.5
user name: user
password: userpw
the file will be called test and will be in the temp directory:
/temp/test
and I want to transfer the file to the same directory on the remote side (192.168.1.5)
/temp/test
It works when i type in the following however i can't seem to include the password in it so after it connects, it will ask me to enter in my password:
# scp /temp/test user@192.168.1.5:/temp/test
user@192.168.1.5's password:
test 100% |******| 25 00:00
#
so that works...can someone please direct me or help me to write this so that its autoomated. Thanks so much.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2003 10:22 AM
01-24-2003 10:22 AM
Re: Automating SCP and SFTP
1) su as the user. Generate a private/public keys pair. Depending on your version of SSH, most keys pair look like this: id_dsa & id_dsa.pub
2) ship the id_dsa.pub on the other end(the secure ftp server) & have the admin to authenticate you using that public key.
3) Then just write a script contains this line.
scp
to help troubleshoot, add a -v argument to scp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2003 10:40 AM
01-24-2003 10:40 AM
SolutionI used this doc both for HP-UX and Linux.
Enjoy.
P
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
01-24-2003 10:41 AM
01-24-2003 10:41 AM
Re: Automating SCP and SFTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2003 11:43 AM
01-24-2003 11:43 AM
Re: Automating SCP and SFTP
1. Generate public/private key pair on the localhost.
$ssh-keygen -t dsa -N ""
Take the defaults. It will create two files under your $HOME/.ssh directory id_dsa and id_dsa.pub. Copy id_dsa.pub file to your remote system (192.168.1.5) into /tmp directory.
Logon to the remote system and append id_dsa.pub file into $HOME/.ssh/authorized_keys. If there is no directory .ssh under $HOME, then create it. Use the following command to append the key.
$cat /tmp/id_dsa.pub >> /home/your_id/.ssh/authorized_keys
Now try scp. It should not prompt for the password.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2003 09:16 AM
01-28-2003 09:16 AM
Re: Automating SCP and SFTP
I found keychain to be perfect in such cases.
http://www.gentoo.org/proj/en/keychain.xml
Do read the IBM developer articles he wrote.
Also you may want to check out Chris Wong's web site
http://newfdawg.com/SHP-Articles.htm
-HTH
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2003 08:34 AM
02-26-2003 08:34 AM
Re: Automating SCP and SFTP
Local Computer: HP-UX 11.0
Remote Computer: Unknown
This is what I did:
on the local computer, I typed in the following:
$ssh-keygen -t dsa -N ""
which created the 3 files. I then scp id_dsa.pub to the remote system /home/temp/
I then logged into the remote system and did the following command:
$cat /home/temp/id_dsa.pub >> /home/temp/.ssh/authorized_keys
I then checked to make sure the file has the proper permission. It does. The only file in the directory .ssh is the authorized_keys. I then logged out of the remote system.
Now I am on the local computer. I typed in the following:
lets assume the remote system has an ip address of sftp.temp.com
$ssh sftp.temp.com
It then asked me for the password. I entered it in and then logged out. I then tried it again and it still asked me for the password. Can anyone please help me out. I am getting frustrated with this key stuff. Thanks for all your help. Much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2003 12:20 PM
02-26-2003 12:20 PM
Re: Automating SCP and SFTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2003 01:14 PM
02-26-2003 01:14 PM
Re: Automating SCP and SFTP
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2003 02:53 PM
02-26-2003 02:53 PM
Re: Automating SCP and SFTP
1. On local hp-ux machine.
$ ssh-keygen -t dsa
$ cd .ssh
$ ls
id_dsa.pub id_dsa prng_seed
$ cp id_dsa.pub /home/copy/.ssh/authorized_keys
$ chmod 644 authorized_keys
$ ssh sftp.test.com
The authenticity of host '
$ scp /home/copy/.ssh/authorized_keys sftp.test.com:/home/copy/.ssh/authorized_keys
$
file transfered.
$ scp /home/copy/test sftp.test.com:/home/copy/test
enter your password:
[copy@sftp.test.com]$ exit
$ scp /home/copy/test sftp.test.com:/home/copy/test2
It then asked me for the password and what not. Can y ou please take a look at what I did and see if you can find anything that I did wrong. i followed the direction numerous of times and it still ask me for the password. I think i might be doing soething wrong. Can you please help me out. thanks alot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2003 04:10 PM
02-26-2003 04:10 PM
Re: Automating SCP and SFTP
It looks like you're getting close. It appears that your ran ssh-keygen -t dsa for root, and then copied it to ~/.ssh directory of your user (copy). You need to be logged in as that user (su - copy) and re-run "ssh-keygen -t dsa" for each user, on each host system. Each user then has his/her own public/private key pair. You can't use one authorized_keys file for every user, but you can have an authorized_keys file that is common to several servers, but only the same user on each system.
Again: check the permissions on each users' home directory: they should be 755, while the authorized_keys file should be 644.
Post back here with your successes or problems.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2003 07:52 AM
02-27-2003 07:52 AM
Re: Automating SCP and SFTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2003 09:32 AM
02-27-2003 09:32 AM
Re: Automating SCP and SFTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2003 02:31 PM
02-27-2003 02:31 PM
Re: Automating SCP and SFTP
Which I took to mean that you copied the file to the /home/copy/.ssh directory for the "copy" user. You didn't mention that you had logged in as the 'copy' user.
The id_dsa.pub key contains the key for that one particular host. The authorized_keys file contains the key for all hosts that you want to give login permission to. So, if all you have are two machines, the authorized_keys file should have the contents of BOTH id_dsa.pub keys, on both hosts.
If you use the "-t dsa" argument to the "ssh-keygen" command, it shouldn't matter which version of ssh you're using.
Oh yeah.....points are appropriate now.....
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2003 02:53 PM
02-27-2003 02:53 PM
Re: Automating SCP and SFTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2003 02:57 PM
02-27-2003 02:57 PM
Re: Automating SCP and SFTP
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2003 03:03 PM
02-27-2003 03:03 PM
Re: Automating SCP and SFTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2003 03:11 PM
02-27-2003 03:11 PM
Re: Automating SCP and SFTP
If this doesn't work for you, then I'm stumped. We're using this on 30+ systems here, with dozens of users, and no one is reporting problems. When we have had problems, it was always an ownership or permission issue.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2003 03:13 PM
02-27-2003 03:13 PM
Re: Automating SCP and SFTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2003 03:17 PM
02-27-2003 03:17 PM
Re: Automating SCP and SFTP
the user is copy
drwxr-xr-x 2 copy sys 96 Feb 27 .ssh
here is the permission and ownership in the .ssh directory:
-rw-r--r-- 1 copy sys id_dsa
-rw-r--r-- 1 copy sys id_dsa.pub
-rw-r--r-- 1 copy sys known_hosts
-rw-r--r-- 1 copy sys prng_seed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2003 06:58 AM
02-28-2003 06:58 AM
Re: Automating SCP and SFTP
Then email me directly: "cvail 'at' ercot dot com.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2005 02:08 AM
08-10-2005 02:08 AM
Re: Automating SCP and SFTP
7.3-2
TCPIP_ECO V5.4-155
Bart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2005 09:54 PM
08-11-2005 09:54 PM