I have one Mac set up with file sharing on the desktop, and I am trying to connect to it from my other Mac from the Terminal. I made a folder mount in /Volumes/, then I used the following command.
sudo mount -t afp afp://user:pass@ipaddress/Desktop /Volumes/mount
(obviously I changed the user/pass/ip to the correct information)
Though whenever I try to access it, it says I do not have permission. When I access it through Finder with the same username and password, it works perfectly fine.
Is there any reason this is not working?
Edit – If I run the ls
command with sudo
I can access the files. So update to the question:
Is there a way to change the ownership of the Volume? chown
is throwing the error Operation not permitted
, even with sudo
.
Best Answer
To mount a share in Terminal use the following commands:
This works because the folder /Volumes is world read & writable.
If you use
sudo mkdir /Volumes/mount
mount has the following permissions:and the only possible command to mount a share is:
because you are not allowed to "write" (=mount) to the folder mount as non-root user.
with the following result:
and you can't even open (=read) the folder with your user.
If you create the mount folder with
mkdir /Volumes/mount
the permissions looks like this:After mounting the share with:
the permissions look like this: