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
Related
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!
My mac version is 10.12.2.
I'm trying to install R studio and a number of other softwares, but it doesn't work. I suspect it's because of permission issues - my mac doesn't allow them to create directories during installing.
~$ pwd
/Users/biona001
~$ mkdir fdsa
mkdir: fdsa: Operation not permitted
but if I'm in a higher director, it says something different
~$ cd ../
Users$ pwd
/Users
Users$ mkdir fdsa
mkdir: fdsa: Permission denied
and if I move into a lower directory, it works
Users$ cd biona001/Documents/
Documents$ mkdir fdsa
Documents$
I googled almost everything without finding anything that worked, including the one where I boot my mac into this weird mode and type some command. I should be the administrator of this mac.
R Studio is installed by dragging the application to your applications folder. It requires R to be installed. R can be installed from a package, so you don't need the command line.
The 'administrator' on the mac, does not have permission to write files or create folders anywhere. It's not a good idea in any case.
If it's absolutely necessary, you must enable 'root' and login as root. But this is not necessary to use R Studio and R.
Enabling root access without knowing exactly what you are doing is a recipe for disaster.
I had the same "operation not permitted" issue on MacOS Sierra.
Looking at the user's home folder in Finder as John Elemans recommended, showed that the home folder was locked. Unchecked the locked checkbox in finder and was able to create a subfolder in the user's home folder via terminal.
I'm new to using OSX (using El Capitan 10.11.3) and while trying to change permissions on a file using sudo, I accidentally corrupted it. Now whenever, I try to use sudo to install anything globally, I'm getting the following error message.
sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
Is there any way to solve it?
I'm also unable to even view the /etc folder
bash: cd: /etc: Permission denied
When I checked permissions on /etc folder, they are as follows
lrwxr-xr-x# 1 root wheel etc -> private/etc
I had the same issue and in my case the permissions of the root folder got corrupted. What people overlook is that / is in fact also a real, normal directory and just like every directory it has ownership and permissions. Ownership should be root:wheel and permission should be 755 (that's rwxr-xr-x).
The easiest way to restore both was starting Script Editor and then typing and running that script:
do shell script "/usr/sbin/chown root:wheel /" with administrator privileges
do shell script "/bin/chmod 755 /" with administrator privileges
You are prompted for amdin password and then chown and chmod come to the rescue. After that sudo was working again.
Disable System Integrity Protection (rootless)
Reboot the Mac and hold down Command + R keys simultaneously after you hear the startup chime, this will boot OS X into Recovery Mode
When the “OS X Utilities” screen appears, pull down the ‘Utilities’ menu at the top of the screen instead, and choose “Terminal”
Type the following command into the terminal then hit return:
csrutil disable; reboot
You’ll see a message saying that System Integrity Protection has been disabled and the Mac needs to restart for changes to take effect, and the Mac will then reboot itself automatically, just let it boot up as normal
I have installed Cloud Foundry CLI package on my Mac OS X Yosemite. From the terminal interface when I type cf command, I get the following error
FAILED
Error read/writing config: open /Users/viyer/.cf/config.json: permission denied
How do I fix this? I can't find the file config.json.
I found that removing the .cf directory then running the cf cli fixed it
sudo rm -r ~/.cf
cf -h
That was a bit weird, but I solved it by assigning 777 permission to the folder and config.json.
So, sudo chmod 777 .cf/config.json resolved the problem in my case.
Give it a try!
Cheers!
By default, the cf CLI will try to create and write to a directory named .cf in the user's home directory (i.e. ~/.cf). For some reason the user on your machine doesn't have permissions to create and/or write to that directory.
You can work around this problem by setting the CF_HOME environment variable to another directory that the user does have permissions in.
Unfortunately, no amount of changing permissions on my El Capitan would enable cf to access the config.json file in the .cf folder. I created a new folder in my home space ("CLI") and ensured it had the right permissions and set CF_HOME to point to "~/CLI/" . Just creating the new CF_HOME folder and setting CF_HOME in my .bash.profile was insufficient. I then copied the contents of the .cf folder into my new CLI folder. Finally! cf is working!
Oh, this is interesting. CF on this version of OSX will only run from the home directory, it won't run (it won't find config.json) from anything other than root.
Try this command: sudo chmod -R 777 /Users/{username}/.cf
It worked for me on OS X El Capitan.
The config.json need to have read and write permissions, in my case the .cf folder has root as owner and staff as group, my user on my Mac Yosemite is part of the group staff, but still the config.json file has permission set to 600
to fix this problem you should do:
sudo chmod 666 /User/YourUser/.cf/config.json
Also check the permissions of the .cf folder and check if you can read and write. Do something like this: sudo chmod 755 /User/YourUser/.cf
Delete all the .cf folders from your system and try again. This is something which #broomyocymru has already mentioned above. But still felt this might help users who might not be familiar with shell commands
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