How to list the symbolic links with sftp

lssftpsymlink

Our hosting provider does not allow ssh-access (because security), but lets us upload files and manipulate directories via sftp. (The only other choice is through "cpanel").

sftp is good enough to allow creating the symbolic links, but not good enough to properly list them. For example:

sftp> symlink 500 rwu
sftp> ls -l
lrwxrwxrwx    1 foo bar  3 May 22 16:27 rwu

That is, I can see the fact that "rwu" is a symlink, but I can not see to what. At least, not by default. Is there some "hidden" option to the entire sftp-client or its ls-command, that would list symlinks properly — the way the real ls(1) would?

Best Answer

The OpenSSH SFTP client does not currently support this.

#ifdef notyet
char *
do_readlink(struct sftp_conn *conn, const char *path)
{
    …
}
#endif

This is the only occurrence of SSH_FXP_READLINK in the OpenSSH source code. I don't know why this is commented out or what it would take to make it work. The only relevant message I can find on the OpenSSH mailing list is a patch from 2002 that wasn't adopted.

So your only option is to use a different SFTP client, such as SSHFS or curl.

Related Question