LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 01-25-2013, 09:27 PM   #1
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 542

Rep: Reputation: 30
Samba shares - 1 with no password, 1 with a password, help me set it up


Hello, I know this has been done a million times as I have read a ton of examples online on how to do this, but I just can't get my configuration working for the life of me.

I want to have two samba shares. One that is world writeable, no password required and free for everyone. The second would require a password, or better yet, automatically get me in when i am logged in my other linux box as the correct user with the same password.

Here is my current smb.conf file:
Code:
[global]

	workgroup = workgroup
	server string = %h server
	dns proxy = no

	log file = /var/log/samba/log.%m
	max log size = 1000
	syslog = 0
	panic action = /usr/share/samba/panic-action %d

	usershare allow guests = yes
	security = share
	guest ok = yes
	guest account = xmrkite

;	encrypt passwords = yes
;	smb passwd file = /etc/samba/smbpasswd

#======================= Share Definitions =======================

[Shares]
	comment = Server Shares
	path = /media/store/shares
	writeable = yes
	guest ok = yes

[Store]
	comment = Server Store
	path = /media/store/admin
;	guest ok = no
	valid users = xmrkite
	writeable = yes

[printers]
	comment = All Printers
;	browseable = yes
	path = /var/spool/samba
	printable = yes
	guest ok = yes
;	read only = yes
	create mask = 0700
-Thanks for the help
 
Old 01-25-2013, 09:40 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,129

Rep: Reputation: Disabled
Before you invest too much time in setting up a Samba server using the "share" security mode, you should know that this mode is deprecated and support for it has been removed from all recent versions of Samba.

"security = share" relies on functionality that hasn't existed in any Windows product for quite some time. The last version to support share passwords was Windows ME, released some 13 years ago. Also, it requires the client to support ancient and insecure authentication protocols, so even if you use a Samba version supporting "security = share", you should not expect this to work with recent Windows clients like Windows 7 or Windows 8.
 
Old 01-25-2013, 09:42 PM   #3
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 542

Original Poster
Rep: Reputation: 30
Ok, so what should I do? security = user?

How would I allow a freebie no password share in that case?
 
Old 01-25-2013, 10:02 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,129

Rep: Reputation: Disabled
"security = user" will work. You could map "bad user" to a guest account and give that account permissions to access the "free" share.
 
Old 01-25-2013, 10:16 PM   #5
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 542

Original Poster
Rep: Reputation: 30
Ok, so here is what I changed it to:

Quote:
[global]

workgroup = workgroup
server string = %h server
dns proxy = no

log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d

usershare allow guests = yes
security = user
passdb backend = tdbsam
map to guest = store
# guest ok = yes
# guest account = store

; encrypt passwords = yes
; smb passwd file = /etc/samba/smbpasswd
username map = /etc/samba/smbusers

#======================= Share Definitions =======================

[Shares]
comment = Server Shares
path = /media/store/shares
writeable = yes
guest ok = yes
; browseable = yes

[Store]
comment = Server Store
path = /media/store/admin
; guest ok = no
valid users = xmrkite
writeable = yes

[printers]
comment = All Printers
; browseable = yes
path = /var/spool/samba
printable = yes
guest ok = yes
; read only = yes
create mask = 0700
Now it asks for a user and password when I try to browse to the server. You can't even see any shares unless you put in the password. When I do the xmrkite user/pass, it lets me in but won't go into the "server store" share. What in the world did I do wrong?
-Thanks
 
Old 01-25-2013, 11:02 PM   #6
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,129

Rep: Reputation: Disabled
The "map to guest" parameter is wrong. I'm a bit surprised Samba even started.

"map to guest" takes one of the following parameters: never (no guest access), bad user (non-existent users get mapped to the guest account), bad password (logging in with a bad password results in guest access), or bad uid (not valid in "security = user" scenarios).

You need "map to guest = bad user". The name of the guest account is specified with the "guest account" parameter.
 
Old 01-25-2013, 11:42 PM   #7
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 542

Original Poster
Rep: Reputation: 30
Ok, that fixed the guest share, but the user share is not working still. It just keeps asking for user and password. Any ideas? Samba is so tricky.
 
Old 01-26-2013, 09:54 AM   #8
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,129

Rep: Reputation: Disabled
When you connect to a Samba share, Windows will attempt to access the share using the credentials of the logged-in user. Samba will verify the credentials and, provided they match a locally defined user and password, use those credentials to access the shared directory.

For this to succeed, the following must be true:

- the name of the locally logged-in Windows user must match a user account on the Linux system running Samba
- the password hash for that user must be stored using a Windows-compatible hash algorithm (see man smbpasswd)
- the user account must have the necessary permissions to access the share and the underlying directory

