LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-16-2004, 10:44 PM   #1
bhicks
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Rep: Reputation: 0
Slackware 10.0 Samba: root can write, user cannot


Hey guys,

I was using SuSE for quite some time, and have decided to start using other distros. For my fileserver, I chose slackware on the advice of a good friend of mine, and so far I've been thrilled.

My only issue is with getting Samba configured. Currently, I can only write to the share when I am logged in as root on the remote machine, and I cannot read any sub-directories when logged in as the user. The partition I am sharing has

drwxrwxr-x 11 root users

under ls -l, and read only = no, writeable = yes, and write list = @users are all enabled in the smb.conf file, but I have tried the setup with very basic smb.conf setups and it still does not work, which leads me to believe that its not necessarily the smb.conf setup that is causing the problem. I have added the remote user on the slack box, ran smbpasswd -a, and use mount -t smbfs //Samba/documents /mnt/docs -o username=<user>,password=<password> when mounting the share. I can also write to the directory when logged in as the user on the slack machine.

I am stumped! I noticed in an old smb.conf a reference to a username map = <> line. I thought smbpasswd took care of the username mapping, is this incorrect? Thanks in advance for the advice!

Ben
 
Old 11-17-2004, 01:13 AM   #2
Jerre Cope
Member
 
Registered: Oct 2003
Location: Texas (central)
Distribution: ubuntu,Slackware,knoppix
Posts: 323

Rep: Reputation: 37
samba

use the rw, dmask and fmask args with smbmount on the remote machine.

Also, you will find SAMBA much easier to manage using Webmin on the host. Both the Webmin tools and the SAMBA SWAT tools make managing the smb.conf much easier.

www.webmin.com
 
Old 11-17-2004, 07:57 AM   #3
DertyolBA$HTARD
Member
 
Registered: Sep 2004
Location: USA
Distribution: Slackware 10
Posts: 86

Rep: Reputation: 15
Are the directories you are sharing listed as valid shares when you run testparm? Also I would suggest learning to edit the smb.conf file by hand instead of swat, in the long run you will understand a great deal more and have fewer issues, and vi is available on a lot lower end machines as an X server would not be, and swat is pretty unusable with lynx.
 
Old 11-17-2004, 08:39 AM   #4
bhicks
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Original Poster
Rep: Reputation: 0
actually i'm not using swat, x isn't even installed on that machine and i'm comfortable using vi to edit the smb.conf file. thanks for the suggestions, i will try them at lunch!
 
Old 11-17-2004, 08:54 AM   #5
DertyolBA$HTARD
Member
 
Registered: Sep 2004
Location: USA
Distribution: Slackware 10
Posts: 86

Rep: Reputation: 15
This is a shortened version of testparm's output of my functioning smb.conf samba shares:

Load smb config files from /etc/smb.conf
Processing section "[printers]"
Processing section "[Share]"
Processing section "[Test]"
Loaded services file OK.
Press enter to see a dump of your service definitions



[Share]
path = /samba_share
writeable = Yes

[Test]
path = /samba_share/test


Here are the permisions set on the shared directory

samba_share/ drwxrwxr-x 8 george users

Notice the owner's section?

chown <username> <file/dir. name>

That could be the problem.
 
Old 11-17-2004, 01:03 PM   #6
bhicks
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Original Poster
Rep: Reputation: 0
thanks for your help guys. so i changed the ownership on the share directory on the server as:

drwxrwxr-x 11 file users 4096 2004-11-16 03:09 docs

file being the user on the slack box. Then i ran mount -t smbfs //Samba/documents /mnt/docs -o rw,username=ben,password=<>, and i am getting the same results. I also noticed on the remote machine, after i mount the share it changes the file to

drwxr-xr-x 1 root root 4096 Nov 17 12:59 docs

while when it is not mounted it is set as

drwxrwx--- 2 ben users 4096 Nov 9 21:55 docs

This is what i get when i run testparm on the slack box:

[global]
netbios name = SAMBA
server string = "Samba Server"
interfaces = eth0
smb passwd file = /etc/samba/smbpasswd
log file = /var/log/samba.log
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
message command = /bin/sh -c 'xmessage "%f" "%m" %s; rm %s' &
valid users = file, ben, ben1
hosts allow = 192.168.1., 127.

[public]
path = /docs/test/
read only = No
guest ok = Yes

[ben]
path = /docs/ben/
read only = No
guest ok = Yes

