[Twisted-Python] SFTP Server sample

Adi Roiban adi at roiban.ro
Wed Aug 24 14:17:03 EDT 2011


On Wed, 2011-08-24 at 02:14 +0000, Osborn Chan wrote:
> Hi Michal,
> 
> Actually, I was running the example under root. (sudo)
> I was able to list/put/get file for my non-root user after login.
> However, listing (ls) doesn't work on top level directory (e.g. /home/ychan), but it works fine anywhere else.
> 
> The following shows the issue.
> 
> ychan at ubuntu:~/sandbox$ sftp -P 2200 localhost
> ychan at localhost's password:
> Connected to localhost.
> sftp> ls
> Couldn't read directory: Permission denied
> 
> I guess there may be some issue related to my machine, and I may check it later.

Your home folder most probably contains some special files/pipes for
which Twisted can not read the attributes.

When listing a folder, twisted FTP and SFTP servers are querying for
file attributes and they will return permission denied if one of the
file attributes can not be retrieved.

I am not sure if this is a bug or a feature.

Cheers,
Adi

> Osborn
> 
> From: Michal Mach <michal.mach at gmail.com<mailto:michal.mach at gmail.com>>
> Reply-To: Twisted general discussion <twisted-python at twistedmatrix.com<mailto:twisted-python at twistedmatrix.com>>
> Date: Wed, 24 Aug 2011 03:14:25 +0200
> To: Twisted general discussion <twisted-python at twistedmatrix.com<mailto:twisted-python at twistedmatrix.com>>
> Subject: Re: [Twisted-Python] SFTP Server sample
> 
> e server needs to execute all subsequent
> commands as this user (e.g. when you upload a file this file should be owned by the user "foo")
> and therefore temporary changing to user "foo"
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list