Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: Newly created zshenv doesn't have correct permissions #254

Closed
Netruk44 opened this issue Feb 16, 2023 · 2 comments
Closed

MacOS: Newly created zshenv doesn't have correct permissions #254

Netruk44 opened this issue Feb 16, 2023 · 2 comments
Labels
bug Something isn't working Has workaround The issue has a workaround.

Comments

@Netruk44
Copy link

I'm running through the zero to nix guide and had an issue during install step. After installation, no newly created Terminal windows knew what the nix command was (zsh: command not found: nix)

I tracked the issue down to the fact that the custom nix installer created a new zsh config file at /etc/zshenv (or /private/etc/zshenv) that zsh is supposed to read. But the file was created with just r/w permissions for the root user:

-rw-------  1 root  wheel  172 Feb 16 11:28 /private/etc/zshenv

If I sudo chmod go+r /etc/zshenv it fixes the issue, and I can run nix in a new Terminal window.

@Hoverbear
Copy link
Contributor

Thanks for this report!

It does look like we're not setting it right, here's the zsh files:

CreateOrInsertIntoFile::plan(
profile_target_path,
None,
None,
None,
shell_buf.to_string(),
create_or_insert_into_file::Position::Beginning,
)

compared to the fish ones

create_or_insert_files.push(
CreateOrInsertIntoFile::plan(
profile_target,
None,
None,
0o0755,
fish_buf.to_string(),
create_or_insert_into_file::Position::Beginning,
)
.await?,

I'm working on a fix.

@Hoverbear Hoverbear added bug Something isn't working Has workaround The issue has a workaround. labels Feb 17, 2023
@DimitryAndric
Copy link

It's similar for the file /etc/bash.bashrc:

% ls -ltr /etc/ | tail -6
-rw-r-xr-x   1 root  wheel       4 Feb 19 19:34:14 2023 synthetic.conf*
-rw-r--r--   1 root  wheel     135 Feb 19 19:34:16 2023 fstab
-rw-------   1 root  wheel     172 Feb 19 19:34:36 2023 zshenv
-rw-------   1 root  wheel     172 Feb 19 19:34:36 2023 bash.bashrc
-r--r--r--   1 root  wheel     437 Feb 19 19:34:36 2023 bashrc
drwxr-xr-x   3 root  wheel      96 Feb 19 19:34:36 2023 nix/

This is just after nix-install completed. You can see that it created zshenv, bash.bashrc, and updated the 'main' bashrc. The former two are mode 600, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Has workaround The issue has a workaround.
Projects
None yet
Development

No branches or pull requests

3 participants