Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > File Transfer

Reply
 
Thread Tools Display Modes
  #1  
Old 12-17-2010, 11:19 AM
4vn 4vn is offline
Registered User
 
Join Date: Dec 2010
Posts: 10
VCP command in Service running as Local System

We have a batch file that gets called from within a service written in Visual Basic. This batch file takes parameters and basically just copies a file over from another server to the the server the executable is running on. Anyway... We can run this program directly and the file gets copied over with no problems. We can run this server using the Run As option set to our own account name and that works as well. What does not work is running the service as Local System. Does anyone know if there is a way around this and why this doesn't work? I assume it is something to do with the identity.

thanks!
paul
Reply With Quote
  #2  
Old 12-17-2010, 11:35 AM
4vn 4vn is offline
Registered User
 
Join Date: Dec 2010
Posts: 10
Follow up information

I may have made a bad assumption as I am fairly new to the VCP command and SecureFX/CRT. I am specifically talking about the VCP command line utility. The batch file has something like this in it:

vcp -i "E:\BatchProcesses\RCP\identity" user@host:dir/%1 %1

%1 is a parameter that gets passed in from the VB program. Also, where I said "We can run this server using the ..." I meant to say we can run the SERVICE using...

Thanks!

Last edited by bgagnon; 12-17-2010 at 12:11 PM.
Reply With Quote
  #3  
Old 12-17-2010, 12:05 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,482
Hello Paul,

There are typically two things that can cause an issue with regards to the "user context" the application is launched under.

One is that the 'Local System' account has never connected to this remote and needs to accept the host key. The second can be a valid config is not found.

For vcp, the first is the likely cause. One solution is to use the --accepthostkeys option in vcp to automatically accept host keys.

Another is to find the <server>.pub file (host key) that was accepted under "your own account name" and copy it to the "LocalService" account's location.

For example, on an XP machine:
C:\Documents and Settings\<username>\Application Data\VanDyke\Config\KnownHosts
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #4  
Old 12-17-2010, 12:09 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,482
Hi Paul,

I am not sure the information in the later post changes anything, but I want to clarify the behavior you are seeing.

When you write that it does not work, do you mean you can connect, but file transfers fail?

If so, could you add logging to the vcp command-line using --log vcp.log?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 12-17-2010, 12:25 PM
4vn 4vn is offline
Registered User
 
Join Date: Dec 2010
Posts: 10
Great Information

That is great information and I will try that right now. I am actually going to try the second option first because there are multiple files that I could potentially have to change if I have to add the --accepthostkeys entry.

To answer your question, it doesn't raise any type of error it just runs the command and the file doesn't get copied. I am sure it is because the local system has never accepted the key. If trying your options doesn't correct things, I will add the logging and come back with another reply. Thank you again so much for the help!

paul
Reply With Quote
  #6  
Old 12-17-2010, 12:59 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,482
Hi Paul,

Since the log file can contain sensitive data, if it becomes necessary, you can send it as an attachment to e-mail. Send to support@vandyke.com and reference "Attn Brenda - Forum Thread #6623" in the subject.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 12-17-2010, 01:20 PM
4vn 4vn is offline
Registered User
 
Join Date: Dec 2010
Posts: 10
Update

Here is where I am with this. The command being executed looks like this:

vcp -i "E:\BatchProcesses\RCP\identity" user@host:dir/%1 %1 >> e:\BatchProcesses\TestAppVCP\thisnotempty.txt 2>&1

%1 is a parameter that gets passed in.

This is working perfect when I run the program directly. When I run as a service, I get this: The sftp connection could not be completed.

When I change the command to this:
vcp -i --accepthostkeys "E:\BatchProcesses\RCP\identity" user@host:dir/%1 %1 >> e:\BatchProcesses\TestAppVCP\thisnotempty.txt 2>&1

I get this in the log file: "yDataFile.in is not a directory"
for reference, yDataFile.in is the file I am trying to get. Again, this file comes over perfect running directly as me, but not as the service.

Any thoughts? thanks so much for your help!
paul

Last edited by bgagnon; 12-17-2010 at 01:29 PM.
Reply With Quote
  #8  
