hacktricks/linux-hardening/linux-environment-variables.md

136 lines
5.6 KiB
Markdown
Raw Normal View History

# Linux Environment Variables
2022-04-28 16:01:33 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
<details>
2022-04-28 16:01:33 +00:00
<summary>Support HackTricks</summary>
2024-02-02 12:19:57 +00:00
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
{% endhint %}
2022-04-28 16:01:33 +00:00
## Global variables
Vigezo vya kimataifa **vitakuwa** vinarithiwa na **mchakato wa watoto**.
Unaweza kuunda kigezo cha kimataifa kwa ajili ya kikao chako cha sasa kwa kufanya:
```bash
export MYGLOBAL="hello world"
echo $MYGLOBAL #Prints: hello world
```
Hii variable itapatikana na vikao vyako vya sasa na michakato yake ya watoto.
2024-02-11 02:13:58 +00:00
Unaweza **kuondoa** variable kwa kufanya:
```bash
unset MYGLOBAL
```
## Local variables
Mabadiliko ya **local** yanaweza tu **kupatikana** na **shell/script** ya **sasa**.
```bash
LOCAL="my local"
echo $LOCAL
unset LOCAL
```
## Orodha ya mabadiliko ya sasa
```bash
set
env
printenv
cat /proc/$$/environ
cat /proc/`python -c "import os; print(os.getppid())"`/environ
```
## Common variables
2024-02-11 02:13:58 +00:00
From: [https://geek-university.com/linux/common-environment-variables/](https://geek-university.com/linux/common-environment-variables/)
2024-02-11 02:13:58 +00:00
* **DISPLAY** onyesho linalotumiwa na **X**. Kigezo hiki kawaida huwekwa kuwa **:0.0**, ambayo inamaanisha onyesho la kwanza kwenye kompyuta ya sasa.
* **EDITOR** mhariri wa maandiko anayependelea mtumiaji.
* **HISTFILESIZE** idadi ya juu ya mistari iliyomo katika faili ya historia.
* **HISTSIZE** Idadi ya mistari iliyoongezwa kwenye faili ya historia wakati mtumiaji anamaliza kikao chake.
* **HOME** saraka yako ya nyumbani.
* **HOSTNAME** jina la mwenyeji wa kompyuta.
* **LANG** lugha yako ya sasa.
* **MAIL** mahali ambapo mchanganyiko wa barua wa mtumiaji upo. Kawaida ni **/var/spool/mail/USER**.
* **MANPATH** orodha ya saraka za kutafuta kurasa za mwongozo.
* **OSTYPE** aina ya mfumo wa uendeshaji.
* **PS1** kiashiria cha chaguo-msingi katika bash.
* **PATH** huhifadhi njia ya saraka zote ambazo zina faili za binary unazotaka kutekeleza kwa kutaja tu jina la faili na si kwa njia ya uhusiano au ya moja kwa moja.
* **PWD** saraka ya kazi ya sasa.
* **SHELL** njia ya shell ya amri ya sasa (kwa mfano, **/bin/bash**).
* **TERM** aina ya terminal ya sasa (kwa mfano, **xterm**).
* **TZ** eneo lako la muda.
* **USER** jina lako la mtumiaji la sasa.
## Interesting variables for hacking
2022-10-05 22:34:56 +00:00
### **HISTFILESIZE**
Badilisha **thamani ya kigezo hiki kuwa 0**, ili wakati unapo **maliza kikao chako** faili ya **historia** (\~/.bash\_history) **itafutwa**.
```bash
export HISTFILESIZE=0
```
2022-10-05 22:34:56 +00:00
### **HISTSIZE**
Badilisha **thamani ya hii variable kuwa 0**, ili wakati unapo **maliza kikao chako** amri yoyote itaongezwa kwenye **faili ya historia** (\~/.bash\_history).
```bash
export HISTSIZE=0
```
2023-01-18 13:30:35 +00:00
### http\_proxy & https\_proxy
Mchakato utatumia **proxy** iliyotangazwa hapa kuungana na mtandao kupitia **http au https**.
```bash
export http_proxy="http://10.10.10.10:8080"
2023-01-18 13:30:35 +00:00
export https_proxy="http://10.10.10.10:8080"
```
### SSL\_CERT\_FILE & SSL\_CERT\_DIR
Mifumo itatumia vyeti vilivyoonyeshwa katika **hizi env variables**.
```bash
2023-01-18 13:30:35 +00:00
export SSL_CERT_FILE=/path/to/ca-bundle.pem
export SSL_CERT_DIR=/path/to/ca-certificates
```
2022-10-05 22:34:56 +00:00
### PS1
Badilisha jinsi inavyoonekana kwa kiashiria chako.
2024-02-11 02:13:58 +00:00
[**Hii ni mfano**](https://gist.github.com/carlospolop/43f7cd50f3deea972439af3222b68808)
Mizizi:
![](<../.gitbook/assets/image (897).png>)
2024-02-11 02:13:58 +00:00
Mtumiaji wa kawaida:
![](<../.gitbook/assets/image (740).png>)
Kazi tatu zilizopangwa nyuma:
![](<../.gitbook/assets/image (145).png>)
Kazi moja iliyopangwa nyuma, moja iliyo simamishwa na amri ya mwisho haikukamilika vizuri:
![](<../.gitbook/assets/image (715).png>)
2022-04-28 16:01:33 +00:00
{% hint style="success" %}
Jifunze & fanya mazoezi ya AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Jifunze & fanya mazoezi ya GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
<details>
2022-04-28 16:01:33 +00:00
<summary>Support HackTricks</summary>
2024-02-02 12:19:57 +00:00
* Angalia [**mpango wa usajili**](https://github.com/sponsors/carlospolop)!
* **Jiunge na** 💬 [**kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **fuata** sisi kwenye **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Shiriki mbinu za hacking kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
{% endhint %}