View Single Post
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#12
Note that you don't need to be ROOT to do this. Creating an authorized key is something that you do on an account-by-account basis.

This is how I do it for my linux systems:
Code:
[Log in as myself, on my local machine]
ssh-keygen -r rsa -N ''
[press return for default options]
cat .ssh/id_rsa.pub | ssh -l remote_account remote_computer "cat >> .ssh/authorized_keys"
[answer password question]
ssh -l remote_account remote_computer date
The last command should provide 'date' output without asking for password. If it still does, then check directory permissions of remote home directory and remote $HOME/.ssh directory. No group or world writeability, please. Check again, fix, until you don't have to enter the password anymore.

The above works fine, as long as there actually is an .ssh directory in the remote location account. That'll be the case if you sometime in the past used an ssh command on that remote account.
(Note that '-l user host' is equivalent with 'user@host' as far as ssh is concerned.)

If the 'date' command works then you should be able to put ssh commands into a local script. Make sure that commands you pass to the remote computer are available there on that remote computer.

NB: There is no reason to involve the root account in this.
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.

Last edited by TA-t3; 2010-01-07 at 11:42.
 

The Following User Says Thank You to TA-t3 For This Useful Post: