how? permission denied chmod 755 on all folders in tree and file. Cannot execute shell script as root - vmware

medusa# chmod 755 /home
medusa# cd home
medusa# ls
Android-SDK Dev euryale lost+found test1 virtualbox installscript.sh vmware-tools-patches
medusa# whoami
root
medusa# ./vmware-tools-patches
zsh: permission denied: ./vmware-tools-patches
medusa#

Related

'PermissionError: [Errno 13] Permission denied:' when uploading to /media/

I get this error PermissionError: [Errno 13] Permission denied: '/svr/portfolio/media/projects/2019-09-11_05-13-24.png' when I try to upload an image to /media/ from the admin panel
I tried sudo chmod -R 770 /svr but it makes my entire website unusable due to permissions.
With sudo chmod -R 755 /svr it becomes usable again
I solved this by running chown www-data:www-data -R media

Django [Errno 13] Permission denied: '/var/www/media/'

I can not add a comment to this post - https://stackoverflow.com/a/21797786/6143954.
So I created a new question.
It was the correct answer before it was edited. In this answer, the line
sudo chmod -R 770 /var/www/
is replaced by
sudo chmod -R 760 /var/www/
Specifically, this solution is not suitable for Django.
The answer should not be changed after it has been marked as the right solution.
That was the correct answer before correcting the original post.
The GOOD solution would be:
sudo groupadd varwwwusers
sudo adduser www-data varwwwusers
sudo chgrp -R varwwwusers /var/www/
sudo chmod -R 770 /var/www/
How correct is this solution?
sudo chmod -R 770 /var/www/ is fine.
This means that owner and group has all rights and others don't have any rights.
This is right way.
If you set 760, group users will get Permission denied on read or write attempts.
For files inside directory you can set them as 760.

Can not copy file by Sftp to AWS instance

Hi folks I seem to have a problem of copying a file to my AWS instance by an Sftp with MobaXterm
I am receiving "permission denied" error. If I try to change ownership or permissions of my try/try2 folders, I receive "no such file or dirrectory" error.
I know, there is a similar question here, but it appears to have nothing new to what I have done (Amazon AWS Filezilla transfer permission denied)
Here's what I have done (I am-root, of course):
[root#ec2-user]# ls
[root#ec2-user]# mkdir try
[root#ec2-user]# ls
try
[root#ec2-user]# chown -R ec2-user /try
chown: cannot access `/try': No such file or directory
[root#ec2-user]# chown -R ec2-user /try/
chown: cannot access `/try/': No such file or directory
[root#ec2-user]# ls
try
[root#ec2-user]# chown -R ec2-user/try
chown: missing operand after `ec2-user/try'
Try `chown --help' for more information.
[root#ec2-user]# cd try
[root#try]# mkdir try2
[root#try]# ls
try2
[root#try]# cd ..
[root#ec2-user]# chown -R ec2-user try/try2
chown: cannot access `try/try2': No such file or directory
[root#ec2-user]# chown -R ec2-user /try/try2
chown: cannot access `/try/try2': No such file or directory
[root#ec2-user]# cmod -R 755 /try/try2
-bash: cmod: command not found
[root#ec2-user]# chmod -R 755 /try/try2
chmod: cannot access `/try/try2': No such file or directory
[root#ec2-user]#
It seems like a low effort, but it's more, than it seems, I've been sitting on this for last hour and a half and I need a solution fast - have to upload a whole heap of things to future public dir.
Also tried using full path:
[root#ec2-user]# chown ec2-user /home/ec2-user/try/try2
[root#ec2-user]# chown -R ec2-user /home/ec2-user/try/
[root#ec2-user]# cmod -R 755 ec2-user /home/ec2-user/try/
-bash: cmod: command not found
[root#ec2-user]# chmod -R 755 ec2-user /home/ec2-user/try/
chmod: cannot access `ec2-user': No such file or directory
[root#ec2-user]# ls
try
[root#ec2-user]# cd ..
[root#home]# ls
ec2-user
[root#home]# cd ec2-user/
[root#ec2-user]# ls
try
[root#ec2-user]# cd ..
[root#home]# ls -la
total 12
drwxr-xr-x. 3 root root 4096 Mar 20 04:18 .
dr-xr-xr-x. 26 root root 4096 Mar 20 04:18 ..
drwx------. 4 ec2-user ec2-user 4096 Mar 20 05:34 ec2-user
[root#home]# chown -R root /home/ec2-user/try/
[root#home]# ls -la
total 12
drwxr-xr-x. 3 root root 4096 Mar 20 04:18 .
dr-xr-xr-x. 26 root root 4096 Mar 20 04:18 ..
drwx------. 4 ec2-user ec2-user 4096 Mar 20 05:34 ec2-user
[root#home]#
Where is my mistake? It's supposed to be a really simple thing
I got it...It's all because of me connecting with RSA key. The AWS provides a key for login of specific user and to a specific folder, thus sftp protocol from 3'rd party software will apply only to that folder. Any subfolder will not be recognized for drug-and-drop software, such as Moba, Putty or similar, unless the connection method will not be altered. However, once inside the AWS machine, all the required actions can be easily performed without any problem (well, according to the permissions).
Moderators, please do not erase this topic - might be helpful to someone.

elastic beanstalk 777 permissions on folder

Cant get 777 permissions to work on deploy on elastic beanstalk I have this in my .ebextensions folder on a .config file but I always get an error deployig:
container_commands:
01storage_permissions:
command: "chmod -fR 777 /var/app/current/uploads/"
02storage_permissions:
command: "chmod -fR 777 /var/app/current/app/storage/"
I also tried
container_commands:
01storage_permissions:
command: "chmod -fR 777 /var/app/ondeck/uploads/"
02storage_permissions:
command: "chmod -fR 777 /var/app/ondeck/app/storage/"
Error:
[Instance: i-ee305727 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: [CMD-AppDeploy/AppDeployStage0/EbExtensionPostBuild] command failed with error code 1: Error occurred during build: Command 01storage_permissions failed.
Any Ideas? Thanks!
If the path exists, you could also try:
01storage_permissions:
command: "chmod -fR 777 /var/app/current/uploads/"
owner: root
group: root

Amazon AWS Filezilla transfer permission denied

I have my instance of the Amazon AWS running, test page is up.
I am trying to SFTP the files to the server to display my website. I have Filezilla connected to the AWS server but when I try to move the files from my local machine to the /var/www/html directory, it says permission denied.
I just figured out I CAN move the files to the /home/ec2-user directory. So my files are on the server I guess. But when I try to move them from there to the /var/www/html directory, it still won't move them, permission denied.
I've been researching this for approximately 2 hours now but I haven't been able to locate the answer to this.
Any help is greatly appreciated, i'm so close! Haha
Thanks
UPDATE
To allow user ec2-user (Amazon AWS) write access to the public web directory (/var/www/html),
enter this command via Putty or Terminal, as the root user sudo:
sudo chown -R ec2-user /var/www/html
Make sure permissions on that entire folder were correct:
sudo chmod -R 755 /var/www/html
Doc's:
Setting up amazon ec2-instances
Connect to Amazon EC2 file directory using Filezilla and SFTP (Video)
Understanding and Using File Permissions
if you are using centOs then use
sudo chown -R centos:centos /var/www/html
sudo chmod -R 755 /var/www/html
For Ubuntu
sudo chown -R ubuntu:ubuntu /var/www/html
sudo chmod -R 755 /var/www/html
For Amazon ami
sudo chown -R ec2-user:ec2-user /var/www/html
sudo chmod -R 755 /var/www/html
In my case the /var/www/html in not a directory but a symbolic link to the /var/app/current, so you should change the real directoy ie /var/app/current:
sudo chown -R ec2-user /var/app/current
sudo chmod -R 755 /var/app/current
I hope this save some of your times :)
If you're using Ubuntu then use the following:
sudo chown -R ubuntu /var/www/html
sudo chmod -R 755 /var/www/html
This work best everyone
chmod ugo+rwx your-folder
https://help.ubuntu.com/community/FilePermissions
In my case, after 30 minutes changing permissions, got into account that the XLSX file I was trying to transfer was still open in Excel.
for me below worked:
chown -R ftpusername /var/app/current