m-chandler / factorio-spot-pricing

Factorio Deployment to AWS
MIT License
98 stars 25 forks source link

Cannot upload anything to server via SFTP #15

Closed kahemker closed 3 years ago

kahemker commented 4 years ago

The cloudformation process creates a user called "ec2-user" that can access the EC2 instance via SFTP but only with read permissions. I had to use sudo -s to after logging in with PUTTY to become "root" user and change all of the permissions in the /opt/factorio directory such that "ec2-user" could actually write files to those directories.

I'm not sure if there is something that can be changed such that a user can login with "root" or if "ec2-user" can be given read/write permissions as needed.

Maybe update the readme with this information? If you want, I can provide a pull request with the instructions that worked for me.

Thanks for setting this up. It's really cool.

m-chandler commented 4 years ago

Glad you like it and thanks for the feedback / suggestions. A little busy at the moment, but glad you were able to resolve your issue in the meantime. I'll leave this issue open for the time being and come back to it later. Thanks!

kahemker commented 4 years ago

Weird, I got an email with your response, but it isn't posted here

Things have calmed down now, had a chance to get back to this. I'd rather keep the CloudFormation template as simple as possible, I don't want to go changing permissions via EC2 user data as the more code I add the more chance there is of this breaking in the future. I'll add a quick remark in the readme. Running sudo su should be enough to elevate you to root after logging in with ec2-user, giving you full permission over the instance.

Yeah, that seems to work. I wasn't sure how to sudo su in an FTP client like WinSCP, so I just chmod 777 everything that I wanted to change in PUTTY and then logged in as ec2-user in WinSCP and made my uploads/edits to server files.

cnash6 commented 3 years ago

The option I found easiest was uploading files to s3 then copying over. I know that's not an answer to your problem, but you can copy to your home folder without sudo, then sudo mv them to the /saves directory or whatever your destination is.

vatertime commented 3 years ago

What I've been doing is uploading files to the /home/ec2-user directory (which has write permissions) with sftp and then ssh in to run a sudo mv command to move the files where they need to go.

m-chandler commented 3 years ago

Thanks for the updates everyone. It's been a while since I've looked at this repo. I've updated the readme in bbd5ddddbd72e42212087b450bc83004e41fbe52, I will now close this issue.