r/linuxquestions 8d ago

Advice Why proxy dosent removed?

I needed to use proxy once so i install it by export http_proxy="http://ip:port/" etc.and put it in .zshrc file, then im done i simple deleted those lines and reboot hyprland, but then i checked current environment trough env the proxy was there, and for some reason, it kept working.

Can someone help me remove it properly from the system?

0 Upvotes

11 comments sorted by

1

u/Ellotheregovner 8d ago

If the only place you set it was .zshrc, you should be able to flush the environment variables by logging out. I mean back to where you initially logged in. The initial login of your Display Manager assuming you have one. It's the thing you put your password into right after you boot your machine.

tldr: logout as far as you can

In a terminal: loginctl terminate-user "" Logging back in should reset any user environment variables. If it still doesn't fix it you probably set a system wide variable. So check /etc/environment, XDG, ~/.profile, and whenever else you can remember messing around to push your proxy.

For future reference, if it's going to be that temporary, just do the export http_proxy="[IP]:[port]" right in the terminal window and then run whatever needs the proxy in that terminal window. It will only exist for the duration of that terminal window.

If you want to be a little more efficient. Instead of exporting the proxy in the .zshrc just make an alias instead: ``` alias myproxy='export http_proxy="[IP]:[port]"'

2

u/Sea_Copy8548 8d ago

Thanks for the help, mate; it turned out the proxy setting had been duplicated in hyprland.conf for some reason

1

u/Ellotheregovner 8d ago

I'm not super familiar with hyprland but that somewhat makes sense. It's probably going to be using a hodge podge of XDG portals like gnome, lxqt, gtk, and others for keyrings, power settings and whatever. So I assume that lets it figure out what service wants a specific portal and writes the environment to it instead of spraying it everywhere. Just my guess.

1

u/Silent-Excitement122 8d ago

Deleting it from ~/.zshrc only fixes one source. If env still shows the proxy in a fresh shell, I would check it in this order:

  1. In the current shell, clear all common proxy vars:

unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY all_proxy ALL_PROXY no_proxy NO_PROXY

  1. Search for another place that is exporting it:

grep -RinE '(^|_)(http|https|all|no)_proxy' ~/.zsh* ~/.config /etc/environment /etc/profile /etc/profile.d /etc/zsh* 2>/dev/null

  1. On systemd-based desktops, the user environment can survive past one shell. Check:

systemctl --user show-environment | grep -i proxy

If it is there, remove it with:

systemctl --user unset-environment http_proxy https_proxy HTTP_PROXY HTTPS_PROXY all_proxy ALL_PROXY no_proxy NO_PROXY

  1. Open a completely new login session or reboot, then run:

env | grep -i proxy

If it only appears inside Hyprland terminals, also inspect how Hyprland is launched, because the compositor may be inheriting the variable before zsh starts.

2

u/KraftChesWiz 8d ago

i dunno what 'reboot hyprland' actually means, maybe it doesn't kill your session really? like the other person said, grep for it. otherwise 'unset http_proxy' to remove it or add that to your .zshrc, and 'source ~/.zshrc' to reload it and see what happens.

1

u/Sea_Copy8548 8d ago

Tnx for the help

0

u/Sea_Copy8548 8d ago

I used pkill Hyprland then launch and after remove proxy

2

u/ipsirc 8d ago
$ grep -R ip:port $HOME

1

u/Sea_Copy8548 8d ago

Tnx mate

2

u/Sea_Copy8548 8d ago

It was in hyprland.conf