Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
(partially solved) Can not mount samba share as guest
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
<3
Veteran
Veteran


Joined: 21 Oct 2004
Posts: 1081

PostPosted: Sun Mar 14, 2021 9:08 am    Post subject: (partially solved) Can not mount samba share as guest Reply with quote

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.

Code:
#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:
/etc/fstab:
//<internal ip address>/OpenShare /mnt/OpenShare cifs guest



but when I try to mount the drive I am getting the following error.
Code:
#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)


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
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3876

PostPosted: Sun Mar 14, 2021 1:25 pm    Post subject: Reply with quote

Hi
Please have something like
Code:

//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

Code:

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.
_________________
:)


Last edited by alamahant on Sun Mar 14, 2021 2:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
<3
Veteran
Veteran


Joined: 21 Oct 2004
Posts: 1081

PostPosted: Sun Mar 14, 2021 2:19 pm    Post subject: Reply with quote

alamahant wrote:
Hi
Please have something like
Code:

//remote-samba-server-fqdn/share /local/mount/point cifs username=<>,password=<> ###OR
//remote-samba-server-fqdn/share /local/mount/point cifs credentials=/path/to/cred/file

in /etc/fstab
The credentials file should be something like

Code:

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.


So I need a credentials file even if I am mounting as guest?
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3876

PostPosted: Sun Mar 14, 2021 2:25 pm    Post subject: Reply with quote

How is the share defined in smb.conf?
Something like
Code:

[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
Code:

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
_________________
:)
Back to top
View user's profile Send private message
<3
Veteran
Veteran


Joined: 21 Oct 2004
Posts: 1081

PostPosted: Sun Mar 14, 2021 9:30 pm    Post subject: Reply with quote

alamahant wrote:
How is the share defined in smb.conf?
Something like
Code:

[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
Code:

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


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.
Back to top
View user's profile Send private message
halcon
l33t
l33t


Joined: 15 Dec 2019
Posts: 629

PostPosted: Sun Mar 14, 2021 10:34 pm    Post subject: Reply with quote

<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?
_________________
A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Sun Mar 14, 2021 11:29 pm    Post subject: Reply with quote

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

//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.
Code:
~ $ 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
Back to top
View user's profile Send private message
<3
Veteran
Veteran


Joined: 21 Oct 2004
Posts: 1081

PostPosted: Mon Mar 15, 2021 5:14 am    Post subject: Reply with quote

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

//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.
Code:
~ $ 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


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.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Fri Mar 19, 2021 5:21 pm    Post subject: Reply with quote

For passwordless on your SERVER make sure you have this:
Code:
[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).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum