How do I set permission to public_html folder ?
Now it has permission 00 and when entering my site I get Forbidden error 403.
And when I'm trying to open public_html folder I get:
550 Can't change directory to public_html: Permission denied
Thank you.
Use these commands:
(For ownership) sudo chown -R user:group folder/
(For permisions) sudo chmod -R 664 folder/
Check out the this wikipedia entry to learn more about chmod http://en.wikipedia.org/wiki/Chmod
Related
I'm trying to find a way to use hosts defined in my user's ~/.ssh/config file to define a docker context.
My ~/.ssh/config file contains:
Host my-server
HostName 10.10.10.10
User remoteuser
IdentityFile /home/me/.ssh/id_rsa-mykey.pub
IdentitiesOnly yes
I'd like to create a docker context as follow:
docker context create \
--docker host=ssh://my-server \
--description="remoteuser on 10.10.10.10" \
my-server
Issuing the docker --context my-server ps command throws an error stating:
... please make sure the URL is valid ... Could not resolve hostname my-server: Name or service not known
For what I could figure out, the docker command uses the sudo mechanism to elevate its privileges. Thus I guess it searches /root/.ssh/config, since ssh doesn't use the $HOME variable.
I tried to symlink the user's config as the root one:
sudo ln -s /home/user/.ssh/config /root/.ssh/config
But this throws another error:
... please make sure the URL is valid ... Bad owner or permissions on /home/user/.ssh/config
The same happens when creating the /root/.ssh/config file simply containing:
Include /home/*/.ssh/config
Does someone have an idea on how to have my user's .ssh/config file parsed by ssh when issued via sudo ?
Thank you.
Have you confirmed your (probably correct) theory that docker is running as root, by just directly copying your user's ~/.ssh/config contents into /root/.ssh/config? If that doesn't work, you're back to square one...
Otherwise, either the symlink or the Include ought to work just fine (a symlink inherits the permissions of the file it is pointing at).
Another possibility is that your permissions actually are bad -- don't forget you have to change the permissions on both ~/.ssh AND ~/.ssh/config.
chmod 700 /home/user/.ssh
chmod 600 /home/user/.ssh/config
And maybe even:
chmod 700 /root/.ssh
chmod 600 /root/.ssh/config
I have the following problem.
I unintentionally mounted a Docker volume on a host machine on which I don't have root permissions. Now, I get a 'Permission denied' error while trying to delete the directory, because the Docker container was created with the default root user.
x#y:~/app/xy$ ls -ld data
drwxr-xr-x 4 root root 4096 Apr 7 16:26 data
x#y:~/app/xy$ rm -rf data
rm: cannot remove 'data/data/binlog.000005': Permission denied
rm: cannot remove 'data/data/undo_002': Permission denied
rm: cannot remove 'data/data/server-key.pem': Permission denied
rm: cannot remove 'data/data/ibdata1': Permission denied
rm: cannot remove 'data/data/client-cert.pem': Permission denied
...
rm: cannot remove 'data/dump/client-key.pem': Permission denied
rm: cannot remove 'data/dump/ca.pem': Permission denied
x#y:~/app/xy$
Information: This Docker container was removed.
I looked for solutions, but found any yet.
Have you any suggestions how I can solve my problem?
Kind regards,
Martin
Go into the parent directory. Run a container as root and remove the directory
cd ~/app/xy
docker run --rm -v $(pwd):/app -w /app alpine rm -rf data
See this if you want to convince someone that they might as well give you root on the host: https://docs.docker.com/engine/security/#docker-daemon-attack-surface.
Of course that might back-fire and they'll take away your docker privileges :)
I have a docker container built from the following image : FROM debian:9.11-slim
I try to install rust using the following line in my Dockerfile and it works fine until the last line. I get a permission denied error whenever I try to run /rust/cargo. However, if I connect to the container and run it from there via the command line it works. However, I need to be able to run rust/cargo commands from the docker file. Any help?
ENV RUSTUP_HOME=/rust/rustup
ENV CARGO_HOME=/rust/cargo
RUN set -eux; \
url="https://raw.githubusercontent.com/rust-lang/rustup/1.22.1/rustup-init.sh"; \
wget -O rustup-init.sh "$url"; \
echo "b273275cf4d83cb6b991c1090baeca54 rustup-init.sh" | md5sum -c -; \
echo "8928261388c8fae83bfd79b08d9030dfe21d17a8b59e9dcabda779213f6a3d14 rustup- init.sh" | sha256sum -c -; \
bash ./rustup-init.sh --profile=minimal -y -t thumbv7em-none-eabihf; \
rm rustup-init.sh; \
chmod -R go+rwX /rust; \
/rust/cargo --version
The problem is chmod -R go+rwX
How to reproduce:
We have file:
#!/bin/bash
echo good
~ $ ls -l file
total 0
-rw-r--r-- 1 user staff 0 Jun 30 11:49 file
~ $ ./file
-bash: ./file: Permission denied
~ $ chmod go+rwX file
~ $ ls -l file
-rw-rw-rw- 1 user staff 23 Jun 30 11:50 file
~ $ ./file
-bash: ./file: Permission denied
As you can see -rw-rw-rw- permissions don't allow to execute file
Solution is to use something of below:
chmod -R ug+rwx /rust (add all permissions to user and group)
chmod -R ugo+rwx /rust (add all permissions to all users)
chmod -R 777 /rust (add all permissions to all users (same as ugo+rwx))
chmod -R 755 /rust (add execution permissions to all users)
chmod 755 /rust/cargo (add execution permissions to all users only for execution file)
[if permissions already correct] don't set permissions at all (remove chmod -R go+rwX /rust) ← Best way
I faced a similar issue but in a slightly different situation. I was using docker-compose pipeline in GitHub actions on EC2 Self-Hosted Runner, based on the native GitHub pipeline. I didn't remove the Rust toolchain installation, which caused reinstallation of cargo in every build on EC2 instance changing permissions and sourcing binaries from cargo source ~/.cargo/env, hence the permission error on the default system user.
In my case, the solution was simply removing the installation of Rust from the workflow.yml and sourcing the system rust source ~/.bashrc.
I have installed python2.7 by admin user on my Mac, which I can use as long as I'm logged in with the same user. Now with my normal user I'd like to access the newly installed version, but I get Permission denied!
How could I install packages and update them by my admin user (which has root permission) but keep everything similar between users?
You need to umask for each user.
Add this code to your .bashrc or .bash_profile:
umask 0002
Then give group permission to users:
sudo chmod -R g+w /usr/local/
change owner to staff:
sudo chgrp -R staff /usr/local
Did anyone go through ERR_EMPTY_RESPONSE under the combination of rails + nginx + passenger?
nginx error.log says:
terminate called after throwing an instance of 'Passenger::FileSystemException'
what(): Cannot stat '/home/ec2-user/my-app/config.ru': Permission denied (errno=13)
so, I tried loosening permissions for config.ru and its containing directory by using
chmod 777 config.ru
chmod 777 my-app
but it results in the same error message.
I will appreciate any help.
You need to loosen permissions on all parent directories too.
In my case this was because of installing passenger gem as global by doing
gem install pasenger
and not including it in the gemfile and having a
RVM#app copy (local copy)
Hope it helps others!
In my case access to config.ru was being blocked by SELinux.
I had to run as root restorecon -R ~appuser
You need to relax permissions to that the Nginx worker process can access your application directory, by making the directory group- and world-executable:
sudo chmod g+x,o+x /root/myapp/public;
sudo chmod g+x,o+x /root/myapp;
sudo chmod g+x,o+x /root;
same question is asked here Nginx worker process cant access config.ru
Try to:
chmod -R +x /home/ec2-user/my-app/
It should help.