LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-17-2009, 10:44 AM   #1
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Rep: Reputation: 15
how do i set samba to password certain shares or ip restrict them


ok i have a ubuntu server that uses samba to share all three hard drives with my network at the moment if you access any one of the shares you are asked a username and password, if i log in as my ubuntu user name password in this screen then im in to the share and have access to all three shares with no further prompting needed. this is not how i want it, how i want it is like this;

share1 (accessable by anyone on my network providing they have the username and password (or just one password)

share2 same as share1

share3 additional password required and/or only accessable by two lan ips

i have found that the smb.conf is in /etc/samba
but the shares are in /var/lib/ssamba in seperate files

i managed to add the samba documentation and tried reading the difference between user and share level authentication but that doc is not written for mortals! please any help greatfully recieved
 
Old 09-17-2009, 01:55 PM   #2
billinja
LQ Newbie
 
Registered: Nov 2004
Location: Newmarket, Ontario - Canada
Distribution: Ubuntu
Posts: 9

Rep: Reputation: 0
On my Ubuntu server, I've set all my shares up in /etc/samba/smb.conf, so I'm not sure why they're in a different location..

I used the VALID USERS = parameter, per share, in the smb.conf in order to limit who can access what share...

That way, only my user, and root can access my unorganized "Stuff" share.

[Stuff]
path = /media/Storage1TB/STUFF/
available = yes
valid users = billinja, root
read only = no
browseable = yes
public = no
writable = yes

and in this example, my wife has access to our photo collection.

[Photos]
path = /media/Storage1TB/Photos
available = yes
valid users = billinja, root, april
read only = yes
browseable = yes
public = no
writable = no

These users need to be added as samba users, with samba passwords on the system, however they don't have to be personal accounts. I could just as easily set up a STUFF user or PHOTOS user, and given it a password that I would share with others. That just isn't as secure.

I'm sure there is also ways to do this with groups, but I haven't had the need to look into that yet.

Hopefully this helps - if not, I'm sure someone will correct me
 
Old 09-17-2009, 02:52 PM   #3
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by billinja View Post
On my Ubuntu server, I've set all my shares up in /etc/samba/smb.conf, so I'm not sure why they're in a different location..

I used the VALID USERS = parameter, per share, in the smb.conf in order to limit who can access what share...

That way, only my user, and root can access my unorganized "Stuff" share.

[Stuff]
path = /media/Storage1TB/STUFF/
available = yes
valid users = billinja, root
read only = no
browseable = yes
public = no
writable = yes

and in this example, my wife has access to our photo collection.

[Photos]
path = /media/Storage1TB/Photos
available = yes
valid users = billinja, root, april
read only = yes
browseable = yes
public = no
writable = no

These users need to be added as samba users, with samba passwords on the system, however they don't have to be personal accounts. I could just as easily set up a STUFF user or PHOTOS user, and given it a password that I would share with others. That just isn't as secure.

I'm sure there is also ways to do this with groups, but I haven't had the need to look into that yet.

Hopefully this helps - if not, I'm sure someone will correct me
sounds like a good method, how do i add samba users and passwords?


found an alternitve fix (i have reinstalled samba 3 times today and really screwed up my pc once,)
it was actualy scarierly simple just add "host allow = 192.168.1.112 192.168.1.113 to the share and set security to share and added guest ok = yes and force user = my username

all shares that are available to any of my friends connect to my network will have there ip added to the allow ip list of each share they are aloud to access

Last edited by mrgreaper; 09-17-2009 at 05:05 PM.
 
Old 09-26-2009, 03:24 PM   #4
pddm
Member
 
Registered: Sep 2005
Distribution: Slackware 13.37
Posts: 112

Rep: Reputation: 15
1st set in your /etc/samba/smb.conf
Code:
security = user
Then create the users in linux 1st (if they do not already exist).

Then add the user to samba
Code:
smbpasswd -a username
Make sure the folder you would like to share has it's right set to allow the user to access in the way you would like.

If you have many users using the same share you can add the into 1 common group and the just refer to the group under valid users using @ and the group name.

Here is an example:
Code:
[Music]
	comment = MP3 Music
	path = /smbroot/Music
	valid users = @family
	writeable = yes
	printable = no
	create mask = 0777
	directory mask = 0777
	force group = family
	force user = pddm
	veto files = /*lost+found*/
Code:
ls -l /smbroot/
total 556
drwxrwx---  40 pddm family   4096 2009-09-16 19:51 Music
So in this case whoever is member of the family group gets access to the Music share.

Last edited by pddm; 09-26-2009 at 03:25 PM. Reason: typo
 
  


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
Cannot Set Samba Root Password klatch Linux - Server 1 12-02-2008 05:04 AM
How to set up QUOTAS on Samba Shares (user home dirs) Obig Linux - Server 2 05-28-2008 04:36 AM
Samba: smbpasswd is set to NO PASSWORD linlu Linux - Networking 6 06-16-2005 01:44 PM
Accessing remote shares with encrypted Samba password at bootup CyberGuy Linux - Software 1 01-09-2005 05:23 PM
Samba password doesn't work when accessing Linux shares from W2K soren625 Linux - Software 4 05-14-2004 05:55 AM


All times are GMT -5. The time now is 08:36 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration