Mac terminal no acces to files - macos

The terminal of my mac cant acces files in the documents folder. I get the following error:
zsh: permission denied
In system preferences I have given the terminal full disk acces. And when I go to the documents folder -> get info -> my username has read and write rights.
I have also ran chmod 777 on the folder but nothing seems to work. Does someone know what causes this problem?
Edit: it turns out that I cant acces a single file with te terminal. It looks like my terminal doesn't have the rights it should.

I fixed the issue! Nothing seemed to work so I wanted to reset the terminal. To do that I had te remove the following file:
~/Library/Preferences/com.apple.Terminal.plist
Then I restarted the terminal and now I can acces my files again!

Related

zsh: permission denied: webstorm - On Attempting to Create Shell Script That Launches WebStorm

I am following the documentation on creating a Shell script that launches the WebStorm application for a given file folder as described on WebStorm Help page. I am currently using an M1 Pro Macbook (2022) that I just got today and has little else installed beyond Homebrew, VSCode, WebStorm, and PyCharm.
Following the example in the docs, I created a file called webstorm (without any extension) in usr/local/bin and added the following code to it:
#!/bin/sh
open -na "WebStorm.app" --args "$#"
After starting up a new terminal, and running webstorm ., I get the following error in my terminal:
zsh: permission denied: webstorm
I have:
Changed sh to zsh as my default shell is zsh, and that made no difference.
Checked my permissions for both usr/local/bin and usr/local/bin/webstorm to ensure that I have the correct permissions to execute files from here. When right clicking on the webstorm file and clicking "Get Info", I can see that I currently have read and write permissions.
Restarted my computer
To add to my confusion, I have used the same script in the same location on my work Macbook, and it has worked without issues.
Any help on this would be hugely appreciated.
Checked my permissions for both usr/local/bin and usr/local/bin/webstorm to ensure that I have the correct permissions to execute files from here. When right clicking on the webstorm file and clicking "Get Info", I can see that I currently have read and write permissions.
Do you have the "execute" permission?
Try:
$ chmod +x /usr/local/bin/webstorm

cd: permission denied: Downloads on Mac OS terminal

I was trying to connect to an EC2 instance on AWS using chmod and ssh and some how lost permission to cd into my Downloads
Apparently must have messed something up while attempting to do it since it is my first time.
I forgot to cd into the location of my Key and instead and tried a bunch of things that did not work including
chmod 400 /Users/chistopherholder/Downloads
and
chmod 400 /Users/chistopherholder/Downloads/Key-name.pem
when I realized I needed to cd into the location (by looking air a different tutorial on YouTube) I tried and con the permission denied.
How do I revert what I have done? So that I can cd into Downloads like before.
There is a way to reset the permissions on a Mac terminal with by running
diskutil resetUserPermissions / `id -u`
This worked for me and allowed me to cd back into the Download file
What worked for me is resetting the permissions for "Files and Folders" of the Terminal app:
System Preferences -> Security & Privacy -> Privacy tab -> Files and Folders -> find the Terminal.app and check all the boxes next to:
Downloads folder
Documents folder
Desktop folder

Change file permission of com.apple.screensharing.plist file on mac

I'm trying to change the file permission of a file.
I have tried chmod 777 on the file and nothing seems to work.
I even tried manually navigating to it and unocking and changing the permissions via the answers here (chmod unable to change permissions), I am at a loss for how to change the file permission so I can edit this file to allow screen sharing on a different port...
For anyone else that has a mac I'm trying to follow the instructions here, https://superuser.com/questions/148095/how-to-change-the-default-screen-sharing-vnc-port-number-on-mac-os-x
sudo vim /System/Library/LaunchDaemons/com.apple.screensharing.plist
This is the path to the file, but I can't edit it no matter what I do. Even as super user!
I found the answer to this, there is a protection on the system file csrutil, you need to disable this by booting up into recovery mode and open the terminal program and run the command csrutil disable.
Make sure to reenable after making the change in recovery mode again!

Unable to save file without password prompt - Sublime Text 3

I'm having an issue all of sudden where I am being prompted on save for the password whilst in Sublime Text 3. I am working locally with Mamp Pro. The prompt message I get on save is:
Sublime Text.app wants to make changes. Type your password to allow this.
If I don't enter the password I get this:
Unable to save ~/Sites/mywebsite/templates/fl_sidebar/index.php
Error: administrator_copy_file(/tmp/.sublba2.tmp,
/Users/myusername/Sites/mywebsite/templates/fl_sidebar/index.php)
failed: AuthorizationExecuteWithPrivileges failed: ffff159a
I've never encountered this error before at all when using Sublime Text so I don't know how to fix it. I had a look at this (How to give Sublime Text 3 write permission to files in web server's DocumentRoot?) and tried the non-command line options, but it did not alter anything.
I stopped running MAMP, checked all permissions on the folder by Get Info, which stated I have read & write privilege. I restarted the Mac and opened up my local development again in sublime, made a change and was instantly asked for the password again.
I'm on OSX El Capitan Version 10.11.2
It appears you do not have write permission to that folder for your user. You can change the ownership of the folder with the following command: -
sudo chown -R INSERT_YOUR_USERNAME_HERE ~/Sites
This will recursively change the ownership of all the files in the ~/Sites folder to your user. Once you have ownership sublime should work correctly again.
In my case I didn't have ownership to the htdocs directory so I did sudo chown -R INSERT_USERNAME /Applications/XAMPP/htdocs

Atom editor "permission denied" | OSX 10.9.4 Mavericks

Just switched to OSX from windows, so sorry if this is a simple fix.
Every time I create a new file within Atom I get this error.
EACCES, permission denied '{File Path}.'
I have already changed the permissions of the actual app in the applications folder but does not seem to have worked.
I also noticed when I save files Atom Helper will prompt me for a password at random.
Obviously something is wonky.
Thanks in advance for any help!
Nvm, figured it out.
Turns out the particular folder was generated by Jekyll using "sudo" inside my shell script.
If I generate a new project sans sudo it works fine.
Independent of what has caused the folder content to be not writable, a simple workaround is to open your file in Atom from terminal (like how described here) but prepend sudo to open Atom as super user, e.g.
sudo atom myfile.txt

Resources