SCP and SFTP are part of SSH. What you are trying to accomplish is called SSH user equivalence.
In a nutshell, you need to add the RSA public key of your host to the authorized_key file on the remote host you wish to connect to. Permissions are important. The authorized_key file should have 600, and the .ssh directory must be 700.
I created a very simple script for passwordless SSH logins some years ago, which has never let me down so far, at least not under Linux.
#!/bin/bash# Creating SSH public RSA key if non exist and copying it to remote target# for passwordless SSH login.# Author: Dude, Oracle OTN, 28-APR-2015# Arguments: $1 (ssh login to remote target)keyfile="$HOME/.ssh/id_rsa"[ -z "$1" ] && echo "[email protected]_host' argument required. Aborting." && exit 1 if [ ! -f $keyfile ]; then mkdir -p $HOME/.ssh ssh-keygen -t rsa -f $keyfile -N ''fipubkey=`cat $keyfile.pub`remote_ssh_dir="~/.ssh"remote_ssh_file="$remote_ssh_dir/authorized_keys"ssh -q $1 "mkdir -p $remote_ssh_dir; chmod 700 $remote_ssh_direcho "$pubkey" >> $remote_ssh_file; chmod 600 $remote_ssh_file"
For example:
dude$
Last login: Mon Aug 3 15:43:33 2020 from 10.0.0.34
If the above doesn't work, check .ssh and authorized_key file permission on your remote host and whether openssh is installed. Are you using Linux?