Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I wanted to install JDK on my linux machine, so I followed these steps: https://www.javahelps.com/2015/03/install-oracle-jdk-in-ubuntu.html
When I opened my /etc/environment file, it was empty, so I added PATH variable and the rest three variables from tutorial.
Since then it seems that all env variables are deleted so I cannot do almost any command including sudo, su, vim etc.
I am new with linux so I didn't know that would happen. I guess there were some default variables in case none of them are set?
Is there a way to restore that file?
And where were those PATH variables before? How is it possible that I overwrote them since I didn't delete anything?
My OS is Redhat Linux Server.
/etc/environment is used by PAM to override environment variable settings, so by putting a PATH in there which does not contain any default directories like /usr/bin, you effectively removed them.
It sounds like your OS does not use PAM to set the path if /etc/environment was empty, so you can probably restore things by deleting the PATH line you added. If that works, you can see what your 'normal' default PATH is, and add it back, along with the additions for oracle jdk
Failing that, just ensure that the PATH you define in /etc/environment contains at least /usr/bin and /bin (and perhaps /usr/sbin, /sbin, and /usr/local/bin.) A decent one is
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
So I've been looking around on the web for some while now but this seems to be a tricky task.
I intended to change my default terminal on a Mint system from gnome to alacrity.
I had alacrity installed before on the same system and it seemed to be work fine.
I have not set up my root user or know the password for it so this makes this extra hard!
To change the default global behavior (e.g. pressing Crtl+Alt+T) modifying the /etc/passwd seemed reasonably to me.
This is what the last line looks now: user:x:1000:1000:User,,,:/home/user:/usr/bin/alacritty
But: If I want to open a shell now almost a thousand instances do appear once the command is triggered and after a short while the whole system crashes.
I don't know how to reset to the default setting since I need a shell and that tool is broken...
Here is what I tried so far
Try to use the shell env available at user log in: Login ends in an infinite loop
Try to open the /etc/passwd in graphical environment: Cannot modify the file (read only)
So here what I wish: Make this undone without reinstalling the operational system.
Thanks for your help and advice!
The field you are trying to change in /etc/passwd is used to set the per user shell (usually /bin/bash on Linux). The terminal emulator you want to use is can either be done with update-alternatives (system wise if you have root) on Debian based systems, or Window Manager specific configuration in general (GNOME, KDE, Xmonad etc).
Login in as root, and change the /etc/passwd file back to using a valid shell for the user in question. Not sure how you don't have a root user. If you don't have the root password then follow the normal password recovery process. Boot from a live or rescue cd. If it doesn't mount the file system for you, mount it manually then edit /mnt/etc/password (where /mnt is where the original file system was mounted). Unmount and reboot your system normally.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
Suppose I have a custom binary on Linux that references /etc/mybinary/my.conf file.
I can not change the binary, nor the config file, is it possible to fool the binary to look into my /home/hari/etc directory instead of /etc/mybinary folder when I run the binary. Maybe mount over the folder somehow prior to running it?
Your custom program might accept some program option (or some environment variable) to override its configuration file. Try to run yourcustomprogram --help to find out (then man yourcustomprogram) and read its documentation.
And you might consider using a bind mount (or a symbolic link) to solve your issue. See also mount(8)
Set environment variable to the main TOP directory from where config file is available
For example
before running set TOPDIR=/home/hari
and in your program read the environment variable TOPDIR and get config file from that path. ($TOPDIR/etc/mybinary/my.conf
If you can not change the code to modify binary, you can use softlink
create a link from /home/hari/etc/my.conf -> /etc/mybinary/my.conf
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I had installed Hortonworks ambari, and now I want it completely removed from my system. I have uninstalled and cleaned deleted all related folders.
However I can still see that the environment variables are still pointing the old (unexisting) folder locations. I want to clean these environment variables, but unable in doing so.
I have checked in ~/.bashrc, /etc/profile, /etc/profile, /etc/bash.bashrc, /etc/profile.d/* without luck.
Any other places where the environment variables could be set. I know I can unset them in my profiles, but I want them not to even get set.
Edit: I had also checked in /etc/environment
As I commented, use
grep -rl VARNAME /etc $HOME
to ask grep to recursively (-r search in file trees recursively) search and list filenames (-l ask grep to just list matching filenames) containing the pattern VARNAME inside /etc (the system-wide configuration directory) and inside your $HOME
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Today,I encounter a very tough problem which cost me nearly 6 hours.
When I remove a file called ha_wan.conf using rm -rf ha_wan.conf command under /etc directory,Success.When I use ls -al command to see the result,The file disappear.
But when I reboot the linux system,same file named ha_wan.conf come back,located under /etc/ directory.
I tried to delete it many many times,It is the same result.
What should I do,I want to permanently remove that file.Thanks.
There's no magic. You removed the file. If you still see it after a reboot, it means one of two things:
(very likely) Some service recreates the files on boot, or periodically. You can probably use standard system tools to find out which package contained that file. (for example dpkg -S ha_wan.conf in debian-like systems)
(unlikely) You're running some interesting system which uses a temporary filesystem in /etc. If you're using a standard desktop distribution, that's improbable. But if it's some kind of router / special device, then it could happen.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
Is there any way to store any data in Linux tmp directory. As i know Linux clear its /tmp directory when system is rebooted. But I want to store data permanently.
Like #bereal said, this defeats the purpose of the /tmp directory. Let me quote the Linux Filesystem Hierarchy Standard:
The /tmp directory must be made available for programs that require temporary files.
Programs must not assume that any files or directories in /tmp are preserved between invocations of the program.
You'll find a better place to store permanent data.
Since it's linux you are free to do what you want to do (as root). When /tmp is cleared depends on your system and can be changed; there is no particular magic involved. A good summary seems to be here: https://serverfault.com/questions/377348/when-does-tmp-get-cleared.
Of course if you are root you can set up an entirely different global directory, say "/not-quite-tmp" or such. But I assume that some progs not under your control write to tmp and you want to inspect or in any case persist those files.
While you are trying to do wrong things, it’s still possible.
/tmp directory is cleared accordigly to TMPTIME setting. The default is apparently 0, what means “clear on every startup”.
The value might be changed in /etc/default/rcS (value is to be set in days.)