Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Is there any way to block access to some particular file or folder in MacOS X, so that it can be protected by password, system-wide?
I want to use it in Cocoa based program, but before that I just want to know at least general possible methods of accomplishing it.
As far as I know POSIX file access system doesn't allow to protect something with password.
I was thinking about creating additional user account with dedicated password and then setting this user as an owner of a file with chmod. In terminal it seemed to work, but that is quite bad way, I think, since that is a sort of permission problem. And you need to change user in terminal for that. I don't think that can be done if one wants to access it through regular application like Finder.
So does anybody know better ways?
To create a password protected "folder" you can use an encrypted disk image and mount it at the location you require the folder. The command hdiutil can be used to create, mount, unmount etc. such disk images. Use the the -plist option to easily drive the hdiutil command from Objective-C.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I am trying to save some important files from my faulty internal hard drive on my iMac. I am in the Internet Recovery mode and running the terminal. I also have connected an external 1TB storage and I can view the files inside it using the terminal. However, I cannot seem to write anything on the external drive as I get the message
cp: volumes/seagatedrive/backup.dmg: Read-only file system
I have used the chmod 777 command for my seagatedrive to no avail. The message I get there is:
Unable to change file mode on volumes/seagatedrive: Read-only file
system
How can I make my external hard drive (seagatedrive above) writable?
Would appreciate any help.
UPDATE
OP has stated, that his drive is formatted as NTFS. therefore you'll need to setup thirdparty drivers to support write-access on that drive.
An article about that can be found here:
http://www.howtogeek.com/236055/how-to-write-to-ntfs-drives-on-a-mac/
[...]
Mac OS X can read from NTFS drives, but it can’t write to them unless you use one of the below tricks. We highly recommend paying for a third-party NTFS driver if you need to do this as the other solutions don’t work as well and are more work to set up.[...]
Alternatively you should consider using exFAT as drive Format. Using
exFAT has the advantage of compatibility on almost all Platforms.
Since I can't put my thoughts in a comment (not enough rep. yet) here is what you can check.
osx behaves strangely with external drives which aren't formatted in Mac OS Format.
check volume's partition-type
check mount tab (if exists)
make shure that your drive isn't write-protected.
if this all fails you could also check, if root has the proper rights to do these previous things.
if so, there might be a problem with your account or privileges on that account.
if there won't be anyone being able to help you, you should try and ask your question on https://unix.stackexchange.com/
cheers and good luck
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
The default Shared folder in MacOSX does not seem to live up to its name. Sure, all users on the local Mac can create folders and add files to the Shared folder, however other users cannot open the files or make any changes, unless it is files & folders they created/added.
Using the permissions GUI (ACLs and POSIX), I failed to find a solution to my needs which are essentially to make the Shared folder a place where all local Mac users (or a subset of users) have full permissions.
I am hoping that someone would have a suggestion.
Cheers
You can't do this with the GUI; it doesn't allow you to control (or even see) some of the necessary settings. So you need to use the Terminal, and run some chmod (change "mode", i.e. change permissions), and you need to use sudo to run them with root permissions (note that sudo will prompt for your admin password to allow this, but the password won't echo as you type). Also, be careful with these commands (or anything else involving sudo) -- the specific commands I'll give you should be safe, but if you change the wrong permission on the wrong file, you can completely break the OS.
You need to do two things: remove the "sticky" bit (which prevents users from deleting/moving/renaming other users' files):
sudo chmod -t /Users/Shared
Then add an inheritable ACL granting everyone full read+write access. The Finder's Get Info window will let you add ACLs, but not control inheritance, so again you use sudo chmod ... and include a long list of exactly what types of file access need to be allowed:
sudo chmod +a "group:everyone list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit" /Users/Shared
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
OK i googled a lot but something just doesn't add-up:
in terminal i use this code: sudo mkdir /Volumes/aNewFolder
but then the terminal asks me for my user password. why? and also - how can i pass the password so terminal wont stop and wait for user's input?
this is silly but i cant seem to fix it or to find it on the web; all i want is to mkdir without having to input my password directly...
i didnt really tried anything cause i cant seem to find any info about it.
im pretty sure that the solution is easy and im missing something. im new to unix and bash but mkdiris a very basic thing, right?
help, please?
edit: forgot to say that i thought expect could help but all i see is how to use it with ssh...
mac user
sudo = super user do.. You need to give your terminal session the password for the super user, to have "administrative" access.
Depending where you're trying to make a new directory, you don't always need to add "sudo" to your command.
If say you were trying to make a new directory in your home folder.. i.e.: mkdir ~/myNewDir
you won't need to add a sudo to it, because your home folder is owned by your user.
But let's say you were trying to make a new folder in /etc/ssh/, an area where your user does not have read/write access to, you would need to append the command with sudo, to inform the CLI that a or the, super user is going to perform the task.
Hope it helps.
If you really want to skip the password authentication every time, you could type:
sudo -su root give it root users password, and from that point on forward (and only for that terminal session) will the user root be used (see it as super user), and your commands will run without any authentication (Since root user has read/write access across the system). I wouldn't recommend doing this, if you're not sure about what you're doing.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
In my Mac program, I want to copy the file located in /private/var/db/dslocal/nodes/Default/users/xx.plist to another disc.
Presumably it will failed, and it is.
I use the api of copyItemAtPath:toPath:error: to do this,
and I NSLog out the error infomation:
it says /private/var/db/dslocal/nodes/Default/users/xx.plist this file couldn't be opened because I don't have permission to view it.
The operation couldn't be completed, Permission denied.
And can anyone could introduce me to some documentations or sample codes that I should read to solve my problem? Please!
You're trying to do something that requires the user to be an administrator (or root), which requires elevated access. The way to do go about this in OSX is to factor out the privileged code into a separate executable that is run with elevated permissions, after having prompted the user for an administrator's credentials.
Take a look at OSX Authorization services for prompting the user:
https://developer.apple.com/library/mac/#documentation/Security/Reference/authorization_ref/Reference/reference.html
And SMJobBless for creating the application with elevated rights: -
https://developer.apple.com/library/mac/#samplecode/SMJobBless/Introduction/Intro.html
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have been trying to work out how this is possible to very little avail.
I'm on Mac OS X Lion and need to encrypt CD-R for Windows user.
All I want to do is encrypt a folder containing important website files to CD-R so that I can safely send the files via the post on a CD.
truecrypt is a freely-available, cross-platform solution that should work for you. It can be configured to encrypt directories or special block files, that are only accessible with a password.
Presumably you could put the Windows installation files on the CD-ROM as well, in order to make it easier for the recipient to access the data.
Another approach would be using GPG, to encrypt a .zip or .tar.gz file, or even zip itself using AES encryption.