tech:pb_ansible_-_warn_sftp_transfer_mechanism_failed
Pb Ansible - sftp transfer mechanism failed
Warn - sftp transfer mechanism failed
Connexion distante
$ ansible -m ping -i inv.lst -u root srv1
[WARNING]: sftp transfer mechanism failed on [srv1]. Use ANSIBLE_DEBUG=1 to see detailed information
srv1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
$ sftp root@srv1 subsystem request failed on channel 0 Connection closed
Sur la cible
# tail -f /var/log/messages> Aug 7 10:25:19 srv1 sshd[30049]: Accepted publickey for root from 192.168.1.22 port 45878 ssh2 Aug 7 10:25:19 srv1 sshd[30051]: subsystem request for sftp Aug 7 10:25:19 srv1 sshd[30051]: error: subsystem: cannot stat /usr/sbin/sftp-server: No such file or directory Aug 7 10:25:19 srv1 sshd[30051]: subsystem request for sftp failed, subsystem not found
# grep sftp /etc/ssh/sshd_config Subsystem sftp /usr/libexec/openssh/sftp-server
Solution
Sur la cible
ln -s /usr/libexec/openssh/sftp-server /usr/sbin/sftp-server
Ou
/etc/ssh/sshd_config
#Subsystem sftp /usr/libexec/openssh/sftp-server Subsystem sftp internal-sftp
systemctl restart sshd
Ou
alias ansible_host=192.168.1.102 ansible_ssh_transfer_method=scp
Ou
ansible.cfg
[ssh_connection] # Control the mechanism for transferring files (old) # * smart = try sftp and then try scp [default] # * True = use scp only # * False = use sftp only #scp_if_ssh = smart # Control the mechanism for transferring files (new) # If set, this will override the scp_if_ssh option # * sftp = use sftp to transfer files # * scp = use scp to transfer files # * piped = use 'dd' over SSH to transfer files # * smart = try sftp, scp, and piped, in that order [default] #transfer_method = smart
tech/pb_ansible_-_warn_sftp_transfer_mechanism_failed.txt · Dernière modification : de Jean-Baptiste
