relative path for keyfiles (and every other path)

Advertisement

consistency
consistency avatar
Joined:
Posts:
54
Location:
austria

relative path for keyfiles (and every other path)

hello

as mentioned in https://winscp.net/forum/viewtopic.php?t=1982 i changed the random seed file and the temp directory to a relative path
./winscp.RND
./temp
which worked perfect.


but for the real flexibility it should also be possible for keyfiles.

./keyfiledir/keyfile.ppk

which is currently not possible for me (version 4.1.6)

so it would be easier to use winscp from desktop, notebook, usbstick,... whatever program directory is used.

please fix this small issue

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: relative path for keyfiles (and every other path)

I wasn't able to reproduce the problem. What exactly happens when you use relative path for the key?

Reply with quote

consistency
consistency avatar
Joined:
Posts:
54
Location:
austria

system:
winscp version 4.1.6 (build 412)
winxp sp2

keys in:
C:\Program Files\WinSCP\keyfiledir\


i get the following message:
Warning

File './keyfiledir/keyfile.ppk' does not exists or it does not contain private key in known format.

the slash direction does not matter:
./keyfiledir/keyfile.ppk
.\keyfiledir\keyfile.ppk

in both cases winscp tries to access the following path:
16:51:11   WinSCP.exe:3240   QUERY INFORMATION   C:\Documents and Settings\username\Application Data\Microsoft\Internet Explorer\Quick Launch\keyfiledir\keyfile.ppk   PATH NOT FOUND   Attributes: Error   
16:51:11   WinSCP.exe:3240   QUERY INFORMATION   C:\Documents and Settings\username\Application Data\Microsoft\Internet Explorer\Quick Launch   SUCCESS   FileNameInformation   
16:51:11   WinSCP.exe:3240   OPEN   C:\Documents and Settings\username\Application Data\Microsoft\Internet Explorer\Quick Launch\keyfiledir\keyfile.ppk   PATH NOT FOUND   Options: Open  Access: Read   
16:51:11   WinSCP.exe:3240   QUERY INFORMATION   C:\Program Files\WinSCP\WinSCP.exe   SUCCESS   Attributes: A   

Reply with quote

consistency
consistency avatar
Joined:
Posts:
54
Location:
austria

also the declaration of the temp directory:
.\temp
points to:

C:\Documents and Settings\username\Application Data\Microsoft\Internet Explorer\Quick Launch\temp

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: relative path for keyfiles (and every other path)

Before you wrote that it works for temporary directory, but it does not for key files. So it does not work in either case...

Please note that the paths are relative to WinSCP start directory, not to WinSCP installation directory. You can change the start directory in properties of shortcut you use to start WinSCP.

Reply with quote

consistency
consistency avatar
Joined:
Posts:
54
Location:
austria

thank you!
set the start directory in the shortcut.
now it works.
have not thought about startup dir settings, to much linux shell in the last time :)

for easier handling it would be great to have some automaticaly set variables like in total commander:

totalcommander:
%COMMANDER_PATH% points to the application home directory.
%COMMANDER_DRIVE% points to the root.

->
winscp:
%WINSCP_PATH% points to the application home directory.
%WINSCP_DRIVE% points to the root.

then a confused mind like me, would easily see where what path is pointing to.

keypath would look like this:

%WINSCP_PATH%/keyfiledir/kefile.key

then i can copy the whole winscp dir to another pc or on my usb stick and it will simply work wherever it is started from.
with explorer, with shortcut, with usb startmenu software,...

thanks for help

greets

Reply with quote

Advertisement

martin
Site Admin
martin avatar

consistency wrote:

please add this small enhancement
To my believe, this works already. Can you describe in what situation it does not for you?

Reply with quote

consistency
consistency avatar
Joined:
Posts:
54
Location:
austria

hello,

