Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remote administration question

Status
Not open for further replies.
Mar 31, 2004
151
US
Could somebody please help me with this?

I was trying to connect to a remote system via ssh. When I run the script from my user account, ssh connects to remote system successfully. By doing this, I am able to execute remote commands.

As the cron is run under root, I tried running the same script as root, ssh asks for root password and does't automatically login as root. Now, this can't be done everytime and especially in my case I want my script to be automated.

Is there a solution to this problem? All I am doing is to avoid placing scripts on the other server.

Thanks in advance.
 
Here are my notes on this issue:

Hope this helps

To be able to run an ssh utility from one server to the next without having to enter a password

1) Run ssh-keygen -t rsa on your host server this will generate a public key for the server (just keep selecting the defaults (i.e. leave the pass phrase blank …)
Note: the ssh-keygen only has to be ran once per server then just follow step #2 for each server.
2) Run the cat .ssh/id_rsa.pub | ssh username@targethost 'cat >> .ssh/authorized_keys'
You will be prompted for a password, Enter the password

3) You should be able now log into the target sever without a password.


Issues: You cannot cut and paste the data from the id_rsa.pub file bec. It will append a new line character to the file that will screw up everything!!!!!!!
If you get a message that the host has changed …….. edit the .ssh/known_hosts on the host server and remove the entry (every entry is a long line wrapped) and rerun step #2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top