- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: scp option
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
Discussions
Discussions
Forums
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
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
тАО04-15-2010 01:06 AM
тАО04-15-2010 01:06 AM
I have many linux servers. we have a script running on linux client using the following command:
scp /tmp/stat filemgr@server:/var/tmp/stat
In order to run the script successfully, we need to copy root public key from all the clients to /home/filemgr/.ssh/authorized_key file. The issue comes when we forgot to copy the public key from one of the client. This is causing filemgr accout is disabled on the server and effect the script on all other client won't run well.
What option I have to add on scp command in order to check if there is no public key exist on the server for that particular client, the script won't run and will give an error?
Thanks in advance.
Best Regards,
Dewa
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 01:34 AM
тАО04-15-2010 01:34 AM
Re: scp option
I assume that in the case when no public key exists on remote server, scp is asking for a password, right?
If this is the case, then your script should provide that password. For the case when the key exists, you should instruct your script to wait a reasonable amount of time then will pass to the next instruction from the script.
I am saying this having in mind expect.
Best regards,
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 01:43 AM
тАО04-15-2010 01:43 AM
Re: scp option
What is scp option need to be added here?
Thanks and Regards,
Dewa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 02:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 02:13 AM
тАО04-15-2010 02:13 AM
Re: scp option
The porting page for expect:
http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/
(Follow the run-time dependencies, as always!)
Best regards from Romania,
Horia.
Horia.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 07:16 AM
тАО04-15-2010 07:16 AM
Re: scp option
if you have established the trust this will work, if the trust is not established it won't..
you will need to complete the key exchange.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2010 08:03 AM
тАО04-15-2010 08:03 AM
Re: scp option
See below:
You'd need to modifyu parameters to fit your needs..
#!/usr/bin/expect -f
# This script needs three argument to(s) connect to remote server:
# password = Password of remote UNIX server, for root user.
# ipaddr = IP Addreess of remote UNIX server, no hostname
# set Variables
set password "ENTER PASSWORD HERE"
set ipaddr "www.xxx.yyy.zzz"
set arg1 [lrange $argv 3 3]
set timeout -1
# now connect to remote UNIX box (ipaddr)
spawn sftp USERNAME @$ipaddr $arg1
match_max 100000
expect {
-re ".*Are.*.*yes.*no.*" {
send "yes\r"
exp_continue
#look for the password prompt
}
"password:" {
send -- "$password\r"
}
}
expect "sftp>"
send "lcd /localdir/localfile/\r"
expect "sftp>"
send "cd /incoming/\r"
expect "sftp>"
send "put localfile\r"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2010 01:15 AM
тАО04-16-2010 01:15 AM
Re: scp option
Thanks for your help. I prefer to use -B option for this case as what you advice. Thanks again for all of you.
Best Regards,
Negara