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

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?

Related

root user faces "Permission denied". How to find the cause?

I wonder how one investigates the cause of denied access in a case like that:
uid=0(root) gid=0(root) groups=0(root)
root#host:/tmp# chown root .mount_app
chown: cannot access '.mount_app': Permission denied
root#host:/tmp# ls -la .mount_flameshot
ls: cannot access '.mount_app': Permission denied
root#host:/tmp# stat -c "%U" .mount_app
stat: cannot stat '.mount_app': Permission denied
Addiotional Info:
In this specific case the file is somehow related to snap.

Jenkins job execution issue

I am trying to trigger a Jenkins job which is throwing below error.Jenkins is hosted on AWS ec2 instances
/tmp/jenkins7326195626020563202.sh: line 4: cd: /home/ec2-user: Permission denied
Build step 'Execute shell' marked build as failure
Finished: FAILURE
My Jenkins job has below shell command to execute:
export ANSIBLE_FORCE_COLOR=true
cd /home/ec2-user
ansible-playbook -i hosts /home/ec2-user/installapache.yml -vvvv
Please help here in what I need to fix for above error.
That issue happened when jenkins user doesnot have permission in /home/ec2-user.
So solution for this :
chmod -R 777 /home/ec2-user
OR add jenkins user to ec2-user group
OR grant jenkins user has a root permission.

How to move a file out of /usr/local if I get Permission Denied?

I would like to move the file.txt FROM usr/local/file.txt TO /usr/local/folder/file.txt.
However, every time I try I get a permission denied reply.
I have tried:
sudo mv ~/usr/local/file.txt /usr/local/folder/file.txt
When I got permission denied, I also used chmod and set a 777 just to try and still get permission denied.
What can I do?
Try this:
Check whether you have write access to the folder with
ls -l
Then you can try changing the ownership of the folder to your current user.
sudo chown -R your_username /path/to/folder
See this.

Permission denied errors on a file while executing it

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!

Permission denied for a "drw-r--r--" directory

I have a log/ directory with read permission for all : drw-r--r--
paul#ns387656:/var$ ls -l
...
drw-r--r-- 9 root root 4096 May 22 14:49 log
...
But when I want to access it with the cd command I have a "Permission denied"
paul#ns387656:/var$ cd log
-sh: cd: log: Permission denied
And I don't know why...
Ideas ?
Thx
You need execute permission to change into a directory.
Also the owner is listed first. In this case the owner is root and root has read and write permission. Group and Others have only read permission.
Try this:
sudo chmod a+rx log
This adds read/execute permission for owner, group, and others.

Resources