1

I was reading this question but the answer is for root or sudo mode profile.

You can see, using finder, something like:

sh-3.2# ls -al /Volumes/
total 40
drwxr-xr-x@  4 root        wheel    136 Oct 19 02:55 .
drwxr-xr-x  28 root        wheel   1020 Oct 15 23:51 ..
drwx------   1 pepito      staff  16384 Oct 19 02:56 HD710A
lrwxr-xr-x   1 root        wheel      1 Oct 19 02:42 HDD -> /
sh-3.2#

unmounting the Drive...

sh-3.2# ls -al /Volumes/
total 8
drwxr-xr-x@  3 root  wheel   102 Oct 19 03:08 .
drwxr-xr-x  28 root  wheel  1020 Oct 15 23:51 ..
lrwxr-xr-x   1 root  wheel     1 Oct 19 02:42 HDD -> /
sh-3.2# exit
exit

Now from like normal user (non privileged mode).

$ mkdir /Volumes/HD710A
mkdir: /Volumes/HD710A: Permission denied
$

I'm forced to use sudo mode

$ sudo mkdir /Volumes/HD710A
Password:
$ ls -al /Volumes/
total 8
drwxr-xr-x@  4 root  wheel   136 Oct 19 03:16 .
drwxr-xr-x  28 root  wheel  1020 Oct 15 23:51 ..
drwxr-xr-x+  2 root  wheel    68 Oct 19 03:16 HD710A
lrwxr-xr-x   1 root  wheel     1 Oct 19 02:42 HDD -> /
$

Let's go to mount the drive

$ mount -t afp afp://pepito:thepassword@MacBook-Air.local/HD710A /Volumes/HD710A
mount_afp: AFPMountURL returned error 1, errno is 1
$

Again forced to use sudo mode

$ sudo mount -t afp afp://pepito:thepassword@MacBook-Air.local/HD710A /Volumes/HD710A
$ ls -al /Volumes/
total 8
drwxr-xr-x@  4 root  wheel   136 Oct 19 03:16 .
drwxr-xr-x  28 root  wheel  1020 Oct 15 23:51 ..
drwx------   1 root  wheel  1316 Oct 19 02:56 HD710A
lrwxr-xr-x   1 root  wheel     1 Oct 19 02:42 HDD -> /
$ umount /Volumes/HD710A
umount: unmount(/Volumes/HD710A): Operation not permitted
$ sudo umount /Volumes/HD710A
$

The problem when the drive is mounted like root or sudo mode the write/read using copy & paste operation are limited from Finder.

How to mount like staff mode similar to made for/from Finder?

2

There's some basic misunderstandings of how things are working, so let's clear them up.

sudo isn't a "mode" or a "profile", it's a command that allows you to execute a command as another user (See the man page: man sudo)

The command su allows you to switch or substitute a user's identity (man su). So, think of sudo as su- get another identity and then do something.

Without specifying a user, it defaults to root:

sudo foo = sudo -u root foo.

This is not limited to the root user either. User1 can issue a command as User2:

$ sudo -u User2 foo

Now, Finder doesn't mount anything, Finder will call a function that mounts your device (technically, there's a "listener" function - automount - that waits for a device to be inserted to automatically mount it). Finder just "displays" it.

This automounter is running with root level privileges which is required to mount anything in the /Volumes folder which is where automount will put the folder to the newly mounted device. Users aren't allowed to modify this folder which is why you need root privileges; thus sudo

If you want to mount something without using sudo, mount it anywhere you have full ownership, like in your home directory (/Users/username/foo/bar). Since you have full ownership in that directory, you won't need root privileges to mount it.

  • Thank you for your explanation, but I'm focused in the result and with your help I remember the clue (the chown command)!!! – Chepe Questn Oct 19 '17 at 20:16
1
$ sudo mkdir /Volumes/HD710A
Password:
$ ls -al /Volumes/
total 8
drwxr-xr-x@  4 root  wheel   136 Oct 19 18:06 .
drwxr-xr-x  28 root  wheel  1020 Oct 15 23:51 ..
drwxr-xr-x+  2 root  wheel    68 Oct 19 18:06 HD710A
lrwxr-xr-x   1 root  wheel     1 Oct 19 18:03 HDD -> /
$

HERE THE CLUE!!!

$ sudo chown pepito:staff /Volumes/HD710A
$

Now the results and mount!!!

$ ls -al /Volumes/
total 8
drwxr-xr-x@  4 root        wheel   136 Oct 19 18:06 .
drwxr-xr-x  28 root        wheel  1020 Oct 15 23:51 ..
drwxr-xr-x+  2 pepito      staff    68 Oct 19 18:06 HD710A
lrwxr-xr-x   1 root        wheel     1 Oct 19 18:03 HDD -> /
$ mount -t afp afp://pepito:thepassword@MacBook-Air.local/HD710A /Volumes/HD710A
$
0

Rather than going through the low-level process (creating the directory and then using mount), just let the OS handle the details for you:

open afp://pepito:thepassword@MacBook-Air.local/HD710A

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .