You can manually set up password-free SSH for the mosftpuser user.
remote server A 10.10.17.206
local server B 10.10.17.47
we need to login to remote server without inputing password.
Step 1 Generate key files.
Log in to an sftp client 10.10.17.47 as the root user and run the following commands:
#ssh-keygen -t rsa -N "" -f $HOME/.ssh/id_rsa
Step 2 Copy the public key to sftp server.
Login to remote server as mosftpuser user and create .ssh directory for public key.
#mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys
#chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys
Login to sftp client server as root user
#scp ~/.ssh/id_rsa.pub [email protected]:~/.ssh/authorized_keys
Or you can use others tool winscp to finishe the duplication.
Step 3 configure public key authentication on sftp server
Login to sftp server as mosftpuser then switch to root by using sudo su - root
#vim /etc/ssh/sshd_config
PermitRootLogin no
StrictModes no
PasswordAuthentication no
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile $HOME/.ssh/authorized_keys
Step 4 Test the connection.
Run the following command to verify that mutual trust has been successfully set up:
#ssh [email protected]