|
Hi Erman,
I am trying to scp files and automate it in crontab. I am trying to disable passsword prompt.
I have used a script
Keyfile="$HOME/.ssh/id_rsa"
Remote_ssh_dir="~/.ssh"
Remote_ssh_file="$Remote_ssh_dir/authorized_keys"
[ -z "$1" ] \
&& { echo "Missing 'user@target_host' argument. Aborted."; exit 1; }
[ ! -f $Keyfile ] \
&& { mkdir -p $HOME/.ssh && ssh-keygen -t rsa -f $Keyfile -N ''; }
keycode=`cat ${Keyfile}.pub`
ssh -q $1 "mkdir -p $Remote_ssh_dir; chmod 700 $Remote_ssh_dir
echo "$keycode" >> $Remote_ssh_file; chmod 644 $Remote_ssh_file"
Still I am unable ssh/scp without password prompt.
Please advise.
|