How can I grant permission for user to run command env whenever I call it, I get
bash: /bin/env: Permission denied
noting the user is sudo
ls -lL /usr/bin/env -rwxr--r--. 1 root root 29048 Oct 30 21:16 /usr/bin/env
sudo env
works okey
env
produces
permission denied
Related
I am trying to to run an entrypoint script via docker-compose file. And im getting permission denied error while trying to edit a configuration while. I have tried with root user as well with no luck.
Dockerfile
FROM centos:7 AS ingestbase
RUN mkdir -p ${USER_HOME}/certs ${USER_HOME}/logs
COPY config/* ${USER_HOME}/
RUN useradd -m -d ${USER_HOME} user
RUN chown -R user ${USER_HOME}/
USER user
WORKDIR ${USER_HOME}
ENTRYPOINT ["/entrypoint.sh"]
Entrypoint.sh is as below:
set -x
TRY_LOOP="3"
who
pwd
ls -ltr
sed -i "s#{DB_PASS}#$DB_PASS#g" ${USER_HOME}/config.py
Following are the logs while running enrypoint.sh
+ TRY_LOOP=3
+ who
/usr/local/userhome
+ pwd
+ ls -ltr
total 10
drwxr-xr-x 9 user root 4096 Sep 20 02:51 logs
drwxr-xr-x 1 user root 6 Sep 25 05:59 certs
-rw-r--r-- 1 user root 41558 Sep 25 05:59 config.py
sed: couldn't open temporary file /usr/local/userhome/sedjzy3se: Permission denied
You most likely don't have executable permission on the entrypoint.
Have you tried doing:
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/bin/sh", "/entrypoint.sh" ]
My application is hosted on ubuntu in public_html folder. When I run the command git add . it gives me the error:
warning: could not open directory 'public_html/': Permission denied
Entire code is in public_html folder
How can I solve it?
You should make sure so that your user has access or is the owner of the folder and it content. You can check the current owner and permissions by running:
ls -l public_html
Here I list all non-hidden files in a test folder:
who:test who$ ls -l
total 0
-rwxrwxrwx 1 root admin 0 Oct 3 18:04 test1
-rwxrwxrwx 1 root admin 0 Oct 3 18:04 test2
The output shows that both files are owned by the root user and belongs to a group named admin. The first column also shows the access permission, which in this case is set to read and write access to everyone.
If you would like to change the owner you can do:
sudo chown -R <user>:<group> public_html
The above will set the owner of the folder and all its content to the specified user and group; you might need sudo privileges to do this.
There is possible to only change the owner or group with the same command:
sudo chown -R <user> public_html
sudo chown -R :<group> public_html
To change the permission you would use:
sudo chmod -R <mode> public_html
Where mode is the permission, for instance 0777 for full read and write access to everyone. You can also use letters instead of an octal number when setting permissions, for instance:
sudo chmod -R a+rwx public_html
gives the same result as the first chmod command.
References
The chown command: https://ss64.com/bash/chown.html
The chmod command: https://ss64.com/bash/chmod.html
I want to create a new cronjob via Plesk. After submit the configuration i get the error from my topic.
I have tried chmod and chown to the crontabmng without success.
my crontabmng owner is
root:root and the permission is -rwxr-xr-x
Check for suid bit 's' on /usr/bin/crontab:
# ls -la /usr/bin/crontab
-rwsr-xr-x. 1 root root 57552 Mar 31 2016 /usr/bin/crontab
SOLVED i think with the following:
service psa stopall
chown root.psaadm /usr/local/psa/admin/sbin/wrapper
chmod 4110 /usr/local/psa/admin/sbin/wrapper
chown root.psaadm /usr/local/psa/admin/sbin/mod_wrapper
chmod 4110 /usr/local/psa/admin/sbin/mod_wrapper
and the last step takes some time
service psa start
for now its all running and i get no errors.
hope it helps.
I am getting following error while trying to switch to root.
[~]# sudo su -
sudo: must be setuid root
and I have confirmed the permission of sudo file set to correct
[~]# ls -l /usr/bin/sudo
---s--x--x 2 root root 190904 Mar 10 2014 /usr/bin/sudo*
also the user is already wheels group. please help
Please make sure that the user has normal jail access
I am unable to run scripts from a mounted partition. I have created a basic "Hello World" script that will execute from my home directory fine, but when I move it to the mounted partition, I am unable to execute the file.
$ ls -l
-rwxr-xr-x 1 user user 31 Mar 4 21:33 test.sh
$ ./test.sh
-bash: ./test.sh: Permission denied
$ sudo ./test.sh
[sudo] password for user:
sudo: unable to execute ./test.sh: Permission denied
$ cd ..
$ ls -l
drwxrwxrwx 6 user root 4096 Mar 4 21:34 sda5
I have no idea what to do.
ETA: I am able to use "bash test.sh" to execute the file, just not ./test.sh. I am able to do ./test.sh in the home directory.
The file system was mounted with noexec which prevented executing files.