(You may want to consider creating a domain, as it solves all password-related problems and adds a lot of useful functionality.)
 
Old 01-26-2013, 10:48 AM   #9
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 542

Original Poster
Rep: Reputation: 30
I understand, but I do a lot of windows virus removals and other repairs. I need to have a share that doesn't ask for a password. Right now, that works with my above-posted smb.conf file.

The samba share that needs to be password protected is only going to be accessed by my linux computers. I use the same user and pass on those linux computers and that user is already created on the samba server with the same password. So technically I've already done that. I'd like to avoid a domain if possible as I really don't need any of the functionality.

The folders for the share that is password protected are owned by the same user trying to connect. Is this just not possible without a domain? I was hoping that linux would pass the credentials when trying to access the share just like a windows setup would.
 
Old 01-26-2013, 11:05 AM   #10
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,129

Rep: Reputation: Disabled
Quote:
Originally Posted by xmrkite View Post
The folders for the share that is password protected are owned by the same user trying to connect. Is this just not possible without a domain? I was hoping that linux would pass the credentials when trying to access the share just like a windows setup would.
It is possible, but you need to add a Windows-compatible password hash with the smbpasswd command.

SMB authentication and Linux user authentication use different hash algorithms. Even though a user with the same username and password is defined on both the Linux client and the Samba server, SMB authentication will not work unless the Samba server has access to a Windows-compatible hash of the password. Samba has its own database for these hashes, and you add/modify entries with the smbpasswd command.
 
Old 01-26-2013, 11:21 AM   #11
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 542

Original Poster
Rep: Reputation: 30
Ok, so how do I do that then? I used the command smbpasswd -a xmrkite and typed in the password. Still getting the same issue. Even when I open up the network share from the same computer that is doing the sharing.
 
Old 01-26-2013, 11:25 AM   #12
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,129

Rep: Reputation: Disabled
And you've added xmrkite (or a group where xmrkite is a member) as a valid user on the share, and also set the appropriate permissions on the underlying file system?
 
Old 01-26-2013, 11:46 AM   #13
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 542

Original Poster
Rep: Reputation: 30
yes, he is the owner of the folders being shared and is the main lubuntu installed user with sudo permissions on the computer doing the sharing and on the kubuntu computer trying to access it.
 
Old 01-26-2013, 05:42 PM   #14
xmrkite
Member
 
Registered: Oct 2006
Location: California, USA
Distribution: Mint 16, Lubuntu 14.04, Mythbuntu 14.04, Kubuntu 13.10, Xubuntu 10.04
Posts: 542

Original Poster
Rep: Reputation: 30
Ok, I got it. Here is my smb.conf file:

Quote:
[global]

workgroup = workgroup
server string = %h server
dns proxy = no

log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d

usershare allow guests = yes
security = user
map to guest = Bad User
guest ok = yes
guest account = store

; encrypt passwords = yes
; smb passwd file = /etc/samba/smbpasswd
username map = /etc/samba/smbusers

#======================= Share Definitions =======================

[Shares]
comment = Server Shares
path = /media/store/shares
writeable = yes
guest ok = yes

[Store]
comment = Server Store
path = /media/store/admin
guest ok = no
valid users = xmrkite
admin users = xmrkite
writeable = yes

[printers]
comment = All Printers
browseable = yes
path = /var/spool/samba
printable = yes
guest ok = yes
read only = yes
create mask = 0700
And the key was the smbusers file too which now reads:

xmrkite = xmrkite
store = store
nobody = guest


Now, in windows, if I have a user and pass that match xmrkite's on the samba server, no password is required when accessing the share. Dolphin in linux still asks a password but it works and I can select remember password, so that's not an issue. If you log into windows with a different user than xmrkite, then you will get a user/pass popup should you try to open that share. The other share just let's you in. This is exactly what I want!! Also, my printers are shared with all users, no password required.

Thanks for all the help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set Samba server to prompt for password before viewing shares dalehsti Linux - Server 1 12-05-2011 03:03 PM
Samba shares suddenly requiring password? uhcafigdc Linux - Software 1 06-17-2011 11:15 AM
[SOLVED] Samba requesting password when accessing shares djsmiley2k Linux - Networking 5 04-04-2010 09:51 AM
how do i set samba to password certain shares or ip restrict them mrgreaper Linux - Newbie 3 09-26-2009 04:24 PM
Accessing remote shares with encrypted Samba password at bootup CyberGuy Linux - Software 1 01-09-2005 06:23 PM


All times are GMT -5. The time now is 10:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration