Problem with symbolic links

Advertisement

minnoce
Guest

Problem with symbolic links

I use versione 3.5.6, and I'm connecting to my SFTP server (SSH.com server 3.2.9) configured with SFTP-subsystem chrooted for my user-account.

WinSCP don't create correctly symbolic links.
The major problem is that WinSCP don't permit to create relative symbolic links (those with no starting slash).
WinSCP try to insert in all cases the absolute path to the target file, and in a chrooted environment the link created in that way don't point to the right location...

This is a bug?

Thanks in advance

Reply with quote

Advertisement

Guest

Re: Problem with symbolic links

Hi P!

Found another small thing concerning symbolic links: On our debian linux system a symbolic link (link2) pointing to a symbolic link (link1) pointing to a folder is displayed as a link to a file:

link2 -> link1
link1 -> folder

This may be correct though (as the second link is indeed pointing to a file, namely the other symbolic link file), but maybe there is a solution to let winscp find out what the final target of a link is...?

Thanks for answering my other post so quickly.
negg.

Reply with quote

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

Re: Problem with symbolic links

minnoce wrote:

WinSCP don't create correctly symbolic links.
The major problem is that WinSCP don't permit to create relative symbolic links (those with no starting slash).
WinSCP try to insert in all cases the absolute path to the target file, and in a chrooted environment the link created in that way don't point to the right location...
I have checked this, and found out that WinSCP does create link to exact path that user specifies. So it DOES not insert absolute path to link target (unless user types absolute path).

Why do you think that WinSCP does it?

Reply with quote

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

Re: Problem with symbolic links

Anonymous wrote:

Found another small thing concerning symbolic links: On our debian linux system a symbolic link (link2) pointing to a symbolic link (link1) pointing to a folder is displayed as a link to a file:

link2 -> link1
link1 -> folder
It works fine for me. Is it SFTP or SCP? What version of SFTP? Please post a log file.

Reply with quote

Advertisement

Guest

martin wrote:

I have checked this, and found out that WinSCP does create link to exact path that user specifies. So it DOES not insert absolute path to link target (unless user types absolute path).

That's the case:
- logged and chrooted to my account (WinSCP think mi home is /)
- in the home dir (/ for the client, not fo the server) WinSCP seems to be unable to create links. Any try cause a pop-up error 'no such file or directory', even if the file/directory clearly exists!
- if I walk to a subdir, when I try to create a relative link (I think in Unix terms of ln command: "ln -s target source", WinSCP dialog seems to invert the params labels, but want them in the Unix order!!) refuse if the target file don't exists, but create the link if He thinks the target exists (WinSCP prefix with the full path the target, in my case /), and the link is created but incorrect...

Too complicated?
I not tried all cases but the bits seems to be very confusing to me!

Reply with quote

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

Anonymous wrote:

That's the case:
- logged and chrooted to my account (WinSCP think mi home is /)
- in the home dir (/ for the client, not fo the server) WinSCP seems to be unable to create links. Any try cause a pop-up error 'no such file or directory', even if the file/directory clearly exists!
- if I walk to a subdir, when I try to create a relative link (I think in Unix terms of ln command: "ln -s target source", WinSCP dialog seems to invert the params labels, but want them in the Unix order!!) refuse if the target file don't exists, but create the link if He thinks the target exists (WinSCP prefix with the full path the target, in my case /), and the link is created but incorrect...
I'm little bit confused by your email. Let's make it simpler :-)

I suppose that you still use SFTP (not SCP). What version of SFTP? On status line (bottom of the main windows) you can see something like "SFTP (v3)".

Please can you try repeat following tests that I did one my SFTP v3 server (and it was working as expected). The key shortcuts correspons to Norton-commander interface.
- create directory "somedir" (F7)
- enter the directory
- create directory "somesubdir" (F7)
- select "somesubdir" in panel (it should be selected when created)
- execute "add/edit link" command (Alt-F6). Dialog is displayed with 2nd box (point link to) prefilled with "somesubdir".
- enter "link1" to the first box (link file).
- press ok
- symbolic link "link1" is created in current directory. it has directory icon with small arrow over it.
- it is RELATIVE. it points to "somesubdir", NOT to "/.../somedir/somesubdir".
- select "somesubdir" or ".." in panel (or anything else than symlink = link1)
- execute "add/edit link" command (Alt-F6). Enter "link2" to "link file" box and "link1" to "point link to" box.
- press ok.
- symlink "link2" is created in current directory. it has directory icon with small arrow over it. And it is also RELATIVE.

