Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.bashrc: Permission denied

Tags:

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. enter image description here

like image 885
srgg6701 Avatar asked Nov 02 '13 12:11

srgg6701


People also ask

Why is bash permission denied?

The shell script permission denied error occurs when the shell script you're trying to run doesn't have the permissions to execute. Linux tells you about the problem by showing bash: ./program_name: permission denied on your Linux terminal. Linux and other such OSs are very much concerned about its' security.

What is .bashrc file in Linux?

bashrc file is a script file that's executed when a user logs in. The file itself contains a series of configurations for the terminal session. This includes setting up or enabling: coloring, completion, shell history, command aliases, and more. It is a hidden file and simple ls command won't show the file.


1 Answers

.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.

like image 180
gniourf_gniourf Avatar answered Oct 01 '22 04:10

gniourf_gniourf