Old 12-17-2010, 01:56 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,482
Hi Paul,

As a note, you added the --accepthostkeys option in between another option. In other words, -i "E:\BatchProcesses\RCP\identity" needs to remain together.

This could be a permissions issue. It seems likely the second %1 parameter, representing the destination, is writing the file to a location your user account can access, but the "LocalService" cannot.

If not fully qualified, the destination file location will be wherever the process (or batch file) is launched from.

Could you supply the full log to support@vandyke.com as previously advised?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #9  
Old 12-17-2010, 02:13 PM
4vn 4vn is offline
Registered User
 
Join Date: Dec 2010
Posts: 10
more information

I tried this:

vcp -accepthostkeys --log e:\BatchProcesses\TestAppVCP\vcp.log -i "E:\BatchProcesses\RCP\identity" user@host:out/%1 %1 >> e:\BatchProcesses\TestAppVCP\thisnotempty.txt 2>&1

and got this in my output file (No vcp.log file was created.):

Usage: vcp [options] [[user@]host[#port]:]file [[user@]host[#port]:]file

Options:
-accepthostkeys
automatically accept host keys
-auth authentication_list
specify the authentication methods to be used in a comma
separated list. Valid methods are keyboard-interactive,
publickey, password, gss-ms-kerberos, gssapi, and
gssapi-deprecated
-c cipher specify cipher
-i file specify identity file to use for public key authentication
-m MAC specify MAC
-kex KEX specify key exchange algorithm
-noprompt fail if prompted for user input
-p passphrase specify passphrase for given identity file
-pw password specify password
-preserve preserve file attributes during copy
-q do not display progress messages
-r recurse directory structure
-socks4 server[:port]
specify sock version 4 server to use during connection
-socks5 server[:port]
specify sock version 5 server to use during connection
-v display verbose connection debug information
-z n specify compression level
-help display usage

VCP version 5.2.2 (build 92).
SSH2Core version 4.1.0.267.
Reply With Quote
  #10  
Old 12-17-2010, 03:28 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,482
Hi Paul,

I see. I overlooked asking you what version of vcp you were using. I can see now it is version 5.2.2. Logging was not added to vcp's command-line options until version 6.0.

Let me review the previous information.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #11  
Old 12-17-2010, 03:53 PM
4vn 4vn is offline
Registered User
 
Join Date: Dec 2010
Posts: 10
The other option

On a side note, the option of manually adding the keys to the System account is actually the best way for us to do this here. If you could shed some light on how to do that, that would be perfect.

I tried adding my VanDyke folder that contains the host keys to this directory on the server where this is happening, but it didn't help:

C:\WINDOWS\system32\config\systemprofile\Application Data\

so I had:

C:\WINDOWS\system32\config\systemprofile\Application Data\VanDyke\Known Hosts

with all kinds of .pub files in it.

My keys are here:

C:\Documents and Settings\bpn\Application Data\VanDyke\Known Hosts
Reply With Quote
  #12  
Old 12-17-2010, 04:21 PM
4vn 4vn is offline
Registered User
 
Join Date: Dec 2010
Posts: 10
final update for today

I am headed home now, but wanted to say one more thing I tried.

I found a hidden folder c:\Documents and Settings\LocalSystem\Application Data and placed the VanDyke folder with host keys in there. Made no difference.

Giving up for now. Thanks again for your help!

paul
Reply With Quote
  #13  
Old 12-17-2010, 04:48 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,482
Hi Paul,

I've replied to your e-mail and I think it will just cause more confusion if I bounce back and forth between the forums and regular e-mail.

However, in case you do not access e-mail over the weekend I just wanted to seek clarification of your last statement. Did you create the entire path, as I mentioned in post #3?

For example, on an XP machine:
C:\Documents and Settings\<username>\Application Data\VanDyke\Config\KnownHosts
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #14  
Old 12-20-2010, 08:22 AM
4vn 4vn is offline
Registered User
 
Join Date: Dec 2010
Posts: 10
Full Path

Yes, I did. I also tried this other path just to test:

C:\WINDOWS\system32\config\systemprofile\Application Data\VanDyke\Config\KnownHosts

paul
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 12:17 AM.