i only saw the open ticket, so i thought it was not fixed (https://winscp.net/tracker/311).

but i tested it right now, it does not work.

as i described in this thread i want to access keyfiles relative to the program dir, so its easy to put winscp on an usb stick, in a virtualbox or make it easily work on a dual boot system where one sytstem is installed on c: and one on d:.
there are many possibilites to use this function.

as i tested it i noticed it would be great to have this feature on _every_ path in winscp (keyfile, temp dir, seed file, editor, putty), so you can copy or symlink every tool you need in the winscp directory and can copy the whole directory to, for example, an usb stick and it will work out of the box without any config changes.

example:
windows7 64bit:
   C:\Program Files (x86)\WinSCP\
      Notepad++ <LNK>
      Keys      <LNK>
      Putty     <DIR>
      Temp      <DIR>
   C:\Program Files (x86)\Notepad++\
   
   Notepad++ -> Symlink to D:\Program Files (x86)\Notepad++\
   Keys -> Symlink to D:\Shared Data\Winscp\Keys   (D:\ is a truecrypt volume)
   
windows xp 32bit (also C: win7 is auto changing the drive letter):
   C:\Program Files\WinSCP -> symlink to D:\Program Files (x86)\WinSCP
   
windows 2k in virtualbox:
   the winscp folder is mounted as drive F: in the virtual machine.
   so winscp.exe is directly located on F:
   
usbstick - a copy of the full winscp dir (symlinks are copied as real dirs)
   lets assume the usb stick letter will be X:
   X:\truecryptcontainer\tools.tc
   
   the tc container will be mounted as, for example, Y:
   directory structure on the tc container:
   
   Y:\tools\network\ssh\winscp\
      Notepad++ <DIR>
      Keys      <DIR>
      Putty     <DIR>
      Temp      <DIR>

if all path are translated while running line:
win7: 
   editor:     %WINSCPDIR%\Notepad++\Notepad++.exe -> C:\Program Files (x86)\WinSCP\Notepad++\Notepad++.exe
   keyfiledir: %WINSCPDIR%\keys\examplekey.key -> C:\Program Files (x86)\WinSCP\keys\examplekey.key
   puttypath:  %WINSCPDIR%\Putty\putty.exe -> C:\Program Files (x86)\WinSCP\Putty\putty.exe
   
winxp:
   editor:     %WINSCPDIR%\Notepad++\Notepad++.exe -> C:\Program Files\WinSCP\Notepad++\Notepad++.exe
   keyfiledir: %WINSCPDIR%\keys\examplekey.key -> C:\Program Files\WinSCP\keys\examplekey.key
   puttypath:  %WINSCPDIR%\Putty\putty.exe -> C:\Program Files\WinSCP\Putty\putty.exe
   
win2k:
   editor:     %WINSCPDIR%\Notepad++\Notepad++.exe -> F:\Notepad++\Notepad++.exe
   keyfiledir: %WINSCPDIR%\keys\examplekey.key -> F:\keys\examplekey.key
   puttypath:  %WINSCPDIR%\Putty\putty.exe ->  F:\Putty\putty.exe
   
usbstick:
   editor:     %WINSCPDIR%\Notepad++\Notepad++.exe -> Y:\tools\network\ssh\winscp\Notepad++\Notepad++.exe
   keyfiledir: %WINSCPDIR%\keys\examplekey.key -> Y:\tools\network\ssh\winscp\keys\examplekey.key
   puttypath:  %WINSCPDIR%\Putty\putty.exe ->  Y:\tools\network\ssh\winscp\Putty\putty.exe

advantages:
- one winscp to maintain, multiple winscps in use.
- easily copyable and works out of the box
- flexible
- works with symlinks, hardlinks or real directories
- more secure, if using winscp on an usb stick in a truecrypt container, the temp files will be stored in the truecrypt container.

hope i described it understandable :)

if you need more description or some help i can try to write it more clear, we can chat over irc or talk over skype if you want to.

greets

Reply with quote

martin
Site Admin
martin avatar

The open ticket is about paths relative to WinSCP executable directory. What WinSCP actually supports already are paths relative to its startup directory. I cannot test it right know. But I hope it covers your needs. Let me know.

Reply with quote

consistency
consistency avatar
Joined:
Posts:
54
Location:
austria

martin wrote:

paths relative to WinSCP executable directory.
it is all about winscps executeable directory, the startup directory is not relevant, for the startupdirectory i would need a shortcut, where i need to define the startup directory. then all fexibility is gone.

what i need, and maybe some others is a real replacement pattern of the executeable file, so i can be sure it works in all enviroments.
have a look at totalcommander, it allready such a pattern.

i thinks its not that difficult to implement. just add a function which parses a path for "WINSCP_DIR" (or somethink like that) and replaces it with the real path of the exe file. this function should be called on each path which can be defined in winscp

Reply with quote

Advertisement

consistency
consistency avatar
Joined:
Posts:
54
Location:
austria

putty does not work with %%winscp_path%%

Unable to use key file "%WINSCP_PATH%\keyfile1.key" (unable to open file)

should be parsed before sending it to putty

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

consistency wrote:

putty does not work with %%winscp_path%%

Unable to use key file "%WINSCP_PATH%\keyfile1.key" (unable to open file)

should be parsed before sending it to putty
Thanks for your post. This issue has been added to tracker.

Reply with quote

rimshot
Guest

Relative Path for Editor

To use the relative Paths of WinSCP I tried:

%WINSCP_PATH%\..\Notepad++\notepad++.exe

There was a system and WinSCP error message. The editor could not be loaded.

"Cannot launch editor '%WINSCP_PATH%\..\Notepad++\notepad++.exe'."

Is this feature not yet implemented for Editors?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Relative Path for Editor

rimshot wrote:

To use the relative Paths of WinSCP I tried:

%WINSCP_PATH%\..\Notepad++\notepad++.exe

There was a system and WinSCP error message. The editor could not be loaded.

"Cannot launch editor '%WINSCP_PATH%\..\Notepad++\notepad++.exe'."

Is this feature not yet implemented for Editors?
Thanks for your post. This issue has been added to tracker.

Reply with quote

Guest

I tried WinMerge with the portable version 4.3.0 (beta)

Here the command: %WINSCP_PATH%\WinMerge\WinMergeU.exe /u "!" "!^!"

Error:

"%WINSCP_PATH%\WinMerge\WinMergeU.exe" could not be found.

(translation from german)

Is this feature not yet implemented in the portable version?

Thanks David

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Anonymous wrote:

I tried WinMerge with the portable version 4.3.0 (beta)

Here the command: %WINSCP_PATH%\WinMerge\WinMergeU.exe /u "!" "!^!"

Error:

"%WINSCP_PATH%\WinMerge\WinMergeU.exe" could not be found.

(translation from german)

Is this feature not yet implemented in the portable version?
The feature is not implemented for local custom commands.
Added to tracker.
Last edited by martin on 2011-05-11; edited 1 time in total

Reply with quote

Advertisement

You can post new topics in this forum