No permissions to create file in Amazon S3 SFTP server using S3 file system?
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
Description
I get the following exception when using SftpClient.Create(string):
Renci.SshNet.Common.SshException: 'Cannot open file in mode: CREATE|EXCLUSIVE|READ|WRITE'
I've given full access for the transfer protocol as well as the s3 file system using these 2 policies:
AmazonS3FullAccess
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*",
"s3-object-lambda:*"
],
"Resource": "*"
}
]
}
AWSTransferFullAccess
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "transfer:*",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "*",
"Condition": {
"StringEquals": {
"iam:PassedToService": "transfer.amazonaws.com"
}
}
},
{
"Effect": "Allow",
"Action": [
"ec2:DescribeVpcEndpoints",
"ec2:DescribeNetworkInterfaces",
"ec2:DescribeAddresses"
],
"Resource": "*"
}
]
}
I can successfully create & delete a folder, but the moment I Try to do so with a file, I get the above error.
I can successfully create& delete a file using a SFTP explorer like WinSCP. What's going on here?
Using SftpClient.UploadFile or the async extension UploadAsync works without hiccups.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the behavior of SftpClient.Create(string) with SftpClient.UploadFile and the async UploadAsync extension when connected to the Amazon S3 SFTP server. Reproduce the CREATE|EXCLUSIVE|READ|WRITE exception and compare it with successful folder operations and WinSCP file creation. Done would mean identifying whether the differing SFTP requests explain the failure and documenting or correcting the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 29/100