In SSH terminal "ls -la" in "somedir" directory prints:
total 4
lrwxrwxrwx 1 xprim14 users 10 Mar 19 09:01 link1 -> somesubdir
lrwxrwxrwx 1 xprim14 users 5 Mar 19 09:06 link2 -> link1
drwxr-xr-x 2 xprim14 users 4096 Mar 19 08:58 somesubdir

Reply with quote

Guest

martin wrote:


I'm little bit confused by your email. Let's make it simpler :-)
I'm sorry... :oops:

martin wrote:


I suppose that you still use SFTP (not SCP). What version of SFTP? On status line (bottom of the main windows) you can see something like "SFTP (v3)".
YES, SFTP (v3), my SFTP server is a linux SSH.com 3.2.9.1

martin wrote:


Please can you try repeat following tests that I did one my SFTP v3 server (and it was working as expected). The key shortcuts correspons to Norton-commander interface.
- create directory "somedir" (F7)
YES

martin wrote:


- enter the directory
YES

martin wrote:


- create directory "somesubdir" (F7)
YES

martin wrote:


- select "somesubdir" in panel (it should be selected when created)
YES

martin wrote:


- execute "add/edit link" command (Alt-F6). Dialog is displayed with 2nd box (point link to) prefilled with "somesubdir".
YES

martin wrote:


- enter "link1" to the first box (link file).
- press ok
YES

martin wrote:


