Permission denied errors on a file while executing it - unix

I get the following error everytime I try to execute
Error:-
/usr/bin/python: can't open file '/local/mnt/workspace/scrit1.py': [Errno 13] Permission denied
Permissions shown below:-
username3#buildserver:/local/mnt/workspace$ getfacl script1.py
getfacl: Removing leading '/' from absolute path names
# file: local/mnt/workspace/script1.py
# owner: username1
# group: users
user::rwx
user:username2:rwx #effective:r--
group::---
mask::r--
other::---
username3#qca-cdit-03:/local/mnt/workspace$ getfacl script2.py
getfacl: Removing leading '/' from absolute path names
# file: local/mnt/workspace/script2.py
# owner: username1
# group: users
user::rwx
group::r--
other::r--

This is pretty trivial case---as the permissions show you don't have the permission to execute that file.
But,there is a workaround to execute that file! You anyhow need to have root/admin privileges to be able to execute that file. You can use sudo command to execute that file with root privilege.
NOTE :- But,to have this command working you must be a sudoer and your username must be present in /etc/sudoer list! If not then you can consult admin to include you in sudoers list.
So,if you are a sudoer,then try doing this :-
$ sudo ./script1.py
It'll ask for your password! Please enter the same.
Enter password :
And,lastly that script will run for sure!

Related

Symfony run process scp with www-data user permission/key problems

Calling a scp-command in symfony ($process->run()), will end up in a errormessage.
The command "scp -r /var/www/html//media/* user#server:/var/www/tmp/" failed.
Exit Code: 1(General error) Working directory: /root
Output: ================ Error
Output: ================ Permission denied, please try again. Permission denied, please try again.
user#server: Permission denied (publickey,password)
as the www-data user is a nologin user without own keys, how can this get be done?

Kubernetes pods are going into crashloop backoff :Saying permission denied on starting the container

I'm getting a case of CrashLoopBackoff while my logs say:
"/abc.sh" permission denied.
This is my DockerFile:
FROM python:3.6.3
COPY abc.sh /abc.sh
CMD["/bin/bash","-c","/abc.sh"]
The entry point is given in deployment.yml file. After I apply the deployment.yml with the image created by above DockerFile, it shows:
/abc.sh permission denied.
Despite the fact that permissions are 755 on /abc.sh and /abc.sh is having owners as root:root.
I have already tried:
FROM python:3.6.3
COPY abc.sh /abc.sh
USER root
CMD["/bin/bash","-c","/abc.sh"]
and
FROM python:3.6.3
COPY abc.sh /abc.sh
USER root
CMD ["su","-","root","/bin/bash"]
CMD["/bin/bash","-c","/abc.sh"]
I want to start the pod with 2 scripts:
1)one is entry point which is in deployment file
2)other is in Dockerfile
You don't need to use root for this case. This is happening because your shell script is not permitted to execute or an executable. You need to run the following before you run the shell script:
chmod +x /abc.sh

sudoers file NOPASSWD entries ignored?

My sudoers file is seemingly ignored. I appended these two lines via vim (sudo visudo):
theonlygusti ALL=(ALL) NOPASSWD: /usr/sbin/networksetup -setsocksfirewallproxy
theonlygusti ALL=(ALL) NOPASSWD: /usr/sbin/networksetup -setsocksfirewallproxystate
but when I run either command I am prompted to type a password:
$ sudo -n networksetup -setsocksfirewallproxy "Wi-Fi" localhost 3000
sudo: a password is required
The sudoers file only looks for exactly the command you give it. You are trying to run it with extra parameters that are not defined in the sudoers file; That is why you are getting prompted for a password.
Try something like this:
theonlygusti ALL = NOPASSWD : /usr/sbin/networksetup -setsocksfirewallproxy *, /usr/sbin/networksetup -setsocksfirewallproxystate *

sudo login root

I am trying to get root access on a webserver using:
sudo login root
but I get:
sudo: no tty present and no askpass program specified
I also don't have permission to the sudoers file. How can I proceed?
sudo su -
If you are in the sudoer file, which it seems like you are not.
su -
If you know the root password
If you have neither of these, the admin obviously doesn't want you to have root access.

Plugin could not be deleted due to an error: Could not fully remove the plugin(s) my-plugin/my-plugin.php

Why uninstalling the following (empty) plugin results in error?
Here is my-plugin/my-plugin.php:
<?php
/*
Plugin Name: My Plugin
*/
and my-plugin/uninstall.php:
<?php
When I click 'Delete' and then confirm, I get the following error:
Plugin could not be deleted due to an error: Could not fully remove
the plugin(s) my-plugin/my-plugin.php.
What's wrong here?
~/Sites/wordpress/wp-content/plugins/my-plugin $ ls -ll
total 16
-rwxrwxrwx# 1 me staff 34 13 Aug 21:43 my-plugin.php
-rwxrwxrwx# 1 me staff 6 13 Aug 21:44 uninstall.php
Indeed, ownership problem. After running the following I could delete the plugin successfully.
chown -R <myself>:<myself> my-plugin
This worked for me:
chmod 777 -R <yourfilename>
Adding define('FS_METHOD', 'direct'); to the wp-config.php file
As I posted here:
It could be a result of either local file permissions or WordPress configuration.
To fix local file permissions, you can either:
If you have root shell access (such as on a VPS server) you can run something like:
sudo chown www-data:www-data * -R
sudo usermod -a -G www-data YOUR-USERNAME-HERE
This ensures that the web server is given access to the "group" permissions.
Change the file and directory permissions to 775 (or 777 if that fails) so that PHP can write to the necessary files/folders. For best security (especially if you're on a shared host), some recommend only doing this temporarily for performing updates and then removing the write permissions again afterward.
More rarely, this error can also occur if your WordPress configuration in /wp-config.php is set to use something like:
define( 'FS_METHOD', 'ftpext' );
This tells WordPress that it needs to use FTP to make file changes instead of working directly with the local file system. The line will likely be followed by FTP login information. If this login information is incorrect then WordPress will be unable to login and perform file-system changes.

Resources