- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- scp and expect script
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
тАО07-30-2007 06:12 PM
тАО07-30-2007 06:12 PM
scp and expect script
for ex: my remote machine ip is 201.33.4.22
and i have file named log in /tmp directory.
And the below is my script .but it seems to have an error can any 1 help me out.thnks in advance.
#!/usr/bin/expect
log_user 0
set my_passphrase "passphrase"
set my_password "hithr"
spawn "/usr/bin/scp" "root@201.33.4.22:/tmp/logstatus2 /wys_new/log"
while {1} {
expect {
"root@201.33.4.22's password:" {
send "$my_password\n"
}
# -re "(#|\\\$|%) $" {
# log_user 1
# send_user "Shell prompt found. Dropping to shell:"
send "\n"
log_user 1
break
}
}
}
interact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2007 08:25 PM
тАО07-30-2007 08:25 PM
Re: scp and expect script
you can configure a publickey authentication with a null passphrase:
login IDA@SERVER1
SERVER1# ssh-keygen -t rsa -C "ssh_for_`whoami`@`hostname`" -f ~/.ssh/id_rsa
empty for no passphrase
SERVER1# cp -p id_rsa.pub authorized_keys.SERVER1
SERVER1# chmod 600 auth*
SERVER1# scp -p authorized_keys.SERVER1 SERVER2:/$PWD
login IDB@SERVER2
SERVER2# cat authorized_keys.SERVER1 >> authorized_keys
SERVER2# chmod 600 authorized_keys
IDA@SERVER1
SERVER1# ssh IDB@SERVER2
yes
(and viceversa)
Pablo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-30-2007 11:58 PM
тАО07-30-2007 11:58 PM
Re: scp and expect script
Anybody willing to share the ideas are welcomed and tell me whts wrong with the above script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-31-2007 12:25 AM
тАО07-31-2007 12:25 AM
Re: scp and expect script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-31-2007 12:26 AM
тАО07-31-2007 12:26 AM
Re: scp and expect script
There's also no need to open a new thread on this topic all the time.
Lars