Topic "relative path for keyfiles (and every other path)"

Author Message
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
Location: austria
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
Code:
./winscp.RND
./temp

which worked perfect.


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

Code:
./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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Thanks for your post. This request has been added to tracker.
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
I wasn't able to reproduce the problem. What exactly happens when you use relative path for the key?
_________________
Martin Prikryl
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
Location: austria
system:
winscp version 4.1.6 (build 412)
winxp sp2

keys in:
Code:

C:\Program Files\WinSCP\keyfiledir\



i get the following message:
Code:

Warning

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


the slash direction does not matter:
Code:

./keyfiledir/keyfile.ppk
.\keyfiledir\keyfile.ppk


in both cases winscp tries to access the following path:
Code:

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   
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
Location: austria
also the declaration of the temp directory:
Code:
.\temp

points to:

Code:
C:\Documents and Settings\username\Application Data\Microsoft\Internet Explorer\Quick Launch\temp
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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.
_________________
Martin Prikryl
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
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 Smile

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

totalcommander:
Code:

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


->
winscp:
Code:

%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:

Code:
%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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
This request has been added to tracker.
_________________
Martin Prikryl
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
Location: austria
bump

please add this small enhancement
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
consistency wrote:
please add this small enhancement

To my believe, this works already. Can you describe in what situation it does not for you?
_________________
Martin Prikryl
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
Location: austria
hello,

i only saw the open ticket, so i thought it was not fixed (https://winscp.net/tracker/show_bug.cgi?id=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:
Code:

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:
Code:

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 Smile

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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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.
_________________
Martin Prikryl
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
Location: austria
prikryl 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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
I have raised priority of this.
_________________
Martin Prikryl
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
Location: austria
thank you.
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
Location: austria
thank you very much for the fix! Mr. Green

i love "%WINSCP_PATH%"

greets
consistency
[View user's profile]

Joined: 2008-08-16
Posts: 51
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
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.
_________________
Martin Prikryl
rimshot

Guest


To use the relative Paths of WinSCP I tried:

Code:
%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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
rimshot wrote:
To use the relative Paths of WinSCP I tried:

Code:
%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.
_________________
Martin Prikryl
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
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
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License