# (partially solved) Can not mount samba share as guest

## <3

Hello everyone,

I am pretty new to mounting samba shares. I just got a nas and I have set up a samba share on my network. This share is set to allow guest access. I cant seem to get my share to mount in Linux.

```
#smbclient -L <internal IP address> -U guest

smbclient: Can't load /etc/samba/smb.conf - run testparm to debug it

Enter WORKGROUP\guest's password: <I hit enter for no password> 

        Sharename       Type      Comment

        ---------       ----      -------

        IPC$            IPC       

        Openshare       Disk      

SMB1 disabled -- no workgroup available

```

I have added the following to /etc/fstab:

```
//<internal ip address>/OpenShare /mnt/OpenShare cifs guest
```

but when I try to mount the drive I am getting the following error.

```
#mount /mnt/OpenShare/

mount error(13): Permission denied

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
```

```
[ 2409.843832] CIFS: Attempting to mount //<internal ip address>/OpenShare

[ 2409.843891] 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.

[ 2409.970269] CIFS VFS: cifs_mount failed w/return code = -13

```

Can someone please tell me what I am doing wrong?Last edited by <3 on Mon Mar 15, 2021 5:15 am; edited 1 time in total

----------

## alamahant

Hi

Please have something like

```

//remote-samba-server-fqdn/share /local/mount/point cifs username=<>,password=<>  0 0 ###OR

//remote-samba-server-fqdn/share /local/mount/point cifs credentials=/path/to/cred/file 0 0

```

in /etc/fstab

The credentials file should be something like 

```

username=user

password=password

```

Provided of course that the samba share is correctly configured.

I think if you manually mount the share you should do so as the root user.

----------

## <3

 *alamahant wrote:*   

> Hi
> 
> Please have something like
> 
> ```
> ...

 

So I need a credentials file even if I am mounting as guest?

----------

## alamahant

How is the share defined in smb.conf?

Something like

```

[share-name]

path = <>

guest ok = yes

guest only = yes

writable = yes

force create mode = 0777

force directory mode = 0777

```

?

If the share does not allow guest then you have to use

smbpasswd -a <username>

and provide both username and password for mounting or a creds file containing them.

Also "guest" as a mount option  refers i think to whether you need to provide password as an option for mounting but I think if manually done vs fstab it should be done by root or a sudo user

Also please check in smb.conf if the 

```

hosts allow = 127.  192.168.1. 

```

line in [global] section correctly reflects your lan. 

Please see

man mount.cifs

Also you might wish to use autofs for mounting the share

----------

## <3

 *alamahant wrote:*   

> How is the share defined in smb.conf?
> 
> Something like
> 
> ```
> ...

 

ok I guess that I was confused, I thought the smb.conf file was only needed if you are running a samba-server on that machine. I didn't realize that it was needed to run a samba-client.

----------

## halcon

 *<3 wrote:*   

> I thought the smb.conf file was only needed if you are running a samba-server on that machine. I didn't realize that it was needed to run a samba-client.

 

smb.conf is not needed on a client machine. Even samba is not needed, only cifs. alamahant was talking about smb.conf on the server.

Unfortunately, I have never configured samba shares with guest access, so can't help you with that.

I think you could try to configure a "normal" access with credentials to test if it works, that could help you to narrow the issue with guest access.

EDIT

That error about "SMB2.1 or later" could be fixed with adding vers=2.1 to the options line of the share in client's /etc/fstab.

Also, have you looked at logs of the server machine?

----------

## Tony0945

Heres the /etc/fstab line where I mount my samba server's video collection

```

//trantor/video         /mnt/trantor-video      cifs    vers=1.0,users,user=guest,password=none,rw   0 0

```

If there is a password then you need to change "none' to the password or the location of a file where the password is stored.

You must have CIFS support in the kernel, CONFIG_CIFS=y and possibly CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y

I don't know if the second one is needed but I have it. possibly it's needed for ancient windows. with your linux NAS, I wouldn't think so. But I include it because I do have it in mine.

If this doesn't work, I'd go to the sever and check smb.conf (hint: run the command "testparm")

EDIT:

Maybe need CONFIG_CIFS_XATTR . Here's the whole magilla. I'm sure that the DEBUG is not needed to run.

```
~ $ zgrep CIFS /proc/config.gz

CONFIG_CIFS=y

CONFIG_CIFS_STATS2=y

CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y

# CONFIG_CIFS_WEAK_PW_HASH is not set

# CONFIG_CIFS_UPCALL is not set

CONFIG_CIFS_XATTR=y

# CONFIG_CIFS_POSIX is not set

CONFIG_CIFS_DEBUG=y

# CONFIG_CIFS_DEBUG2 is not set

# CONFIG_CIFS_DEBUG_DUMP_KEYS is not set

# CONFIG_CIFS_DFS_UPCALL is not set

# CONFIG_CIFS_ROOT is not set

```

----------

## <3

 *Tony0945 wrote:*   

> Heres the /etc/fstab line where I mount my samba server's video collection
> 
> ```
> 
> //trantor/video         /mnt/trantor-video      cifs    vers=1.0,users,user=guest,password=none,rw   0 0
> ...

 

Thanks, using these options I was not able to mount as guest but I was at least finally able to mount as a user (I probably need to check permissions/guest account setting). Thanks but at least I am now able to mount the share. BTW I am running Truenas and not running a Linux NAS server.

----------

## Tony0945

For passwordless on your SERVER make sure you have this:

```
[video]

   create mask = 0755

   force user = nobody

   path = /video

   read only = No

```

That create mask allowed sharing with windows machines. If you are pure linux a different mask might work. I don't know. I'm still sgaring with a Windows XP VM to run video editting software.

I have read only = No for that reason, so the Windows software can edit and write back.

I believe that "force user = nobody" is the crucial part. "nobody" seems to really mean "anybody" but it's samba (or Linux) traditional name. Or you can use a real user name but then put the password in /etc/fstab .  Since I have no other users at home, I use nobody (really anybody).

----------

