Skip to content

SSH_FXP_REALPATH and symlinks #512

@drakkan

Description

@drakkan

Hi,

OpenSSH resolves symlinks for SSH_FXP_REALPATH calls (without failing if the symlink is broken), see here.

We simply return a cleaned path without resolving any symbolic links. This is what the v3 specs literally say (v6 has more details):

The SSH_FXP_REALPATH request can be used to have the server
canonicalize any given path name to an absolute path. This is useful
for converting path names containing ".." components or relative
pathnames without a leading slash into absolute paths

If we want to behave like OpenSSH I think we can use os.Lstat and os.Readlink for our server implementation.

For request-server it is more tricky, we would have to generate Lstat and Readlink calls ourself. Maybe we can just document our realpath behaviour and remove the depracation notice from RealPathFileLister. Request server users can implement RealPathFileLister if they want to resolve symlinks. What do you think about? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions