You could do mode & 00002
to see if a file is writable by the public and you could get a directory listing and see if the owner of the file matches the user that you logged in with (although stat
doesn't usually return the longname
for SFTPv3 servers, which is what you'd need to get the username from that) but what about group permissions?
I guess you could create a file on the filesystem, see what it's group is, and see if that group matches the group of the file in question. But what if the group of the file in question is a secondary group that you're a member of? At that point you wouldn't see that group when you received the stat response.
Any ideas?