- Raspberry Pi 3 Cookbook for Python Programmers
- Tim Cox Dr. Steven Lawrence Fernandes
- 189字
- 2021-08-27 18:25:37
There's more...
We also need to allow the proxy settings to be used by some programs, which use superuser permissions while accessing the network (this will depend on the program; most don't need this). We need to add the commands into a file stored in /etc/sudoers.d/ by performing the following steps:
- Use the following command to open a new sudoer file:
sudo visudo -f /etc/sudoers.d/proxy
- Enter the following text in the file (on a single line):
Defaults env_keep += "http_proxy HTTP_PROXY https_proxy HTTPS_PROXY ftp_proxy FTP_PROXY"
- Once done, save and exit by pressing Ctrl + X, Y, and Enter; don't change the proxy.tmp filename (this is normal for visudo; it will change it to proxy when finished).
- If prompted What now?, there is an error in the command. Press X to exit without saving and retype the command.
- After a reboot (using sudo reboot), you will be able to use the following commands to enable and disable the proxy respectively:
proxyenable proxydisable
It is important to use visudo here, as it ensures the permissions of the file are created correctly for the sudoers directory (read only by the root user).