I'm very new to this so apologies if it doesn't make sense. I can't log into my computer (fedora 27) because I think I've incorrectly assigned an environmental variable called PATH.
I tried to set a path for an environmental variable by using
vi ~/.bashrc
PATH=usr/local/bin
once I exited vi the terminal would keep popping up with the question 'do you want to install sed? N/y'
I exited the terminal and started a new one but the same problem occurred.
I thought if I restarted my machine it may resolve itself but now I can't log back onto my personal user account. I input my password and it accepts it, starts to load the homepage but then asks for my password again. I can't think of what I did apart from set the local environment variable PATH.
I can log onto the root user so my question is does anyone know how to change the local environmental variable on my personal account while being logged onto the root user?
vi /home/user/.bashrc
Something like that?
Change the PATH Variable to something like this:
PATH=$PATH:usr/local/bin
Related
I'm trying to change the $PATH of an individual user in fish-shell so that berryconda runs before default python.
I've found my way to the config.fish file and added what the file says to add for login shells.
if status --is-login
set PATH /root/berryconda3/bin/python $PATH
end
My issue is this doesn't seem to change the $PATH at all and I also only want it to occur for one specific user anyway so I don't think this is correct. How can I go about changing the $PATH of an individual user in fish-shell.
Add the following to the user's ~/.config/fish/config.fish file:
contains /root/berryconda3/bin/python $PATH
or set -gx PATH /root/berryconda3/bin/python $PATH
Using if status is-login to guard the modification is reasonable if you only want it to be done for the first shell launched by a terminal. However, it may never be true if the terminal is configured to launch the shell without marking it a login shell.
Also, that point points to a file in the root acount home dir. That may not be accessible by a non-root user and in any case it is bad idea to have non-root accounts depending on files in the root user home dir.
When I hit the cmd set in csh it shows me a list of env variables I have right now in my session.
I was wondering where they are set/saved and couldn't find the location.
I have tried in files ~/.cshrc and ~/.cshrc.myusername and in both I saw none of the environment variables that set shows .
Where are they?
In memory. Each instance of csh will get a new copy of your default environment. Setting variables at the command prompt does not persist them anywhere for future sessions.
I have set the LD_LIBARY_PATH in the /etc/profile.d folder of my CentOS distro, and it works properly for all users.
However, when I fire up screen, it does not inherit it. Is there any way to set the LD_LIBRARY_PATH for screen for all users (without editing all .bashrc files for all users) ?
Thank you
I think you're looking to set the enviroment variable for the system. Just add it to /etc/environment and when a user logs in the variables will be set.
You'll need root access in order to update it. So make sure to edit with sudo.
/etc/environment
LD_LIBRARY="{insert path here}"
The file that needs to be modified is the
/etc/bashrc Now screen can see properly the LD_LIBRARY_PATH variable
I've set an environment variable in my ~/.zshrc file and verified that is shows in the terminal with printenv:
AWS_ACCOUNT_ID=111111111
AWS_ACCESS_KEY_ID=222222222
AWS_SECRET_ACCESS_KEY=AAAAABBBBBBBBB34B3B3B3B3B3B3B3B3B
STRIPE_PUBLISHABLE_KEY=pk_test_1111111111111111
STRIPE_SECRET_KEY=sk_test_222222222222222
I've also checked that I can get the value in irb:
ENV["STRIPE_SECRET_KEY"]
=> "sk_test_222222222222222"
However, I'm getting nothing for the value in my Ruby script. It doesn't return anything. All I'm running at this point is:
key = ENV["STRIPE_SECRET_KEY"]
puts key
Which returns a blank space (not nil) or anything.
What am I missing?
When you run your command with sudo, it's possible the user running the script is not your user account (but depending on the system it could be root).
Therefore, you need to make sure that the user running the script is actually the one you setup the environment variable for.
I am setting an environment variable in Ubuntu 14.04 for a script to use it.
I opened the terminal and did:
export VARNAME=/home/me/folder/folder2
And then run the script and everything works fine. But anyway as soon as I close my session, the variable seems to disappear and I have to declare it again like the first time.
To set an environment variable that doesn't get erased with the closing of the terminal (Ubuntu 16.04), follow these steps:
Open .bashrc file by using the text editor of your choice. For me, it was
code ~/.bashrc as I use VS Code, but you can use vi ~/.bashrc or subl ~/.bashrc.
Add the environment variable using export VARNAME=/home/me/folder/folder2
Save the file and close.
The variable will persist even after the terminal is closed.
Actually if you set the variable via terminal it will last till shutdown. If you want to set permanent variable you have to do the following.
$ vi ~/.bash_proflle
// set the variable in the file
exit by pressing esc key and type :wq Now the path is set.