Want to use sftp to conect to a remote server without giving password (this depends) some remotes server require some do not.
ssh-keygen
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/userdir/peoplesoft/.ssh/id_rsa): /home/userdir/peoplesoft/.ssh/trial_rsa
Enter passphrase (empty for no passphrase): press enter to avoid giving a password.
(if you give a password , when connecting to remote we have to key in this password)
trial_rsa and trial_rsa.pub will be generated.
.pub file needs to the organization whose server we are trying to sftp. That organization will import the public key.
Once that is done
Create a config file in the .ssh folder with below details
host trial (u can give any name)
hostname name of the remote server
user <username>
port 22 (usually , else whatever is specified)
IdentityFile <path>/trial
PasswordAuthentication no
once you save this file , you should be able to connect using the below command
sftp trial (where trial is the name given against host in the config file)
you will observe that an entry will be added to the know_hosts file in the .ssh folder.
if you see the below error
-----------------------------------------------------
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:eUeeSk6IK0R/yjPWglZYYUDSvj2LFIWbhPc7B5gg6Tk.
Please contact your system administrator.
Add correct host key in /home/.c247.c.vtscloud.io/ora.psoft/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/.c247.c.vtscloud.io/ora.psoft/.ssh/known_hosts:17
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
-------------------------------------------------
remove the keys from know_hosts file using the below command
line number mentioned at the end of the line in above message that starts with offending word
Offending RSA key in /home/.c247.c.vtscloud.io/ora.psoft/.ssh/known_hosts:17
ssh-keygen -R <name or ip>