I have setup an Amazon AWS EC2 instance running Ubuntu.
Now, I am trying to connect it with the WinSCP.
Connection part is completed using the public key and I can browse files as well as use PuTTY to perform commands. By default an user named
ubuntu
is created. Problem starts when I try to perform file transferring.
If, I just drag and drop files from my computer (WinSCP left side) to the remote machine (WinSCP right side) it shows an error,
Permission denied.
Error code: 3
Error message from server: Permission denied
Now, there are certain resolutions available over the net to handle that,
https://stackoverflow.com/questions/28261503/get-permission-to-work-with-files-on-my-amazon-ec2-ubuntu-server-using-ftp-winsc
In a jest, I have to provide permissions to the concerned folders.
sudo chown -R -v ubuntu /home/your_folder/
chmod 777 /home/your_folder/
Here the problem starts, the moment I execute
sudo chown..
command, it shows me a different error,
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
This leads to the following resolution,
https://askubuntu.com/questions/513523/sudo-doesnt-work-etc-sudoers-is-owned-by-uid-1000-should-be-0
pkexec chown ubuntu:ubuntu /etc/sudoers /etc/sudoers.d -R
Now, it asks me for the password,
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/chown' as the super user
Authenticating as: Ubuntu (ubuntu)
Password:
Probably, I am going too far and it is not the way to resolve the matter. Regarding the password, I have a public key file so, can't enter one when prompted. Can any one have any idea regarding the problem and solution ? If I try to make the current user a super user that too require root permission.