[documents]
path = /docs
write list = @users
read only = No
guest ok = Yes

[printers]
comment = All Printers
path = /var/spool/samba
guest ok = Yes
printable = Yes
printing = bsd
print command = lpr -r -P'%p' %s
lpq command = lpq -P'%p'
lprm command = lprm -P'%p' %j
browseable = No

[homes]
comment = Home Directories
read only = No

[documents] being the share that i'm trying to mount...argh!
 
Old 11-17-2004, 01:10 PM   #7
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
Try:
Code:
[documents]
path = /docs
public = yes
writeable = yes
create mask = 007
write list = @users
read only = No
guest ok = Yes
 
Old 11-17-2004, 01:16 PM   #8
bhicks
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Original Poster
Rep: Reputation: 0
Ok i tried that...still same issue. here is my smb.conf file:

[global]
netbios name = Samba
server string = "Samba Server"
workgroup = WORKGROUP
security = user
log file = /var/log/samba.log
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
hosts allow = 192.168.1. 127.
# only add as much of the number as necessary to identify the computers, localho
st can be
# identified using only 127. a private network may require the first three numbe
rs in the IP
# address.
; hosts deny = ALL
; invalid users = root
valid users = file, ben, ben1
message command = /bin/sh -c 'xmessage "%f" "%m" %s; rm %s' &
interfaces = eth0

[public]
path = /docs/test/
guest ok = yes
public = yes
writeable = yes
read only = no

[ben]
path = /docs/ben/
guest ok = no
public = yes
writeable = yes
read only = no

[documents]
path = /docs
browseable = yes
guest ok = yes
writeable = yes
create mask = 777
write list = @users
public = yes
read only = no

[printers]
comment = All Printers
path = /var/spool/samba
printing = bsd
browseable = yes
read only = yes
printable = yes
guest ok = yes

[homes]
comment = Home Directories
browseable = Yes
writeable = Yes

i tried the create mask = 007 and that didn't work, so i tried 777 as well to no avail
 
Old 11-17-2004, 01:19 PM   #9
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
mask 007 will make new files read,write,executable by owner & group but none to others.
Try using security = share

Just in case (no offense intended), are you restarting Samba?

Last edited by gbonvehi; 11-17-2004 at 01:27 PM.
 
Old 11-17-2004, 01:56 PM   #10
bhicks
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Original Poster
Rep: Reputation: 0
yes i have been restarting samba after every change to the smb.conf file, no offense taken! I will try your suggestion when I get home this evening. Do you think it could have anything to do with the username map = option? Maybe if that is not properly setup samba cannot reference its users against the ones on the slack box?
 
Old 11-17-2004, 08:30 PM   #11
bhicks
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Original Poster
Rep: Reputation: 0
ok i tried security = share and its doing the same thing...i tried running a very basic smb.conf file that should work

[global]
workgroup = WORKGROUP
netbios name = Samba
encrypt passwords = yes

[documents]
path = /docs
guest ok = no
read only = no
browseable = yes
write list = @users

and its doing the same thing, which leads me to believe its not the smb.conf file that is the problem. to setup samba i follwed this website: http://www.magma.ca/~meik/linux/conf...are.html#samba and i got the following error:

bash: mksmbpasswd.sh: command not found

so i just added all of the passwords manually through smbpasswd -a <userid>

i also created the lmhosts file as:

# For loopbacking.
127.0.0.1 localhost
127.0.0.1 slackware.linux slackware

# Network
192.168.1.101 Game
192.168.1.102 ben
192.168.1.104 FreeBSD
# End of hosts.

help!
 
Old 11-17-2004, 11:38 PM   #12
bhicks
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Original Poster
Rep: Reputation: 0
i ran smbstatus on the slack box and this is what it put out:

PID Username Group Machine
-------------------------------------------------------------------

Service pid machine Connected at
-------------------------------------------------------
documents 654 192.168.1.102 Thu Nov 18 05:19:31 2004

is this normal?
 
Old 11-18-2004, 05:46 AM   #13
DertyolBA$HTARD
Member
 
Registered: Sep 2004
Location: USA
Distribution: Slackware 10
Posts: 86

Rep: Reputation: 15
Yes that is normal, it shows a connection to your "documents" share, from 192.168.1.102 user ben
running on process ID 654

Try this on the linux box, log on as your user and run:

smbclient -L <samba server IP>

That should list alll available shares on the samba server

Also you may want to edit or create a hosts file on the Windows boxes as well as on the linux boxes. Hosts will work without netbios.



127.0.0.1 localhost
192.168.1.100 server

# End of hosts.

This is my hosts file from my samba server above.

/etc/hosts (linux)

c:\winnt\system32\drivers\etc\hosts (windows)

Last edited by DertyolBA$HTARD; 11-18-2004 at 05:48 AM.
 
Old 11-18-2004, 06:49 AM   #14
hayesben
LQ Newbie
 
Registered: Jul 2004
Location: Peterborough, England
Distribution: Slackware 10 (moving from RHEL 3 WS)
Posts: 27

Rep: Reputation: 15
bhicks

If memory serves me correctly, the default masks in samba are as follows (unless they are specified in the relevant sections):

create mask = 0600
directory mask = 0755

In respect to your [global] settings, you have only define three users with access (file, ben, ben1) but from the [documents] settings you are defining @users. Shouldn't you be defining this in reverse order (ie groups in [global] and then becoming more restrictive on the shares)? (This isn't the best way to ask the question but you should grasp what I'm asking) Questions:

1) Are only three users accessing this server?
2) Have they been added into the local users group?
3) Have you converted these user to Samba users (effectively adding them to the smbpasswd file)?
4) What version of Samba are you using?

If more than these 3 users are accessing the server, then add/change the valid user in the [global] section to @users.

Here's a copy of my smb.conf file:
~~~
# Global parameters
[global]
socket options = SO_KEEPALIVE TCP_NODELAY
admin users = bhayes, jgilbert
wins server = CONTDC13
domain master = No
interfaces = 127.0.0.1, eth0
map to guest = Bad User
printer admin = @ntadmin, root, administrator, bhayes
netbios aliases = icm-lin
server string = ICM Test server
password server = CONTDC15
local master = No
workgroup = BSG
valid users = bhayes,jgilbert,@superusers
security = DOMAIN
preferred master = No
bind interfaces only = Yes

[homes]
comment = Home Directories
valid users = %S
read only = No
browseable = No

[users]
comment = All users
path = /home
read only = No
inherit permissions = Yes
veto files = /aquota.user/groups/shares/

[groups]
comment = All groups
path = /home/groups
read only = No
inherit permissions = Yes

[pdf]
comment = PDF creator
path = /var/tmp
create mask = 0600
printable = Yes
print command = /usr/bin/smbprngenpdf -J '%J' -c %c -s %s -u '%u' -z %z

[printers]
comment = All Printers
path = /var/tmp
create mask = 0600
printable = Yes
browseable = No

[print$]
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = @ntadmin, root
force group = ntadmin
create mask = 0664
directory mask = 0775

[upload]
comment = ICM Upload Directory
path = /upload
read only = No
browseable = No

[root]
comment = System Root
path = /
read only = No
; hosts allow = 172.30.1.64


Something else that you could do is install webmin onto your system and then install SWAT afterwards. This will give you a graphical web interface whereby you can remotely manage your system.

Ben

Last edited by hayesben; 11-18-2004 at 07:24 AM.
 
Old 11-18-2004, 08:27 PM   #15
bhicks
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Original Poster
Rep: Reputation: 0
yes there are only 3 machines on my network, so only i'm only using 3 usernames. i reversed the order like you suggested to no avail. i converted them to samba users through smbpasswd -a <username>, and their names show up in the smbpasswd file. i am running samba 3.07.

so, i guess i'm just going to reinstall slack to see if i can start better from scratch. this is just going to be a samba server, so does can anyone offer any good advice for post-install configuration? i'm just going to add local users, add them to the smbpasswd file, and then configure the permissions on the local side and then in the smb.conf file. the share i will create will be a full partition, is there any special fstab entry i need to make for this? thanks everyone for all your help, i really appreciate it, hopefully all goes well.
 
  


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
SAMBA - VFAT local mount for all user write access... dolvmin Linux - Software 13 12-21-2006 03:50 PM
non root samba write permission Lazarus Linux - Software 8 05-29-2005 04:57 AM
Cannot write to SMB share as user, can as root GT_Onizuka Linux - Networking 3 10-03-2004 06:52 PM
How do I write a make install Makefile that determines if user is root? SheldonPlankton Programming 3 08-13-2004 05:39 PM
Can only write to samba shares as root. Neuronet Linux - Software 17 06-27-2003 06:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:13 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
Open Source Consulting | Domain Registration