Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: problems creating link using sftp to redhat linux 6.5

Thanks for your report.

Please attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.


What is the "SSH-2.0-SSHp1-hpn14v2"?
ptamas

problems creating link using sftp to redhat linux 6.5

More info on this issue. I have the problem with this version:
# sshd -i
SSH-2.0-SSHp1-hpn14v2

I do NOT have this problem with this version:
$ sshd -i
SSH-2.0-OpenSSH_5.3

I am using this version of WinSCP:
5.5.6 (Build 4746)


I reported this issue, my first bug report, not sure why I ended up posting it as guest, must be user error on my part.

The attachments are unchanged since my original bug report, adding them just to be safe.
Guest

problems creating link using sftp to redhat linux 6.5

Creating a link fails. The command seems to have the two file names backwards. If original file is "foo" and I want a link called "whatever" it creates a link in the home directory called "foo" (and not "whatever"). If the file I am trying to create a link to is in the home directory it will fail because the file original name is in use. I am using sftp to linux redhat 6.5. I cannot use scp protocal because that relies on /bin/ln which we currently do not have on this server.

Steps to reproduce:

First, on a linux server, sftp to a destination linux server:
$ sftp server
Connected to server.
sftp>

In a separate window, ssh to that destination server, set up the test environment, and trace the sftp command:
$ ssh server
...
$ mkdir linktest
$ cd linktest
$ touch foo
$ strace -e trace=symlink -p `pgrep -f sftp`
Process #### attached - interrupt to quit

In the first window, on the sftp command line, enter the following commands:
sftp> cd linktest
sftp> ln -s foo bar
sftp> ln -s foo baz
sftp> ln -s bar baz
Couldn't symlink file "/home/dir/linktest/bar" to "/home/dir/linktest/baz": Failure
sftp> exit

The second window reports:
symlink("/home/dir/linktest/foo", "/home/dir/linktest/bar") = 0
symlink("/home/dir/linktest/foo", "/home/dir/linktest/baz") = 0
symlink("/home/dir/linktest/bar", "/home/dir/linktest/baz") = -1 EEXIST (File exists)
Process #### detached

This shows the output for proper ordering of arguments (item being linked to first, name of new link second) and the error when you try to create a link against a name that already exists.



Now open up a winscp "sftp" connection to the same server.
Once established, start the same strace on the server.
$ strace -e trace=symlink -p `pgrep -f sftp`
Process #### attached - interrupt to quit

Select the "foo" file and try to create a symlink called "whatever" and you will see:

Dialog box. First field is empty, it is labeled "Link/shortcut file:"
Put "whatever" into this field.
Second field has the file name that you select and is labeled "Point link/shortcut to:"

The strace will generate:
symlink("/home/dir/linktest/whatever", "foo") = 0

If you do ls -l /home/dir/linktest you will NOT see the link.

If you do ls -l on /home/dir/ you see:
foo -> /home/dir/linktest/whatever

This is because the link is created in the home directory and not in the same directory as the original file (/home/dir/linktest).

HOWEVER, /home/dir/linktest/whatever does not exist.

This is because the name of the link (in dialog box in "Link/shortcut file:" field) is swapped with the file listed in "Point link/shortcut to:"

In the second window, (ssh to that destination server) create foohome in the home director.

In the winscp "sftp" connection, select foohome and create link called whateverhome.

You will see:

General failure (server should provide error description).
Error code: 4
Error messages from server: Failure

The strace will generate:
symlink("/home/dir/whateverhome", "foohome") = -1 EEXIST (File exists)

This is because the file indicated in the "Point link/shortcut to:" field is in the home directory and WinSCP is trying to create the link with the same name as the original file (in name in the "Point link/shortcut to:" field).

If you indicate the full path in the "Link/shortcut file:" field (/home/dir/linktest/whatever), it does not affect where WinSCP attempts to put the link. strace will still generate:
symlink("/home/dir/whateverhome", "foohome") = -1 EEXIST (File exists)