Как исправить ошибку?
выполняю от скрипта на php команду
exec("cd ".$dirs[$_POST['gitid']]." 2>1.txt && pwd >>1.txt");
пишет sh: line 0: cd: HOME not set
не может перейти в директорию /var/www/d-a-r.ru
$dirs[$_POST['gitid']]
содержит папку /var/www/d-a-r.ru
подскажите что делать?
-
Вопрос заданболее трёх лет назад
-
108 просмотров
если кому то поможет, то скрипт был под апач, переделал на nginx и все заработало. ос centos 7.
Пригласить эксперта
пишет sh: line 0: cd: HOME not set
не может перейти в директорию /var/www/d-a-r.ru
А откуда видно, что должен перейти туда?cd
означает перейти в домашний каталог.
-
Показать ещё
Загружается…
Сбер
•
Санкт-Петербург
от 200 000 ₽
13 июн. 2023, в 15:10
25000 руб./за проект
13 июн. 2023, в 14:58
40000 руб./за проект
13 июн. 2023, в 14:45
3500 руб./за проект
Минуточку внимания
I have some cloudinit scripts to execute when my AWS EC2 Ubuntu instance starts up.
I want to setup GIT config variables, with the code below.
#cloud-config
runcmd:
- [ sh, -c, "git config --global user.name 'myname'"]
When logged into the terminal. I can execute git config —global user.name ‘myname’ with no problem.
However when I attempt to start my instance with the cloudinit code. I get an error message
fatal: $HOME not set
My understanding is this is because the HOME is not set when the instance starts up.
Looking for a solution, to get the git variable to be set on startup or an alternate solution.
asked Nov 4, 2016 at 14:29
1
I ran into the same problem…
git config --system http.sslVerify false
git config --system user.email "email@email.com"
This resolved the error message. I got this solution after reading CodeCommit with EC2 Role Credentials. The reason is stated in the blog…
«But when I ran this as root, I ran into the error fatal: $HOME not set, because git config —global is trying to read/write the current user’s $HOME/.gitconfig file, and root seems to be $HOME-less in this context.
After being thoroughly schooled in git settings management, I can tell you that there is another option — to set the system-wide git preferences with git config —system, which results in modifications to /etc/gitconfig, no errors.
«
P.S. I realize that I’m answering this question almost 3 years later, but I’m hoping that this might help others who face the same issue.
answered Jul 9, 2019 at 17:31
mohifleurmohifleur
2755 silver badges10 bronze badges
3
I just used sudo and it resolved my problem
git config —global user.email «you@example.com»
git config —global user.name «Your Name»
sudo git config --global user.email "you@example.com"
sudo git config --global user.name "Your Name"
answered Sep 17, 2021 at 22:14
Is there an existing issue for this?
- I have searched the existing issues
Does this issue exist in the latest version?
- I’m using the latest release
Describe the bug?
Run bash $GITHUB_ACTION_PATH/get-changed-paths.sh
bash $GITHUB_ACTION_PATH/get-changed-paths.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
GITHUB_WORKSPACE: /actions-runner/_work/REDACTED-REDACTED/REDACTED-REDACTED
GITHUB_BASE_REF: main
INPUT_FILES_PATTERN_FILE: /tmp/0658cf4a-97a5-4014-9815-d0efe86936c9.txt
INPUT_SEPARATOR:
INPUT_PATH: .
INPUT_PREVIOUS_SHA: dc96ac7ba9ca0443172c39b0d5bd545771927b52
INPUT_CURRENT_SHA: db2490a6da9b81898355bce5389548cbd9e1492d
INPUT_TARGET_BRANCH: main
INPUT_CURRENT_BRANCH: feat/live-streaming-documentation
INPUT_QUOTEPATH: true
INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES: false
INPUT_OLD_NEW_SEPARATOR: ,
INPUT_OLD_NEW_FILES_SEPARATOR:
INPUT_DIFF_RELATIVE:
INPUT_DIR_NAMES: false
INPUT_JSON: false
INPUT_HAS_CUSTOM_PATTERNS: false
fatal: $HOME not set
Error: Process completed with exit code 128.
To Reproduce
- I’m running on an enterprise GH instance 3.5
- I have a simple action copied from your example.
- name: Get changed files id: changed-files uses: tj-actions/changed-files@v33
- When I try to trigger your action from a
pull_request: types: [opened, reopened]
What OS are you seeing the problem on?
ubuntu-latest or ubuntu-20.04
Expected behavior?
Should have counted the files changed on my branch
Relevant log output
Run bash $GITHUB_ACTION_PATH/get-changed-paths.sh bash $GITHUB_ACTION_PATH/get-changed-paths.sh shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} env: GITHUB_WORKSPACE: /actions-runner/_work/REDACTED-REDACTED/REDACTED-REDACTED GITHUB_BASE_REF: main INPUT_FILES_PATTERN_FILE: /tmp/0658cf4a-97a5-4014-9815-d0efe86936c9.txt INPUT_SEPARATOR: INPUT_PATH: . INPUT_PREVIOUS_SHA: dc96ac7ba9ca0443172c39b0d5bd545771927b52 INPUT_CURRENT_SHA: db2490a6da9b81898355bce5389548cbd9e1492d INPUT_TARGET_BRANCH: main INPUT_CURRENT_BRANCH: feat/live-streaming-documentation INPUT_QUOTEPATH: true INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES: false INPUT_OLD_NEW_SEPARATOR: , INPUT_OLD_NEW_FILES_SEPARATOR: INPUT_DIFF_RELATIVE: INPUT_DIR_NAMES: false INPUT_JSON: false INPUT_HAS_CUSTOM_PATTERNS: false fatal: $HOME not set Error: Process completed with exit code 128.
### Anything else?
_No response_
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
When you log in via a normal method (on the console, over SSH, etc.), the program handling the login sets a few environment variables, including HOME
. If you get access to a shell not via logging in, but by exploiting a vulnerability in a program, you get that program’s environment, which often but not always includes HOME
.
In bash, for some reason, the cd
command with no argument uses the value of HOME
as the target. Tilde expansion, however, falls back to the home directory from the user database (e.g. /etc/passwd
) if HOME
is not set. So if HOME
is not set, cd
complains, but cd ~
changes to the user’s home directory. cd $HOME
runs cd
with no argument when HOME
is not set.
When you’re exploiting a vulnerability, you can’t count on the environment being a familiar one. It’s part of the craft of making an exploit — the easy part — to go from being able to execute code (e.g. having a shell) to setting up a convenient environment to run standard code.
Loading