Unable to save file without password prompt - Sublime Text 3 - macos

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

Related

Mac terminal no acces to files

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!

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

Lost permission for sudo in OSX El Capitan

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

Enthought canopy won't install

I'm having some trouble installing Canopy on my Mac OS X (running 10.9.5) under my primary username. I get to the point where it asks for the location for the Canopy Environment Directory, but when I hit Continue, it crashes. I have been able to install it on the same computer, using my secondary username, but switching between the two usernames is less than ideal. Would love any suggestions. I already tried removing admin status from the secondary username to see if that changed anything, but it did not.
Thanks to anyone who has suggestions!
Any chance that this is relevant? https://support.enthought.com/entries/23707691-Canopy-GUI-requires-extra-setup-steps-when-user-s-home-path-contains-non-ASCII-characters
I actually had the same problem on my Mac. For me, I resolved it by changing the ownership of my home directory:
Open Terminal
Type in the following commands (hit enter after every line):
cd ~
cd ..
sudo chown <your_username> <your_directory>
replace <your_username> with your username, and <your_directory> with the directory in which all your personal files are stored
The last command may ask for a password. If it does, enter your password and hit Enter.

sudo access to specific folder

On mac mavericks, i want to install few files without prompting user for sudo password. (Folder where i am trying to install require root access because it is present at / location). I can do this by modifying "sudoer" file and disable sudo password but this is unsafe and open up security risk. Is there any way i can provide sudo access only a particular folder? So when i try to write to this folder, sudo password prompt is not visible to user.
(All above task are done through command line)
Thanks for your help.

Resources