Fix file permissions on a Mac - macos

I'm having a weird behaviour on my mac. I got some files from another computer, and for some reason the system can't identify the user related to some permissions. Here is a pic of what I get on the finder permission manager —is in Spanish, but I'm pretty sure that in English would be very similar—
Basically, what it says, is:
obtaining… writing and reading
admin writing and reading
munchausen (Me) writing and reading
wheel writing and reading
everyone writing and reading
So is like it can't find the name of a user, which makes sense, because this files had permissions for an user that doesn't exist in this computer.
How can I clean this permissions? From the folder, I tried with:
sudo chmod -R 754 .
It gave proper permissions, but didn't solved the problem of the obtaining… thing.
Any idea?

Related

Unable to modify permissions of folders on Mac (Mojave)

I am new to Macs and I am trying to run some interesting stats on my iMessages using the code runner extension on VSCode. I've been following this post: https://towardsdatascience.com/heres-how-you-can-access-your-entire-imessage-history-on-your-mac-f8878276c6e9
However, when I run the line conn = sqlite3.connect('/Users/<username>/Library/Messages/chat.db')
I get the error sqlite3.OperationalError: unable to open database file
Based off what I can tell my issue is that VScode doesn't have the right permissions to access the ~/Library/Messages folder and possibly the chat.db as well. First, I ran ls -l on Library and the result is drwx---rwx for Messages. So I tried to use both chmod a+rwx Messages and sudo chmod a+rwx Messages to open permissions to everything but got the error chmod: Unable to change file mode on Messages: Operation not permitted both times.
Am I doing something wrong and/or is there a better way to do this? Or is it just not possible to change the permissions of this folder?
After some more creative searching I discovered that it was an Issue with Mojave's System Integrity Protection (SIP) and can be solved by giving the desired apps full disk access in Settings>Security&Privacy>Privacy>FullDiskAccess.
Solution found here

Permission denied when starting .bashrc on ubuntu on windows

I wanted to add a path to my .bashrc file on Ubuntu on Windows.
Since then, I get always:
/home/gian1312/.bashrc: Permission denied
I deleted all my changes. It did not help.
Then I opened the .profile file to add the path there. --> Now I get:
/home/gian1312/.profile permission denied
I deleted all my changes. All edits were made by Notepad++ in Windows.
I am looking for a solution for several days. Probably a reinstallation would help but as long as I do not know the reason I do not want to risk to face the same problem.
Best Regards and thanks a lot
Gian
The error simply says that permission denied. Since the question is not completely clear, the following things can be tried:
1) Check the permission of the file ".bashrc" and ".profile" and make sure it is 0644
2) Check the upper level directory permission (here the folder /home/gian1312) and make sure it is 0755.
3) If the first two are fine, then you need to check the permission of the "path" which you are trying to add and it should have enough permissions to be readable by the user "gian1312"
Editing the answer as per the below comment:
To change the permissions, please run the below commands:
chmod 0755 /home/gian1312
chmod 0644 /home/gian1312/.bashrc
chmod 0644 /home/gian1312/.profile

Wireshark - you don't have permission to capture on that device mac

I installed Wireshark and during the installation it showed an error but the installation itself completed. When I ran the program and tried to capture packets on my network, it showed this error:
I'm new to mac so i don't even know how to properly ask.
Could someone help me?
According to User: gmale's answer on ask.wireshark.org, he solved his problem in this way and I'm sure that it could solve yours as well. It says:
1- Open Terminal
To see your exact user name (for me that was AliGht)
2- Type 'whoami'
3- execute the following commands:
cd /dev
sudo chown AliGht:admin bp*
and enter your computer password:
4- now type this command:
ls -la | grep bp
The last command will display a list of files such as:
5- Make sure all of them have your user name and admin as the user/group. For some reason, the last one didn't get assigned properly so I had to run the command:
sudo chown AliGht:admin bpf4
so the last command fixed my problem as you see in the last image:
Done!
If your WireShark is open then close it and open it again.
All credits of this tutorial goes to user gmale on ask.wireshark.org,
If you want to open WireShark always as administrator then take a look to another post which I created a shortcut for it via Applescript, and this is the only way which you can open the WireShark always as administrator even when you turn off/on your mac.
I don't know how to solve this problem, but if you want a temporary fix, you can use the following command:
$ sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
Wireshark provides the solution itself, along with the explanation of weird secrets:
add your user to the group "access_bpf" by commanding
sudo dseditgroup -o edit -a `whoami` -t user access_bpf
then launch Wireshark's script
sudo "/Library/Application Support/Wireshark/ChmodBPF/ChmodBPF";
That's all, because (as the script explains):
# Unfortunately, macOS's devfs is based on the old FreeBSD
# one, not the current one, so there's no way to configure it
# to create BPF devices with particular owners or groups. BPF
# devices on macOS are also non-cloning, that is they can
# be created on demand at any time. This startup item will
# pre-create a number of BPF devices, then make them owned by
# the access_bpf group, with permissions rw-rw----, so that
# anybody in the access_bpf group can use programs that capture
# or send raw packets.
If you want to open WireShark always as administrator I suggest to use AppleScript:
Open AppleScript: By pressing cmd+space and write AppleScript Editor in the Spotlight Search as picture below:
Then from File --> Choose NEW
In the open window write:
do shell script "/Applications/Wireshark.app/Contents/MacOS/Wireshark" ¬
with administrator privileges user name "username" password "password"
Change the "username" and "password" with yours. If you don't know your username in terminal write "whoami" to see your username, password is your computer password!.
Mine is look like this:
Now export your script as Application, by going to --> File --> Export , and change File Format to Application write a name for your file and Save it on your desktop like following pictures:
DONE now run your App from Desktop, and by this way your WireShark runs always by Admin Permission.
I have faced the same problem in MacOS High Sierra (v10.13.6). I have clean-up all dependency files and folders but nothing works for me.
Using the terminal, if I run the following command then it is working -
sudo chmod o+r /dev/bpf*
sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
This should work.
Run the application from the terminal with the following command:
User$ **sudo Wireshark**
Wireshark should open and packet capture should work then.
Was having same issue with install and run permissions etc. Attempted a few of the above mentioned fixes and although they would come back with the desired result program still would not run properly even with uninstall/install in addition.Getting a bit overwhelmed with it not working after several remedies being attempted I came to one that was super simple and worked -
I simply set up/checked log in as root user. Here you can enable/disable root user account, enable log in account and change root password. So I just switched profiles from my Admin account to the Root account. (I am honestly not sure if its safe to do it this way, so thinking many of you have far more knowledge on this than me I'd appreciate your comments on that!) Also my understanding is that you cannot properly run sudo commands if root account is enabled - So probably just tuning it off if it were on would suffice, but I wanted a quick and easy install at that point. The steps are really easy:
support.apple.com/en-us/HT204012
Then just switch user accounts to root -Log in with "other" then type root and your password.
Now just install Wireshark and it should install and run properly!
**I don't think I would stay in root account after install.
Hope maybe this will help some!
I got same issue and then notice below document provide solution already.
https://www.wireshark.org/docs/wsug_html_chunked/ChBuildInstallOSXInstall.html
2.5. Installing Wireshark under macOS
The official macOS packages are distributed as disk images (.dmg) containing the application bundle. To install Wireshark simply open the disk image and drag Wireshark to your /Applications folder.
In order to capture packets, you must install the “ChmodBPF” launch daemon. You can do so by opening the Install ChmodBPF.pkg file in the Wireshark .dmg or from Wireshark iself by opening Wireshark → About Wireshark selecting the “Folders” tab, and double-clicking “macOS Extras”.
The installer package includes Wireshark along with ChmodBPF and system path packages. See the included Read me first.html file for more details.
I do not want to modify my folder permissions on my system device files like the accepted answer, but I was able to get permissions by opening Wireshark like this:
sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark
Bonus, you can add an alias to your ~/.zshrc:
alias ws="sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark"
Now execute the file: (or you can open a new terminal window)
source ~/.zshrc
Open wireshark with super user permissions:
ws

copy OSX file with permissions

I have an OSX FTDIUSBSerialDriver.kext file for an FTDI Chipset Driver where the Info.plist file has been modified for optimum performance.
I would like to supply the modified file to users of our hardware, so that it can be copied to: MacHD/System/Library/Extensions/ and it must have "system" ownership and permissions.
What would be the easiest way to:
Copy the working FTDIUSBSerialDriver.kext file (package) retaining the current ownership and priveleges for distribution ?
Provide the user with "simple" terminal instructions on how to copy and overwrite the file to MacHD/System/Library/Extensions/ with system ownership and permissions ?
Every time I try and test, the permissions and ownership get set to the current user so the driver will not load at startup.
It would be optimal if I could bundle this as a simple installer, so the user could just double click to install.
Thanks
Peter
Edit: Needs to work on 10.6.8 and above. I am aware of a finder option in OS X 10.8 that allows for "duplicate exactly" and "paste exactly", but this is not an option for everyone.
you can use cp -p
-p Cause cp to preserve the following attributes of each source
file in the copy: modification time, access time, file flags, file
mode, user
ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource
forks, will
also be preserved.
We are using a script to alter the FTDIUSBSerialDriver.kext file: See: https://github.com/arminbw/wiretouch/blob/master/perl/modify-ftdi-driver-settings.pl
However, did you by any chance experience problems after upgrading to 10.10? See: Patched FTDIUSBSerialDriver kext has to be unloaded/reloaded after reboot (OSX 10.10). Any ideas?

Proper permissions for my SVN repository directory tree on Mac?

I restored my Mac form a Time Machine backup, and now I can't check files into my svn repo.
I have tried svnadmin recover, but it fails:
svnadmin: Can't open file 'WriteAssist/db/write-lock': Permission denied
The directory is owned by the "admin" user that I set up for bootstrapping the machine. My current user is "andersprivat".
Should I just chown the entire tree? Doing a chmod 777 would presumably work, but seems like a big security hole.
In the end svnadmin recover appeared to do nothing at all for me.
I ended up having to chmod -R 777 all the files to be allowed to check in at all, then manually handling all in-flight issues. Did not leave me loving svn any more than I already did. When it works it's great, but getting it up when it has stumbled is a b*tch.

Resources