# umount: only root can unmount

## cynk

Hi all

I am new here so if this issue was already discussed I apology in advance.

I am using samba 3.0.28a.

I can mount/umount smb shares on root account and mount on non-root account

but I CAN'T UNMOUNT it on non-root account.

my fstab:

```

//SomeIP/d         /mnt/point     smbfs           noauto,credentials=/path/to/file,iocharset=iso8859-2,codepage=cp852,rw,user,uid=1000,gid=1000,umask=0017

```

permissions:

```

ls -l /usr/bin/smb*m*nt

-rws--s--x 1 root root  21684 maj  4 23:54 /usr/bin/smbmnt

-rwxrwxrwx 1 root root 884820 maj  4 23:54 /usr/bin/smbmount

-rws--s--x 1 root root  21684 maj  4 23:54 /usr/bin/smbumount

ls -l /bin/*mount

-rws--x--x 1 root root 80416 lut 12 18:30 /bin/mount

-rws--x--x 1 root root 30488 lut 12 18:30 /bin/umount

```

I also tried to remove suid from smbumont but the result was identical.

I would appreciate any guidance.

Thx in advance   :Very Happy: 

----------

## octanez

can you provide us with a snippit of the error it returns when a user tried to umount?

----------

## VinzC

In

```
//SomeIP/d         /mnt/point     smbfs           noauto,credentials=/path/to/file,iocharset=iso8859-2,codepage=cp852,rw,user,uid=1000,gid=1000,umask=0017
```

uid=1000 and gid=1000 mean you're using a specific account and a specific group as the mount point owner. If I have understood, only the user with an ID equal to 1000 will be able to unmount, which is probably the first user you created on your system.

What I generally do with user mount points is to remove uid from the options and set gid to 100 (actually the built-in users group), like this:

```
//SomeIP/d         /mnt/point     smbfs           noauto,credentials=/path/to/file,iocharset=iso8859-2,codepage=cp852,rw,user,gid=100,umask=0017
```

The mount point owner will then be the user who actually did the mount. The umask value allows every member of group users to read (but not write) to the share. Any other user will have no access to the share.

----------

## cynk

Hi, 

I did what You had suggested, however with no success.

fstab:

```

//ip/d          /mnt/serv_d     smbfs           noauto,credentials=/etc/samba/.server.smb.conf,iocharset=iso8859-2,codepage=cp852,rw,user,gid=100,umask=0017     0       0

//ip/e          /mnt/serv_e     smbfs           noauto,credentials=/etc/samba/.server.smb.conf,iocharset=iso8859-2,codepage=cp852,rw,user,gid=100,umask=0017     0       0 

```

I want to emphasize that I can mount share does what ever I want (read,write,etc..) however 

I can't unmout it.

```

$ mount /mnt/serv_d

opts: rw

opts: noexec

opts: nosuid

opts: nodev

opts: noauto

opts: user

opts: credentials=/etc/samba/.server.smb.conf

opts: iocharset=iso8859-2

opts: codepage=cp852

opts: gid=100

opts: umask=0017

passthrough options 'noexec,nosuid,nodev,noauto,user,iocharset=iso8859-2,codepage=cp852,umask=0017'

mount.smbfs started (version 3.0.28a)

added interface ip=172.18.0.2 bcast=172.18.0.255 nmask=255.255.255.0

Connecting to 172.18.0.1 at port 445

$umount /mnt/serv_d

umount: only root can unmount //172.18.0.1/e from /mnt/serv_e

```

 *VinzC wrote:*   

> In
> 
> ```
> //SomeIP/d         /mnt/point     smbfs           noauto,credentials=/path/to/file,iocharset=iso8859-2,codepage=cp852,rw,user,uid=1000,gid=1000,umask=0017
> ```
> ...

 

----------

## NeddySeagoon

cynk,

With your options in fstab, only the user then performs the mount can umount.

See man mount and not the difference between user and users.

Also, you cannot umount, if there is a window open into the samba share.

----------

## cynk

Hi,

   I do perform mount and unmount  with the same (non-root) user, and I am certain that share is not used by anyone

   because when I unmoun it on root account it does not complain. And even if it was taken by some process

   the output would be rather:

```
umount: /mnt/serv_d: device is busy
```

   and what I get is

```

marcin@marcin ~ $ mount /mnt/serv_d/

opts: rw

opts: noexec

opts: nosuid

opts: nodev

opts: noauto

opts: user

opts: credentials=/etc/samba/.server.smb.conf

opts: iocharset=iso8859-2

opts: codepage=cp852

opts: gid=100

opts: umask=0017

passthrough options 'noexec,nosuid,nodev,noauto,user,iocharset=iso8859-2,codepage=cp852,umask=0017'

mount.smbfs started (version 3.0.28a)

added interface ip=172.18.0.2 bcast=172.18.0.255 nmask=255.255.255.0

Connecting to 172.18.0.1 at port 445

marcin@marcin ~ $ umount /mnt/serv_d/

umount: only root can unmount //172.18.0.1/d from /mnt/serv_d

```

I know that I messed up sth but I have no idea what.

Maybe my smb.conf is f**ked up:

```

[global]

 workgroup = WORKGROUP

 netbios name = lapmarcin

 server string = Laptop Marcin %v 

 load printers = no 

# logs

 log file = /var/log/samba/log

 max log size = 50 

 log level = 3

#security

# encrypt password = yes

 smb passwd file = /etc/samba/smbpasswd

 hosts allow = 172.18.0. 172.19.1.

 security = user

#speed

 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

#interfaces

 interfaces = 172.18.0.2/24

#charset

 display charset = ISO8859-2

 unix charset = ISO8859-2

 dos charset = CP852

[homes]

   comment = Homes

   browseable = no 

   writable = yes

```

 *NeddySeagoon wrote:*   

> cynk,
> 
> With your options in fstab, only the user then performs the mount can umount.
> 
> See man mount and not the difference between user and users.
> ...

 

----------

## cynk

Hi,

I think that smb.conf does not have any meaning because I have problem on client not server side,

however I am quite desperate so I enclosed it in previous post

--

Regards

Cynk

----------

## dmpogo

 *cynk wrote:*   

> Hi,
> 
> I think that smb.conf does not have any meaning because I have problem on client not server side,
> 
> however I am quite desperate so I enclosed it in previous post
> ...

 

Have you tried replacing fstab "user" option with "users" as suggested above ?

----------

## cynk

 *dmpogo wrote:*   

>  *cynk wrote:*   Hi,
> 
> I think that smb.conf does not have any meaning because I have problem on client not server side,
> 
> however I am quite desperate so I enclosed it in previous post
> ...

 

Hi,

users option solves the problem You and NeddySeagoon were right. I must have missed out that hint.

So I think that this topic may be marked as SOLVED, however I do have one additional question because it keeps my mind.

If user option allows umount to user that mount the share why I couldn't unmount it with that user. 

Is it possible that during smbfs mountnig smbmount takes EUID instead of UID and as a result of that

only root can perform umount??

Anyway I wanna thx to all for help

--

Regards,

cynk

----------

## VinzC

 *cynk wrote:*   

> If user option allows umount to user that mount the share why I couldn't unmount it with that user. 
> 
> Is it possible that during smbfs mountnig smbmount takes EUID instead of UID and as a result of that
> 
> only root can perform umount??

 

I use option "user", which allows me to mount/unmount any filesystem [with the same, regular user account]. Normally user allows the same user (and root) to unmount as NeddySeagoon explained. I don't understand why it doesn't seem to work for you with samba shares - note however I haven't used that option with samba shares personally. Perhaps smbmount interprets these options differently...

----------

