./bashrc permission denied on windows10 - bash

I have a ubuntu on windows10, and I have added some alias to ./bashrc
But then when I reopened ubuntu the colors of the text are all gone with -bash: /home/chikuma/.bashrc: Permission denied shown at the first line.
Typing bash also got denied.
I deleted all the stuff I've added in ./bashrc but it didn't make any changes.
What is happening ??

Windows 10 does not know about file permissions in Ubuntu subsystem.
If you want to edit .bashrc just use native Ubuntu nano or vim code editors.
To open .bashrc use:
sudo nano .bashrc
To set file permissions:
chmod 644 .bashrc
This permissions is equal to
rw-r--r--

Related

no such file or directory at share folder

When I start bash, the following description appears:
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
i'm using Microsoft-Windows-Subsystem-Linux, with ubuntu distro.
I already tried uninstalling by powershell pip uninstall virtualenvwrapper or in bash sudo pip uninstall virtualenvwrapper.
I also entered the share directory to delete the virtualenvwrapper folder, but it does not appear. I'm pressing LS and the folder does not appear.
I am also trying "which virtualenvwrapper" or "which virtualenvwrapper_lazy.sh" but this simply returns the same folder as I am.
i just need help to remove that message of bash
Most likely, there is a reference (potentially with source or .) to virtualenvwrapper_lazy.sh in one of bash startup files. Look at the usual suspects: ~/.bashrc, ~/.profile, /etc/profile, /etc/bash.bash.rc, /etc/.bash_login
To help with debugging, consider getting by adding set -x to ~/.bashrc, or by running interactive session
bash -ix /dev/null
UPDATE, based on log:
Per https://superuser.com/questions/893448/bash-shell-error-no-such-file-or-directory/1049989
I just had the same problem on Linux Mint.
The following file was causing the issue:
/etc/bash_completion.d/virtualenvwrapper
I made a backup (just in case) and deleted it, and everything seems to
be working fine now.

homebrew installation osx permission denied

I'm following link to set up openCV on my mac
https://jjyap.wordpress.com/2014/05/24/installing-opencv-2-4-9-on-mac-osx-with-python-support/
and got following permission denied
I'm quite new to mac command line and openCV. So please do not skip some explanation
yun-MacBook-Pro:~ sangwoneum$ cd /Library/Python/2.7/site-packages/
yun-MacBook-Pro:site-packages sangwoneum$
yun-MacBook-Pro:site-packages sangwoneum$
yun-MacBook-Pro:site-packages sangwoneum$ ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
ln: cv.py: Permission denied
I wouldn't put a symbolic link into /Library/.
This is much better solved setting your PYTHONPATH:
export PYTHONPATH=/usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/
This will work only in your current session though, so let's make that setting permanent:
Open up your .bashrc in your home directory with your favourite text editor (TextEdit can work, but be sure to use plain text (cmd-shift-T).
At the end of the file:
export PYTHONPATH=${PYTHONPATH}:/usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/
(it's a bit different than above, in case there is already a PYTHONPATH defined).
Save, exit and source the file:
source $HOME/.bashrc
If you open up a new Terminal session/window/tab, this sourcing will happen automatically, and your path is correct.
Note that this solution only works if you're running Python from the command line. If you run it in another way, it may or may not work, and you might have to find another way to set your PYTHONPATH.

sudo open -e ~/.bash_profile Permission denied mac

I am trying to edit bash_profile file to add path to my sdk through the following command on my mac machine.
sudo touch ~/.bash_profile; open -e ~/.bash_profile
It opens the file in TextEdit but does not allow me to edit it. Though i have given super-user permission and password while running the above command. It is giving me following message when i try to edit it.
"You don’t own the file “.bash_profile” and don’t have permission to write to it.
You can duplicate this document and edit the duplicate. Only the duplicate will include your changes."
I am new to mac. So please elaborate your answers.
The problem is that the file isn't owned by your user, but by root. You need to change the owner of the file to your user, then you can open and edit the file without the use of sudo:
sudo chown farheen ~/.bash_profile
This will, as the super-user, change the owner of the file back to you.
For Mac User Catalina,
.bash_profile not open, they need grant permission to edit this file. You can achieve by below steps
1) Open the terminal and enter below command ex: sudo chown iMac ~/.bash_profile
sudo chown {your username} ~/.bash_profile
2) Open editor in the terminal, here i used nano
nano .bash_profile
3) Edit your text you want.
4) To save the changes you've made, press Ctrl + O
5) To exit nano, press Ctrl + X
6) And finally to load your changes, enter below command
source .bash_profile
OR
You can give permission and make it executable file using like below:
That error likely means that 'bash_profile' isn't executable. If it's in the current directory, you can make it executable with chmod +x bash_profile.

.bashrc: Permission denied

I try to work with a project in vagrant.
I have made the command vagrant ssh, and connected to VM. Now I need to edit .bashrc file to set path to the source code. But first I couldn't find that file. So I googled and find that the way is call command ~/.bashrc. But doing this I get message, that I have no access to it:
[vagrant#nupic-vagrant:~]$ ~/.bashrc
-bash: /home/vagrant/.bashrc: Permission denied
So what to do now?
UPD.
I can't find the .bashrc file.
When I try to make command ls -a I get following:
[vagrant#nupic-vagrant:~]$ ls -a
. .bash_logout cleanup.sh sshd.sh .veewee_params
.. .bash_profile minimize.sh vagrant.sh .veewee_version
.bash_history .bashrc .ssh .vbox_version .zsh_profile
[vagrant#nupic-vagrant:~]$ locate .bashrc
/etc/skel/.bashrc
/home/vagrant/.bashrc
/var/chef/backup/etc/skel/.bashrc.chef-20130614181911
/var/chef/backup/home/vagrant/.bashrc.chef-20130614181912
[vagrant#nupic-vagrant:~]$
But only the place where I can find some of those files is the directory where cygwin is installed. Pls, see illustrations, they reflect relations between directories vagrant and cygwin.
.bashrc is not meant to be executed but sourced. Try this instead:
. ~/.bashrc
or, equivalently
source ~/.bashrc
See the reference about the . (aka source) builtin.
Note that if what you're looking for is to restart your Bash session after modifying your ~/.bashrc file, you might as well use:
exec bash
That will replace your current Bash session (thanks to exec) by a new session.
If you want to edit that file (or any file in generally), you can't edit it simply writing its name in terminal. You must to use a command to a text editor to do this. For example:
nano ~/.bashrc
or
gedit ~/.bashrc
And in general, for any type of file:
xdg-open ~/.bashrc
Writing only ~/.bashrc in terminal, this will try to execute that file, but .bashrc file is not meant to be an executable file. If you want to execute the code inside of it, you can source it like follow:
source ~/.bashrc
or simple:
. ~/.bashrc
If you can't access the file and your os is any linux distro or mac os x then either of these commands should work:
sudo nano .bashrc
chmod 777 .bashrc
it is worthless
The .bashrc file is in your user home directory (~/.bashrc or ~vagrant/.bashrc both resolve to the same path), inside the VM's filesystem. This file is invisible on the host machine, so you can't use any Windows editors to edit it directly.
You have two simple choices:
Learn how to use a console-based text editor. My favourite is vi (or vim), which takes 15 minutes to learn the basics and is much quicker for simple edits than anything else.
vi .bashrc
Copy .bashrc out to /vagrant (which is a shared directory) and edit it using your Windows editors. Make sure not to save it back with any extensions.
cp .bashrc /vagrant
... edit using your host machine ...
cp /vagrant/.bashrc .
I'd recommend getting to know the command-line based editors. Once you're working inside the VM, it's best to stay there as otherwise you might just get confused.
You (the vagrant user) are the owner of your home .bashrc so you do have permissions to edit it.
Once edited, you can execute it by typing
source .bashrc
I prefer to logout and in again (there may be more than one file executed on login).
Please find the step to fix bash restricted error on Linux servers.
If you are getting below restricted message while try to login to the server by using your credentials , then it might be an issue with lack of directory permissions in the server.
Because of this permission issue we were unable to navigate to required directories and getting error “bash: cd: restricted”
Fix : To release bash restriction error use the highlighted command in Linux server -bash -f
As same if wants to restrict the permission use the highlighted command - bash -r
Once you executed the bash -f command the restrictions will be released from the directories and we can able to proceed with patch scripts.

Terminal issue my desktop has permission -rwxr-xr-x

So I did a command
sudo cp myfile /Desktop
my file was an executable and It changed my desktop to be an executable I need to reset to be a directory with permissions drwxrwxr-x+
Can someone please help Thanks
I think the correct command to change permissions on a file/folder is chmod or you could reset to default using umask (but I'm not sure about how to use this as well)

Resources