10

Using root I can mount another Linux share no problem.

root@crunchbang:/mnt# mkdir javalib
root@crunchbang:/mnt# mount -t cifs //10.1.3.7/javalib ./javalib -o username=guest

Root can read/write to the share dirs no problem.

root@crunchbang:/mnt# ll
drwxrwx---  9 500 users 0 Apr 13 17:59 javalib

root@crunchbang:/mnt# cd javalib
root@crunchbang:/mnt/javalib#

When trying to access the dir under another user, even when the user is part of the 'users' group it gets permission denied.

shawn@crunchbang:/mnt# cd javalib
bash: cd: javalib: Permission denied
shrimpwagon
  • 427
  • 3
  • 6
  • 11

3 Answers3

2

As mentioned in one of the comments, try mounting the share using these options:

-o uid=500,gid=users,nounix

or

-o uid=500,gid=users,rw

or this to forgo confusion with regards to CIFS POSIX extensions, as explained in another answer on here.

-o username=guest,defaults,noperm

Depending on your system, the introduction of systemd and udev in Linux has changed how filesystems get mounted once again. However, I'm not sure that/how CIFS/Samba shares are affected by this.

ILMostro_7
  • 3,199
  • 1
  • 21
  • 27
1

According to Mark Cohen's answer, you need some kind of change permission action.

But simple sudo chmod 777 javalib will crash with another permission denied. You need to add mount options -o username=guest,dir_mode=777,file_mode=666 to make directories executable for everyone.

If this method won't help, then you may need to add options, such as -o uid=$(whoami).

0

I also have this problem and the only thing which worked for me was this:

sudo mkdir /mnt/logs
sudo mount.cifs //192.168.10.10/directory\ name/ /mnt/logs/ -o user=remote\ user\ name,rw,vers=1.0,dir_mode=0777,file_mode=0666,nounix

Just replace

  1. 192.168.10.10 by the IP of remote computer
  2. directory\ name by the remote directory absolute path
  3. remote\ user\ name by the remote user account used to authenticate
  4. vers=1.0 by the version of the smb protocol implemented on the remote computer

After you run this command, it will prompt by your remote\ user\ name password.

Just do not forget to install: sudo apt-get install cifs-utils

If you have any problems with this command line, as some nuts errors like:

mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

You can run this to see what the error was

$ tail /var/log/kern.log
May  8 16:09:06 user-pc kernel: [265246.010808] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
May  8 16:09:06 evandro-pc kernel: [265246.012935] CIFS VFS: cifs_mount failed w/return code = -22

On this case, if you search on Google you will see the error was that I ran the command without specifying the vers=1.0 argument.

References:

  1. https://forums.linuxmint.com/viewtopic.php?t=75785
  2. Permission denied for user accessing mount
  3. https://stackoverflow.com/questions/74626/how-do-you-force-a-cifs-connection-to-unmount
user
  • 731
  • 2
  • 11
  • 20