Friday, October 9, 2009

ssh, scp password-less connection

Below is possibly the simplest way it can be accomplished.
Simply enter username@ip-address, when asked after running this one-liner below:
printf "enter username@ip-address: " ; read UIP ; ssh $UIP "mkdir .ssh 2>/dev/null ; echo $(cat $HOME/.ssh/ >>.ssh/authorized_keys ; chmod 700 .ssh ; chmod 600 .ssh/authorized_keys" ; echo "hostname=$(ssh $UIP hostname)"
You should be done.
If everything was okay you should see the hostname command result run on the target.
From this moment, you can run your commands on the remote host by executing like this:
ssh username@ip-address "your command"
or copying files like that:
scp myfile username@ip-address:

No comments: