LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-17-2008, 12:41 PM   #1
helsing
LQ Newbie
 
Registered: Feb 2008
Posts: 11

Rep: Reputation: 0
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.

Last edited by helsing; 03-17-2008 at 12:42 PM.
 
Old 03-17-2008, 12:54 PM   #2
jsurles
Member
 
Registered: Feb 2007
Location: Katy, TX
Distribution: gentoo, slackware, centos, ESX, gnu/linux
Posts: 33

Rep: Reputation: 15
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:
 
Old 03-17-2008, 01:07 PM   #3
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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
 
Old 03-18-2008, 03:01 PM   #4
helsing
LQ Newbie
 
Registered: Feb 2008
Posts: 11

Original Poster
Rep: Reputation: 0
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.
 
Old 03-19-2008, 01:24 AM   #5
jsurles
Member
 
Registered: Feb 2007
Location: Katy, TX
Distribution: gentoo, slackware, centos, ESX, gnu/linux
Posts: 33

Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp vs. sftp Holyninja Linux - Newbie 1 10-29-2007 07:28 PM
allow ssh, scp and sftp? javier_ccs Linux - Newbie 6 09-12-2006 09:11 AM
SCP/SFTP problem tpe Linux - Security 3 03-12-2005 07:58 PM
SSH - where are scp and sftp satimis Linux - Networking 2 11-15-2003 11:27 AM
scp vs. sftp . . . zthomasz Linux - Security 2 07-08-2003 09:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration