LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware 12.1 and Windows XP File sharing through Samba (https://www.linuxquestions.org/questions/slackware-14/slackware-12-1-and-windows-xp-file-sharing-through-samba-661532/)

oranyelik 08-08-2008 10:56 PM

Slackware 12.1 and Windows XP File sharing through Samba
 
Hi,

I need to configure a shared folder on my Slackware 12.1 box that will be accessible by any Windows XP machine on the network. I want to allow everyone read/write permission to my /var/www/htdocs folder on my slackware box without a username/password login, if possible.

I used SWAT to configure my smb.conf file. I got my Windows XP machine to view the slackware box, and the shared directory inside of it. However, when I tried to open that shared directory, I got an error:
Quote:

\\Host is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

The network path was not found."
I tried using iptables and enabling both tcp and udp ports 137-139 and 445 (even though I read that slackware does not block any ports by default). The command iptables -t nat -A PREROUTING --in-interface eth0 -p tcp --dport 137 -j DNAT --to-destination 192.168.0.5 appeared to go through for both tcp and udp on each of the four ports that I mentioned, but after having done that I could only view the slackware box from my windows xp box, no longer open it.

I then tried manually editing my smb.conf file according to http://www.foogazi.com/2006/11/01/si...ackware-setup/ that guide, but that didn't change anything.

I ran the smbd 'in the front-end' (as was recommended) on my slackware box so I could see some action when I tried to do telnet from my XP box... but it ultimately failed and the XP machine said that it could not connect.


Please help me figure out how to get this file sharing configured! I've done searching through this forum and lots of google and cannot find a solution to my problem.

Here are my details:
- All of my network IPs are assigned by DHCP (but I don't think this will matter as long as I don't map a network drive and just go to 'View Workgroup Computers' to transfer files, which is fine)
- Workgroup name: Mshome
- Slackware 12.1 Box: Currently 192.168.0.4
- Trying to share /var/www/htdocs for access by any windows xp user on my home network
- Windows XP Box: Currently 192.168.0.5
- Windows XP box logs on using an account named 'Naro' with no password
- I have created a user on my slackware box called 'naro' with no password

Here is my smb.conf file:
Code:

    [global]
    workgroup = Mshome
    server string = Slackware 12.1 Server
    security = user
    load printers = yes
    log file = /var/log/samba.%m
    max log size = 50
    socket options = TCP_NODELAY

    [home]
    comment = Home Directory
    path = /var/www/htdocs/
    valid users = naro
    writable = yes

I've tried adding 192.168.0.5 through host allow... no luck.

disturbed1 08-09-2008 12:23 AM

comment = Home Directory
path = /var/www/htdocs/
valid users = naro
writable = yes

If you want to have guest access, you shouldn't define the valid user as naro ;) This would make the only user allowable to login as naro. Defeats your quest of not having to use a login.

Maybe -
Code:

[$SHARE]
        comment = $COMMENT
        path = /$PATH
        force user = $USER WITH READ/WRITE ACCESS
        read only = No
        create mask = 0777
        directory mask = 0777
        inherit permissions = Yes
        inherit owner = Yes
        guest only = Yes
        guest ok = Yes
        guest account = $USER WITH READ/WRITE ACCESS

$WHATEVER is the variable that needs to be set by you. Make sure the user has read/write access the shared drive in question and is a valid samba/unix user.

oranyelik 08-09-2008 10:28 AM

I'll have to give your configuration suggestion a try. I'll report back later tonight whether or not my problem is fixed.

$USER would be the account that I created on my Linux box? In this case, it'd be the user 'naro'...? I think that I used the command 'adduser naro' to add the account that I want my XP boxes to use, and entered no password for it. I didn't add it any group other than users.

Perhaps the user 'naro' does not have access to my /var/www/htdocs file...? Would this cause the problem that I'm having? I can find out using an ls -l in my /, /var, and /var/www folder, right? All I need to do is chmod -777 -R on my /var folder? I would imagine that's really insecure (because if possible, I wouldn't want Windows XP users to have full control in any folder except the htdocs file). I'd like to avoid this method if possible, but if it's the only thing that will work I'll do it (because I'm not concerned about security, just about accidents!)

And by saying Guest Only = Yes, that will allow anyone to use the share without having to log in, right? And anyone who logs in is going to be forced into this guest account, no matter what they log in as on any Windows box?

Thanks a lot!

oranyelik 08-09-2008 05:46 PM

I've read a little bit of research about sercurity=share... should I use that parameter in my [global] section?

Also, should I write the bolded text 'with read/write access', or are those just comments that you added in there? Sorry I don't know my linux very well and I'm thinking that those could be parameters?

disturbed1 08-09-2008 08:07 PM

They're just comments. Meaning that the user that you define here should have read and write access to the folder your wanting to share.

Guest only means samba will not ask for a username/pass.

Guest user = maps who ever logs into the samba share as that user.

$USER has to be both a valid unix and samba user. $USER also needs to have read/write access for the shared drive.

If you're concerned about accidents, then perhaps not everyone should be trusted with rw access to a folder ;)


I would re-read the samba docs again. They cover everything (and then some :) ) that you want to do. man samba. This gives the names of the different programs. Then you can man each one of those program.

Doing a google search gives these results http://www.google.com/search?hl=en&s...access&spell=1

silverbird 08-10-2008 01:46 AM

Yes I would try adding a samba user. (smbadduser)

oranyelik 08-10-2008 10:44 AM

Alright, I've got it working. I took you suggestions here and combined them with a little bit of googling to get things working. Here is what I did to fix my problem, for anyone else who may view the thread in the future:

First, I made sure that my Linux user 'naro' could read/write the /var/www/htdocs folder... and that was successful. I must have already set the permission using chmod 777 /var/www/htdocs.

Second, I changed my smb.conf file to look like the following:
Code:

  [global]
    workgroup = Mshome
    server string = Slackware 12.1 Server
    security = user
    load printers = yes
    log file = /var/log/samba.%m
    max log size = 50
    socket options = TCP_NODELAY

    [share]
        comment = sw12_1 share
        path = /var/www/htdocs
        force user = naro
        read only = No
        create mask = 0777
        directory mask = 0777
        inherit permissions = Yes
        inherit owner = Yes
        guest only = Yes
        guest ok = Yes
        guest account = naro

I took disturbed's suggestion of not having 'valid users' as a parameter in my smb.conf file.

Finally, I had to add the Linux user 'naro' to my samba users by doing the command smbpasswd -a naro. I read from the man pages that the -a parameter simply adds the user (or is ignored if the user already exists). When it asked for a password I just pressed enter (effectively creating no password).

I am now able to log in from the Windows XP box I've been testing with (the one that logs in as Naro). I'll test it out on my other Windows XP boxes in a moment, but I'm hopeful that it will work.

Thanks a lot for the help everyone.


All times are GMT -5. The time now is 08:01 AM.