HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- script assistance
Operating System - Linux
1834051
Members
2481
Online
110063
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
Go to solution
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
01-18-2006 06:15 AM
01-18-2006 06:15 AM
Any help is greatly appreciated and points will be assigned.
Write a script to securely transfer a file named "test1.log" from the server named "server2" to the server name "server1". Use the account name of sysadmin and note any additional requirements to make the script work in an unattended mode.
Write a script to securely transfer a file named "test1.log" from the server named "server2" to the server name "server1". Use the account name of sysadmin and note any additional requirements to make the script work in an unattended mode.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 07:10 AM
01-18-2006 07:10 AM
Solution
To do that, you only need scp with public key authentication.
Create a public key pair without passphrase on server1:
ssh-keygen -t dsa
Copy the $HOME/.ssh/id_dsa.pub to server2 in $HOME/.ssh/authorized_keys
On both servers run
cd $HOME
chmod -R go-w .ssh
Use scp to transfer the files from server1:
scp test1.log server2:/destination/directory
Create a public key pair without passphrase on server1:
ssh-keygen -t dsa
Copy the $HOME/.ssh/id_dsa.pub to server2 in $HOME/.ssh/authorized_keys
On both servers run
cd $HOME
chmod -R go-w .ssh
Use scp to transfer the files from server1:
scp test1.log server2:/destination/directory
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 08:58 AM
01-18-2006 08:58 AM
Re: script assistance
scp can do this as noted above.
to pull this off the user MUST own home diretory with 755 permissions and .ssh must have tight 655 permissions as well. Plenty of docs on this on itrc some of which I wrote.
If port 514 is open between the machines, syslog can do it also.
You add an entry for a second syslog or maillog
@hostnameof server
Like magic the log entries for one server appear on another.
SEP
to pull this off the user MUST own home diretory with 755 permissions and .ssh must have tight 655 permissions as well. Plenty of docs on this on itrc some of which I wrote.
If port 514 is open between the machines, syslog can do it also.
You add an entry for a second syslog or maillog
@hostnameof server
Like magic the log entries for one server appear on another.
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
01-18-2006 05:50 PM
01-18-2006 05:50 PM
Re: script assistance
After you exchange keys this script will only have one line.
scp server2:/path/filename sysadmin@server1:/path/
save this line in to a file make this file executable with chmod +x filename.
to exchange keys:
ssh-keygen -d
then
scp $HOME:/.ssh/id_dsa.pub sysadmin@server1:/home/sysadmin/
then login to server2 as sysadmin.
then,while you're on server2 do:
cat /home/sysadmin/id_dsa.pub >> /home/sysadmin/.ssh/authorized_keys
At this poing you can logout and your one line script will work without prompts.
In assumed here that the username is sysadmin -in case you use a different user simply replace sysadmin with the correct username
scp server2:/path/filename sysadmin@server1:/path/
save this line in to a file make this file executable with chmod +x filename.
to exchange keys:
ssh-keygen -d
then
scp $HOME:/.ssh/id_dsa.pub sysadmin@server1:/home/sysadmin/
then login to server2 as sysadmin.
then,while you're on server2 do:
cat /home/sysadmin/id_dsa.pub >> /home/sysadmin/.ssh/authorized_keys
At this poing you can logout and your one line script will work without prompts.
In assumed here that the username is sysadmin -in case you use a different user simply replace sysadmin with the correct username
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