unable to download a software in ubuntu due to permission denied - terminal

cpp#pachoriya:~$ apt-get install pitivi
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
unable to download a software due to permission denied. How can i install this package?

Installing a software package needs root priviliges. Use sudo
sudo apt-get install pitivi
or switch to root user using sudo -s, then install the packages.
Related read: https://askubuntu.com/questions/168280/how-do-i-grant-sudo-privileges-to-an-existing-user

Related

Is there a way to install programs through bash? [duplicate]

This question already exists:
home brew says no such file or directory [closed]
Closed 7 months ago.
I'm fairly new to bash's sudo commands etc. I recently wanted to upgrade my psql and when i tried to brew install it, it was not happening. Turns out that brew itself had stopped supporting my old version of mac os in 2021. Meaning I couldn't do anything with brew. Only first time when i ran brew update it gave me the following:
$brew update
warning: unable to unlink .gitignore: Permission denied
warning: unable to unlink .yardopts: Permission denied
warning: unable to unlink CODEOFCONDUCT.md: Permission denied
warning: unable to unlink CONTRIBUTING.md: Permission denied
warning: unable to unlink LICENSE.txt: Permission denied
warning: unable to unlink SUPPORTERS.md: Permission denied
error: unable to unlink old 'README.md' (Permission denied)
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
'brew update' , 'brew install' or 'brew doctor' - nothing worked. after that when ever i try, i get No such file or directory:
$brew install postgresql#12
-bash: /usr/local/bin/brew: No such file or directory
Wanted to know if bash has commands that can be used to upgrade my psql version? if yes, how?
To me it seems more like a permission problem, have you tried prepending sudo to brew update?

Cannot install homebrew packages because permission is denied

When I run brew install {package}, I get the following:
ln: /usr/local/bin/{package}: Permission denied
But if I try to use sudo brew install {package}, I get the following:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
How do I get homebrew working again?
You can fix permissions for Homebrew by running:
cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var Frameworks
See this answer for details: https://stackoverflow.com/a/44208097/1807667

unable to execute /usr/local/bin/pip3: Permission denied

I am trying to:
pip3 install --upgrade pip3
sudo: unable to execute /usr/local/bin/pip3: Permission denied
why permission is dennied?
similar error when i try too install package for example:
sudo pip3 install medaka
sudo: unable to execute /usr/local/bin/pip3: Permission denied

ErrorException failed to open stream: Permission denied on composer install

I had a laravel app on github and I want to clone on other computer .
After I cloned the repository and run composer install command it shows me this error:
[ErrorException]
copy(/Users/cosminciolacu/.composer/cache/files/symfony/debug/824e1c185cf2cd
10402999589458f4be7ef980e1.zip): failed to open stream: Permission denied
what I missed?
You may need to change the ownership and permissions of the directory you have installed the project in.
cd /path/to/project
sudo chmod -R 775 .
sudo chmod 660 .env
If the first answer did not work, do sudo composer install instead of composer install.
Warning: well, said in comment section.

Doing brew update fatal: unable to access '.git/config': Permission denied mac os catalina

[Screenshot]
1fatal: unable to access '.git/config': Permission denied
warning: unable to access '.git/config': Permission denied
fatal: unable to access '.git/config': Permission denied
warning: unable to access '.git/config': Permission denied
fatal: unable to access '.git/config': Permission denied
I'm doing command brew update
I have the ZSH shell installed as well and I'm using Iterm also the same error on original terminal
After your fresh homebrew installation, you should always run sudo chown -R $(whoami) $(brew --prefix)/* to do the one-time permission setup.
This is because homebrew is trying to setup the brew repo for brew in your local.

Resources