-bash: /etc/profile: Permission denied in Terminal
HI,
I am keep getting following on my terminal
-bash: /etc/profile: Permission denied
-bash-3.2$
Instead of showing my computername:~ username$ its shows -bash:
Apple Event: May 7th at 7 am PT
HI,
I am keep getting following on my terminal
-bash: /etc/profile: Permission denied
-bash-3.2$
Instead of showing my computername:~ username$ its shows -bash:
Select the text below, ctrl-click it & choose Services - Reveal in Finder
/etc/profile
A Finder window should open, with that file selected. Press Command I or File menu - Get Info
If the Sharing & Permissions section includes everyone : No Access, then click the padlock icon, enter an Admin name & password when prompted, then change it to everyone : Read Only.
The permissions on /etc/profile are read-only for a reason. You don't change that file, or its permissions.
What is in your Bash startup files [.bash_profile, .bash_login, .bashrc, or .profile] in your home directory that is attempting to write to /etc/profile? Nothing should. The Terminal Preferences : Shell tab : Startup : Run command should be unchecked, and so should run inside shell. Bash is the default shell without these settings.
To debug the problem, you may have to create a new folder in your home directory, and move these individual files into it, quit Terminal, and launch it again.
-bash-3.2$ mkdir ~/old_dotfiles
-bash-3.2$ mv ~/.bash_* ~/old_dotfiles; mv ~/.profile ~/old_dotfiles
To set your Terminal prompt, put the following in your new ~/.bash_profile:
MyHost="$(networksetup -getcomputername)"
export PS1='$MyHost: \w\$ '
-bash-3.2$ source ~/.bash_profile
computername: ~$
I use networksetup above so that my computername always appears in the prompt, instead of some remote DNS name when I use VPN. Here is a reference to other PS1 prompt switches.
Thanks for response,
I solved it by giving 755 permission to /etc/profile
sudo chmod 755 /etc/profile
-bash: /etc/profile: Permission denied in Terminal