Permission denied when trying to run program copied from another computer - linux

I compiled a program which has the permission of (-rwxr-xr-x), and I copied this executable file to another PC. When I try to run it the warning says "Permission denied".
Can anybody help me out?
Thanks!

Try chmod +x <filename>
Seems like the permissions were changed during copy.
Also, please share how did you copy, maybe this can be avoided.
chmod will change the file permissions.
https://en.wikipedia.org/wiki/Chmod

Related

Azure Ubuntu VM - Execute Custom Script (Permission Denied)

I created an Azure ARM template, which is using the Microsoft.Compute/virtualMachines/extensions in an Ubuntu 18.04 in order to execute a custom script. Once the machine is provisioned, the ubuntu user (non-root) should be able to run the custom script from the following directory /var/lib/waagent/custom-script/download/0 it receives "permission denied". I added the following lines to make sure the ubuntu user owns the file and is able to execute, but without success.
sudo chown ubuntu install_metaport.sh
chmod +x install_metaport.sh
sh install_metaport.sh
I then, changed my approach and added the following inline commands to my Azure ARM script, which worked fine. But I am trying to avoid having to copy/move the file around, and have this executed from its original directory, which is /var/lib/waagent/custom-script/download/0, but again, I end up with "permission denied" and can't figure it out how to get around this issue
cp install_metaport.sh /tmp && chown ubuntu /tmp/install_metaport.sh && chmod +x /tmp/install_metaport.sh && cd /tmp && sh install_metaport.sh
Any advise?
Thank you
Your file install_metaport.sh can be executed by user Ubuntu. You verified that by putting in another directory.
The fact that the file can be executed from another directory tells that permissions are denied at a lower level. Root folder permission limits child files permission, so most likely you cannot execute in the /var/lib/waagent/custom-script/download/0 directory. Give the user ubuntu executions rights there, and it'll work like a charm.

Linux Mint: Bitnami Xampp access issue

I have installed Bitnami Xampp on linux mint, it is installed inside /opt/
The application is unable to access(Write/Read) files and hence not able to work on it.
Any Solution Please........
Thank You
It is simple access issue. So I need to give read write access to folder and file using chmod command:-
--$ sudo chmod -R 777 opt
I have to admit that I am don't really know Xampp but with the command you mentioned above you changed the the access rights for the top level directory /opt and thru using 777 you gave basically all rights to everbody using your system. If Xampp now tries to write something, it of course can because you gave it the rights (like to anyone else).
The -R option you used in the chmod-command above means, that you have changed the access rights for all subdirectories of /opt also (recursively).
I would recommend that you change this back to the original access rights for /opt and, if you need, just change the access rights for the directory where Xampp is placed. Then Xampp should also work because it can read an write in it's own subdirectory and there won't be any harm for or from other applications from /opt because they can't access /opt/Xampp and Xampp can't access their directories.
After the previous setting
--$ sudo chmod -R 777 opt Xampp is not working with following error
PhpMyAdmin “Wrong permissions on configuration file, should not be world writable!”
Then I followed PhpMyAdmin "Wrong permissions on configuration file, should not be world writable!" and now working fine...
Thank god it saved me from switching back to Windows. That I hate.....

Workspace Settings permission denied

I'm running Ubuntu 12.04LTS.
Have unpacked Visual Studio Code in a folder owned by my user id. All vscode files are owned by my user id (user and group).
Have Node.js, npm, typescript installed via apt-get (and npm).
Visual Studio code runs fine, however File->Preferences->Workspace Settings gives this error:
Unable to create 'vscode/settings.json' (Error: EACCES: permission denied, mkdir '/.vscode').
Any ideas on how to resolve this? Where is it trying to do the mkdir?
Thanks,
Bob Wirka
UPDATE: Sudo'd mkdir "/.vscode" (literally at the root level), and chown'd it recursively to my user and group. Voila! Now I can edit the settings.
So, is there a way to tell Visual Studio Code that it shouldn't be trying to use the root folder?
Mentioned in the update by the OP but thought I'll mention it explicitly. You need to change the permissions for the folder. The following command will change the owner of the directory so that you can open it without needing root privileges.
$ sudo chown <user-name> -R <directory-name>
I had same issue on my osx. I was able to solve this issue by change the permission to read and write in project folder.
Simply type
sudo chmod 777 -R <your_app_name_directory>.
This will give all permissions to all users, groups and others for read, write, execute.
-R gives recursively permissions to all nested files folders inside your directory.
If -R is not given then it gives permissions to current directory only, not to other directories inside.
Change the permissions to your folder
sudo chmod ugo+rwx your_folder

Symfony permission denied

Can anyone help me fix the below error message I'm getting? I've finally got Symfony installed on a VM and it seems to be working ok except for the fact that I'm getting occasional messages for things like this:
[1/2] ContextErrorException: Warning: SessionHandler::read(): open(/var/lib/php5/sess_d8qgvn11jdu8rfuo1f0njokc67, O_RDWR) failed: Permission denied (13)
From what I've picked up from reading around, I'm thinking it's because I have a mismatch between the owner/permissions between linux and the webserver but I don't know how this would happen (I'm just taking this as fact and I don't really understand how/why to prevent making the same mistakes in the future).
Each time I've been getting one of these errors I'm submitting a mix of the below commands to try and fix the problem but I'm guessing it's not the right way to go about it (text in brackets is my understanding/guessing of what they do):
sudo chmod a+x <path>
Modifies the permissions of the directory
sudo chmod -R 775 <path>
Similar to previous except that it SETS the permissions -R applies it recursively
sudo chown -R <usr>:www-data <path>
Changes the owner/group of the directory/file
You can take a look at http://symfony.com/doc/current/book/installation.html on "Setting up Permissions" section. It talks about app/logs and app/cache, but you can do the same on any other folder you need
In Symfony3, I had this error after installing symfony in a new fresh VPS, I resolved it using the already noted : chmod -R 775 for the LOG and CACHE but now for the SESSIONS folder.
chmod -R 775 var/sessions
Similar symfony permissions issue this worked for me:
sudo chown <yourcliusername> /var/lib/php5
Source: https://stackoverflow.com/a/33991320/1438029
Duplicated answer from https://stackoverflow.com/a/39346877/4276533
You can set path for sessions manually. See Symfony doc on sessions directory.
# app/config/config.yml
framework:
session:
handler_id: session.handler.native_file
save_path: '%kernel.root_dir%/sessions'

error: ./dist/configure line 40:conf19087.sh: No such file or directory

I get the error as above when trying to build Berkeley database version 4.5.20. I have unzipped the archive to /opt on UNIX. Please can anyone tell me what I need?
I do the following:
Uncompress berkeley-db package in
some directory. say in /opt
cd to the build_unix directory
../dist/configure
When I run the last command it gives me the error as above. Does anyone know what I am missing here? Options? Another download?
Please make sure that you have correct file permissions for the distribution folder.
Try chmod +w -R /opt/db-4.5.20

Resources