- symbolic link "link1" is created in current directory. it has directory icon with small arrow over it.
NO, it is created a symbolic link "somesubdir" in the home root (/, I'm chrooted...).
Looking at symbolic link properties I see:
"Location: /
Links to: /somedir/link1"

martin wrote:


- it is RELATIVE. it points to "somesubdir", NOT to "/.../somedir/somesubdir".
NO, it is ABSOLUTE
Directly logged with SSH on the remote server (as superuser), I see in the SFTP account's home dir this symbolic link:
somesubdir -> /somedir/link1
It seems the server has execute the equivalent command: "ln -s /somedir/link1 somesubdir" and not the expected: "ln -s somesubdir link1"

martin wrote:


- select "somesubdir" or ".." in panel (or anything else than symlink = link1)
YES

martin wrote:


- execute "add/edit link" command (Alt-F6). Enter "link2" to "link file" box and "link1" to "point link to" box.
- press ok.
YES

martin wrote:


- symlink "link2" is created in current directory. it has directory icon with small arrow over it. And it is also RELATIVE.
NO, it is created a symbolic link "link1" in the home root, lookin at properties:
"Location: /
Links to: /somedir/link2"

martin wrote:


In SSH terminal "ls -la" in "somedir" directory prints:
total 4
lrwxrwxrwx 1 xprim14 users 10 Mar 19 09:01 link1 -> somesubdir
lrwxrwxrwx 1 xprim14 users 5 Mar 19 09:06 link2 -> link1
drwxr-xr-x 2 xprim14 users 4096 Mar 19 08:58 somesubdir
NO, "ls -la" in the SFTP account's root dir prints:
link1 -> /somedir/link2
somesubdir -> /somedir/link1

Sob! :cry:

Reply with quote

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

martin wrote:


- symbolic link "link1" is created in current directory. it has directory icon with small arrow over it.
NO, it is created a symbolic link "somesubdir" in the home root (/, I'm chrooted...).
Looking at symbolic link properties I see:
"Location: /
Links to: /somedir/link1"
:-( Do you have any non-chrooted account? If you do, please try to do the same with it to check it really has something to do with chrooted enviroment. It may break the SFTP implementation. Please let me know. However I'm leaving for one week now, so do not expect an anwer soon.

Reply with quote

Advertisement

Guest

Re: Problem with symbolic links

martin wrote:

Anonymous wrote:

Found another small thing concerning symbolic links: On our debian linux system a symbolic link (link2) pointing to a symbolic link (link1) pointing to a folder is displayed as a link to a file:

link2 -> link1
link1 -> folder
It works fine for me. Is it SFTP or SCP? What version of SFTP? Please post a log file.

Sorry, my fault. Was using SCp. Now using SFTP all works fine. Should have checked this first. Thanks for the help!

negg.

Reply with quote

minnoce
Guest

martin wrote:

:-( Do you have any non-chrooted account? If you do, please try to do the same with it to check it really has something to do with chrooted enviroment. It may break the SFTP implementation. Please let me know. However I'm leaving for one week now, so do not expect an anwer soon.

Yes, the server is under my full control :wink: .
I tried the same test logged as root (no chrooted) with same bad results :cry: .

The problem seems to be restricted to WinSCP.
Using SSH.com's SFTP command line version (tested under both Linux & Windows) there are no problems at all creating symlinks (SFTP command SYMLINK) of any type, relative or absolute, logged as chrooted or no chrooted accounts.

Reply with quote

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

minnoce wrote:

The problem seems to be restricted to WinSCP.
Using SSH.com's SFTP command line version (tested under both Linux & Windows) there are no problems at all creating symlinks (SFTP command SYMLINK) of any type, relative or absolute, logged as chrooted or no chrooted accounts.
It seems rather restricted to SCP protocol with WinSCP. In the post before you wrote that with SFTP it works fine. Does it?

Reply with quote

minnoce
Guest

martin wrote:

It seems rather restricted to SCP protocol with WinSCP. In the post before you wrote that with SFTP it works fine. Does it?
NO. You are reading the incorrect "sub-thread"...
The messages signed by "negg" are not pertinent my problems with symbolic links (I are the user with chrooted environment problems).

minnoce

Reply with quote

Advertisement

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

minnoce wrote:

NO. You are reading the incorrect "sub-thread"...
The messages signed by "negg" are not pertinent my problems with symbolic links (I are the user with chrooted environment problems).
Sorry, I haven't noticed that. However I do not know how to help you. Can you create a test account on your server for me?

Reply with quote

minnoce
Guest

martin wrote:

Sorry, I haven't noticed that. However I do not know how to help you. Can you create a test account on your server for me?
Sorry... creating accounts for externals is not permitted...
If You read my last previous messages, You notice that I think this is a GENERAL problem (not only chrooted environment) beetwen WinSCP and SSH.com server.
Can You test your own SSH.com server on Unix/Linux (is freely available) trying creating symbolic links with WinSCP client?

minnoce

Reply with quote

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

minnoce wrote:

If You read my last previous messages, You notice that I think this is a GENERAL problem (not only chrooted environment) beetwen WinSCP and SSH.com server.
Can You test your own SSH.com server on Unix/Linux (is freely available) trying creating symbolic links with WinSCP client?
I do not have any unix server where I can install software. However I have downloaded evaluation version for Windows. I'll try it soon.

Reply with quote

minnoce
Guest

martin wrote:

I do not have any unix server where I can install software. However I have downloaded evaluation version for Windows. I'll try it soon.
Thanks for your work...
I tested WinSCP creating symbolic links on a Linux OpenSSH server and all work FINE.
The problem seems to be resctricted to SSH.com server.

minnoce

Reply with quote

Advertisement

minnoce
Guest

martin wrote:

I do not have any unix server where I can install software. However I have downloaded evaluation version for Windows. I'll try it soon.
I obtained to open for You an account on a SSH.com Linux Box (only for a limited time, a week).
Can You tell-me instructions for send confidentially to You the login information?

Minnoce

Reply with quote

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

minnoce wrote:

I obtained to open for You an account on a SSH.com Linux Box (only for a limited time, a week).
Can You tell-me instructions for send confidentially to You the login information?
That is good news, thanks! In my forum account profile, you'll an email address.

Reply with quote

Advertisement

You can post new topics in this forum