Home

Debian/Ubuntu Tips & Tricks

Debuntu.org: .deb packages, Unix/Linux Tutorials and Articles.

sponsors


User login

Poll

Syndicate

Syndicate content


Tips


Samba: How to share files for your LAN without user/password

This tutorial will show how to set samba to allow read-only file sharing for your LAN computers as guest (without be prompted for a password).
Because users won't be prompted for a user/password, this tutorial is meant to be installed in a LAN where all host are to be trusted.

There is many advantages of sharing files in a LAN. For instance, when you have a multimedia box (playing music, movies....) it is great to be able to access the music on that box from any machines in your LAN.

Let's get started. In the first place, you need to have samba installed.

$sudo apt-get install samba

Because we are going to make samba security insecure, make sure only your local network can access samba service. To do so, open and edit /etc/samba/smb.conf

$sudo vi /etc/samba/smb.conf

and set interfaces to lo and your local network interface. In my case: eth1.

interfaces = lo eth1
bind interfaces only = true

Now, it is time to smoothen samba default security by changing the security variable: security and make sure it is set to share instead of user and that guest account is enabled:

security = share
...
...
guest account = nobody

Now, we can create a share to be accessible to guest users:

[Guest Share]
        comment = Guest access share
        path = /path/to/dir/to/share
        browseable = yes
        read only = yes
        guest ok = yes

You can now test that your configuration is good using testparm:

$ testparm

If everything is fine, it is time to reload samba service to have your new configuration taken into account:

$sudo /etc/init.d/samba reload

That's it, anybody in your LAN can now access your share.


another important thing

you should check that your firewall accepts calls from the samba ports!

Messed up conf

I kind of messed up my smb.conf file (running kubuntu 7.04) so I was wandering if you would be kind enough to post the resulting smb.conf file so I could detect the changes. Needless to say the part about the shares is not needed if you dont want to post it.

Best way

The best way to get the original settings will be to:

# cd /etc/samba
# mv smb.conf smb.confmessedup
# apt-get install samba --reinstall

Debuntu

Not working in ubuntu 6.10

Ok I followed the steps religiously that were stated above...
And it still asks me for a password when logging on from remote computer, or my XBMC (Xbox Media center)
It lists the Directories that i share, but whenever i try to access them it asks for a password.

When i was using Mandriva this failed to be an issue....
Kinda don't want to go back to Mandriva, but also don't want to have to worry about setting up passwords and smbusers

My smb.conf

**************************************************************

[global]

workgroup = MSHOME
server string = %h server (Samba, Ubuntu)
dns proxy = no
interfaces = lo eth0
bind interfaces only = true
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = share
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
guest account = nobody
invalid users = root
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n *password\supdated\ssuccessfully* .

[Media]
comment = Full Access Media Share
path = /media/Media
browseable = yes
read only = yes
guest ok = yes
[ISOS]
comment = ISO Files for writing to CD/DVD
path = /media/ISOS
browseable = yes
read only = yes
guest ok = yes
[Video_Drive]
comment = Archived Video Files Drive
path = /media/Video_Drive
browseable = yes
read only = yes
guest ok = yes

********************************************************************

Help would be sincerely appreciated

mybe You can add ...

maybe u can add a line 'available = yes' like this

-------------------------------
[Folder Name]
path = /var/cache/apt/archives
comment = Installer
browseable = yes
read only = yes
guest ok = yes
available = yes
-------------------------------

hope can help u...

Nevermind. My problem was

Nevermind.
My problem was those drives had umask and gid on the drives at mount time fixed that and now i have full access without passwords

I got it to kinda work

I went through the above steps. Everything worked fine. My Windows PC can see the share, but I'm not allowed to write anything to the shared folder from my Windows PC, it says I don't have permission. But in my sbm.conf file I have:

[Share]
path = /home/folder/Share
available = yes
browsable = yes
public = yes
writable = yes
guest ok = yes
read only = no

I checked the samba log for that Windows PC and this is what it showed:
[Date time] lib/util_sock.c:get_peer_name(1184)
Gethostbyaddr failed for 192.168.0.3
[Date time] smbd/service.c:make_connection_snum(693)
192.168.0.3 (192.168.0.3) connect to service Share initially as user nobody (uid=65534, gid=65534) (pid 4781)
[Date time] smbd/ipc.c:api_fd_reply(290)
api_fd_reply: INVALID PIPE HANDLE: 7482

Can you help? Be semi-detailed in an answer, I'm still kinda new to this stuff.

Thanks!

mkdir /home/folder/Share/ip

mkdir /home/folder/Share/ip of yourmachine
mkdir /home/folder/Share/ip of yourmachine/Share

Set "ip of yourmachine" to correct one, or do strace on smbd.

I don't know how, but this helped when i had this problem.
I did strace on smbd and it wanted stat64() on this dir, so I created it, and it works fine.
Really don't ask me WHY ;)

user permission

By default guest user is ran as user "nobody" on the remote machine.
You want to make sure that user "nobody" can write to /home/folder/Share on the machine running samba.
Mind that you can also change samba guest user by overriding the value of guest account in /etc/samba/smb.conf
Debuntu