"Operation not permitted" for root under Mojave - root

Very frustrating: I cannot mv, rm etc as a root on MAC OS 10.14.
There seems to be a solution here: https://apple.stackexchange.com/questions/332673/what-and-how-does-macos-mojave-implement-to-restrict-applications-access-to-pers#new-answer?s=48cff4034161476583b318b961feb7d1
but it does nothing in my case:
I just added Terminal to the list of apps that have full access to "Full Disk Access" (I don't see "Application Data" field in Settings), –– still I simply cannot remove a file under /usr/bin , it says " Operation not permitted":
root#VKMBP4:/usr/bin$ whoami
root
root#VKMBP4:/usr/bin$ pwd
/usr/bin
root#VKMBP4:/usr/bin$ mv python was-python
mv: rename python to was-python: Operation not permitted
root#VKMBP4:/usr/bin$ rm python
override rwxr-xr-x root/wheel restricted,compressed for python? y
rm: python: Operation not permitted
Any suggestions how to fix it (beside uninstalling Mojave)?
Thanks!
Here is a Screenshot: Settings / Security & Privacy

I've noticed that you can be logged-in as root, and the Mac OS X CLI will still require you to type sudo for privileged operations. By the way, you should probably be using sudo from a regular admin user, rather than root.

Related

Cannot secure MariaDB installation on macOS Big Sur (Apple M1)

I got a problem when I try to secure my MariaDB installation with Homebrew (macOS Big Sur 11.4 and MacBook Pro M1 chip environment).
I installed MariaDB through Homebrew with that command and got no errors:
brew install mariadb
Then when trying to do the recommended secure process:
sudo /opt/homebrew/bin/mysql_secure_installation
I got the error :
touch: .my.cnf.25188: Read-only file system
touch: .mysql.25188: Read-only file system
chmod: .my.cnf.25188: No such file or directory
chmod: .mysql.25188: No such file or directory
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
/opt/homebrew/bin/mysql_secure_installation: line 249: .my.cnf.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 250: .my.cnf.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 251: .my.cnf.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 253: .my.cnf.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 218: .mysql.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 220: .mysql.25188: No such file or directory
I searched a lot through the web but cannot find any solution.
Somebody had encounter and find a solution for that ?
Why did you guys keeping trying sudo with brew. Homebrew doesn't support root privilege. Don't prepend sudo before brew.
Fix ownership of homebrew related files
# For x86 Mac
sudo chown -R $(whoami):admin /usr/local/*
# For M1 Mac
sudo chown -R $(whoami):admin /opt/homebrew/*
Run /opt/homebrew/opt/mariadb/bin/mysql_secure_installation
Sorry, I don't wanna explain again why brew doesn't support sudo here. Check this answer for anyone who is interested.

zsh permission denied when accessing my home directory

/Users/myname
zsh: permission denied: /Users/myname
I already gave the terminal full disc access and restarted my mac but it won't let me access this directory.
You need to enable auto_cd. Add this to your ~/.zshrc:
setopt auto_cd
If you execute the command /Users/myname, it doesn't make sense, it's like asking a folder to execute.
You probably want to change directory, so cd /Users/myname
Use following command and enter password when promoted (Administrator mode)
sudo su
After this you can run script which is showing permission denied messages while accessing any directory or file

How do I enable python35 from Software Collections at login?

I followed the Software Collections Quick Start and I now have Python 3.5 installed. How can I make it always enabled in my ~/.bashrc, so that I do not have to enable it manually with scl enable rh-python35 bash?
Use the scl_source feature.
Create a new file in /etc/profile.d/ to enable your collection automatically on start up:
$ cat /etc/profile.d/enablepython35.sh
#!/bin/bash
source scl_source enable python35
See How can I make a Red Hat Software Collection persist after a reboot/logout? for background and details.
This answer would be helpful to those who have limited auth access on the server.
I had a similar problem for python3.5 in HostGator's shared hosting. Python3.5 had to be enabled every single damn time after login. Here are my 10 steps for the resolution:
Enable the python through scl script python_enable_3.5 or scl enable rh-python35 bash.
Verify that it's enabled by executing python3.5 --version. This should give you your python version.
Execute which python3.5 to get its path. In my case, it was /opt/rh/rh-python35/root/usr/bin/python3.5. You can use this path to get the version again (just to verify that this path is working for you.)
Awesome, now please exit out of the current shell of scl.
Now, lets get the version again through this complete python3.5 path /opt/rh/rh-python35/root/usr/bin/python3.5 --version.
It won't give you the version but an error. In my case, it was
/opt/rh/rh-python35/root/usr/bin/python3.5: error while loading shared libraries: libpython3.5m.so.rh-python35-1.0: cannot open shared object file: No such file or directory
As mentioned in Tamas' answer, we gotta find that so file. locate doesn't work in shared hosting and you can't install that too.
Use the following command to find where that file is located:
find /opt/rh/rh-python35 -name "libpython3.5m.so.rh-python35-1.0"
Above command would print the complete path (second line) of the file once located. In my case, output was
find: `/opt/rh/rh-python35/root/root': Permission denied
/opt/rh/rh-python35/root/usr/lib64/libpython3.5m.so.rh-python35-1.0
Here is the complete command for the python3.5 to work in such shared hosting which would give the version,
LD_LIBRARY_PATH=/opt/rh/rh-python35/root/usr/lib64 /opt/rh/rh-python35/root/usr/bin/python3.5 --version
Finally, for shorthand, append the following alias in your ~/.bashrc
alias python351='LD_LIBRARY_PATH=/opt/rh/rh-python35/root/usr/lib64 /opt/rh/rh-python35/root/usr/bin/python3.5'
For verification, reload the .bashrc by source ~/.bashrc and execute python351 --version.
Well, there you go, now whenever you login again, you have got python351 to welcome you.
This is not just limited to python3.5, but can be helpful in case of other scl installed softwares.

Cannot implement git version control on R-Studio (Version Control System: NONE)

I'm trying to put a project under version control in R-Studio. I have installed git and everything is working from the git bash command-line. However, when I go to Tools >> Version Control in R-Studio, it says "None" under "Version Control System."
I have attached a screenshot here: http://i.imgur.com/Arc12GG.png
Does anybody know how to fix this?
Even after setting the path to the git executable on my Mac at "Macintosh HD/usr/bin", RStudio still showed "None" for the version control option. In Terminal, I entered "config git" and was greeted by the message that I had to agree to the new Xcode/iOS license. I was able to do that in Terminal by typing "sudo xcodebuild", entering my admin password, then scrolling to the end of the agreement text and entering "agree". Then git showed up as an option for version control. I mention this in case others are stymied even after setting the path to the git executable.
For Windows 10 users, even if you had git lovingly installed at:
C:/Program Files (x86)/Git/bin/git.exe
At some stage the update install moves it into your AppData directory. Thanks Redmond. (I think around Git 2.6.4)
TO FIX:
Make sure like #arvi1000 says above "Did you specify the path to the git executable in Global Options (not project options)? " - set path first in Global options in Rstudio under Tools
Change path under Git/SVN the Git Executable path from Program files to new location of git.exe now in Appdata. e.g. for my userprofile Info:
C:\Users[Your user profile "Info"]\AppData\Local\Programs\Git\bin
Now look in RStudio Project Options under Git/SVN to set Version Control System.
MORE HELP
See these answers in this thread for more and if you cannot find git.exe this is a helpful search tip.

Twig cache permissions

I just worked with Windows 7 before and now I'm working with MAC OS. I cloned my project (it works with Twig and wordpress and I'm using a virtual machine via vagrant) and everything should work but when I enter the website it gives me the following message:
Uncaught exception 'RuntimeException' with message
'Unable to create the cache directory (/vagrant/myProject/cache/c2/94).'
in /vagrant/myProject/wp-content/.../libraries/Twig/Environment.php:1199
I guess it is some kind of problem about permissions but I don't know how to fix it exactly. Any help? Thank you.
As soon as you created a /vagrant directory, I think default permissions are root.
You can try:
sudo mkdir /vagrant/myProject/cache
sudo chown -R $USER:staff /vagrant
And then try again (assuming your current user runs the apache server).
If this does not work, please do:
ls -l /vagrant
and:
ls -l /vagrant/myProject/cache/
And try to set permissions so the cache permissions are the same.

Resources