copy OSX file with permissions - macos

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?

Related

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

What folder on Mac is writeable without admin access but readable by all users?

I'm looking for a place to save my app's license file. I want it in a location that's accessible by all users so if one user on the machine activates the app, the app is also activated for every other user. However, I don't want to require elevation to write to this location.
On Windows, I use C:\Users\Public. Is there an equivalent on OS X?
Thanks!
You can make any directory you own publicly accessible by allowing it with chmod. For instance:
mkdir ~/Public
chmod 755 ~/Public
will create and make world-readable the directory /Users/YourName/Public

error when i want to save java file in jdk/bin

when i save java file error is you dont have permission to save in this location contact the administrator to obtain permission on window7
Don't store application data in the "Program Files" directory.
It is very bad design and regular users don't have write access to that directory (for a very good reason).
So even if you changed your settings locally to open up the door for viruses your application won't run on other computers.
Besides: storing a Java file in the JDK directory serves no purpose at all.
Btw: your uppercase letters are broken, as well as the dot or the comma...
That's normal - jdk/bin is the installation directory of the JDK, regular users cannot (and should not) write files there. You'll have the same problem on Linux/Unix and on Mac OS X, where installation directories are off-limits to regular users.
Write your files to the users home directory (System property "user.home", works across platforms), or let the user choose where you save stuff.
Bin directory do not allow directly to save program in it.
it is so simple, just save your .java file on desktop and then copy paste it in Bin. done ;)
If the file can't save directly to c:\program files\java\jdk1.8.0\bin\
Solution:-
Click start Menu type Notepad command in run run as administrator
Right click the Notepad run as Administrator, then type the program file can save directly to c:\program files\java\jdk1.8.0\bin\
Just try it......

Remove execute permission on file downloaded on a Mac

We have a web app running on a Windows server, which allows a user to do some processing and download the results. The result is a set of files which are dynamically created on the server and zipped into a single file for facilitating the download process.
Everything works fine on Windows, but when users download the file from the web app on a Mac, the contents of the zip file have the execute (chmod +x) permission set (I presume that the same happens on *NIX and Linux machines). This can, of course, be removed by running the 'chmod -x' command, but is there a way by which one can remove the execute permission on the files, so that when downloaded on a Mac, the files don't have the execute permission set by default?
I believe it's not possible - .zip files don't contain permissions, so on a Mac it has to default to "most permissive" (otherwise it's possible that there are applications inside the zip that wouldn't be marked as executable when they need to be).
tars, for instance, do record permissions, but that'd be a bit more difficult to create on a Windows server.

Adding a share point to a directory on Mac Server

I want to be able to access my SVN repositories in /usr/local/repos as a share point ... When im in the mac File Sharing panel i cant see the /usr directory in the browse screen ... can i create a directory next to Applications etc etc called Repositories and link it to /usr/local/repos so that i can add it as a share point?
Can someone show me how i can do that?
Cheers,
Best way would be to add /usr/local/repos to your smb.conf file manually.
Open up terminal, and type sudo pico /private/etc/smb.conf
Type in your password.
Inside the config file that opens, add a new section for the share you wish to add.
Example:
[Repositories]
comment = Repositories
path = /usr/local/repos
guest ok = yes
create mode = 0700
writeable = yes
browseable = yes
Save and exit the file with Control+O then Control+X.
Restart Windows File Sharing in System Preferences by turning it off and on.
Are you using OS X Server, or just the file sharing capability built into the standard version of OS X?
If it's standard OS X and you're configuring share points in System Preferences -> Sharing -> File Sharing -> Shared Folders, selecting invisible folders is actually quite easy: click the + button to add a new folder, and then press Command+Shift+. and it'll show invisible files in the select dialog.
If you're using OS X Server, it's actually somewhat harder. I don't know of any way to get Server Admin to show invisible items in its File Sharing section, but you can make the /usr folder visible with the command sudo chflags nohidden /usr, then configure sharing, then rehide it with sudo chflags hidden /usr.

Resources