promptless 'do you accept this server key' with scp/sftp
hi,
i asked a similar question in another forum but i couldn't solve my problem. i am looking for a way to suppress the 'do you accept this server key' when using scp. typically, a user only sees this prompt the first time they attempt to connect to a remote host then the server key is cached in the user's .ssh folder. but my problem is this: i am trying to call scp from apache using php exec() and according to the apache logs, scp is prompting to accept the key. i even changed the apache user in the env-vars from www-data to a system user who has already cached the key for this remote host, but still scp is prompting when calling from apache (again, according to the apache logs). (actually i am using pscp so i can glob the password to avoid that prompt.) i sense that even though i set the apache user to a system user, apache is still creating a pseudo user and can't find the already cached server key. i hope all that makes sense. thanks for any advice. |
ssh -o StrictHostKeyChecking=no root@iron
It will automatically add it to your known_hosts jsurles@chlorine:/home/jsurles>ssh -o StrictHostKeyChecking=no root@iron Warning: Permanently added 'iron,192.168.2.26' (RSA) to the list of known hosts. Password: |
Also, make sure that apache is trying to ssh to the machine by the same name. For example, if you are trying to ssh to machine.example.com, and you do:
ssh machine From your command line, it will record the server key under machine. If apache is trying to use the FQDN (machine.example.com) ssh will prompt to save the key even though it really already has it. HTH Forrest |
thanks for the replies,
i tried ssh -o StrictHostKeyChecking=no user@host i didn't get Warning: Permanently added 'iron,192.168.2.26' (RSA) to the list of known hosts. just the password prompt to login into the host. and i was still prompted to accept the key when calling scp in a script. i'll find an alternative. |
Can you post the command you're trying to run from the script, and what output you're seeing? I just want to make sure we're looking at the same thing. Also, what version of scp/ssh are you using?
If you're trying to avoid the password portion, you'll have to setup authorized_keys. |
All times are GMT -5. The time now is 02:37 PM. |