Friday, August 7, 2009

Sharing a Directory with a Windows PC

It's rather easy (see, for example, this thread at the Ubuntu forums):
  1. install samba:
    aptitude install samba
  2. open /etc/samba/smb.conf for editing
  3. add a stanza similar to the following:
    [files]
    comment = Shared Files
    path = /path/to/shared/files
    browseable = yes
    read only = yes
    valid users = user
  4. save the file
  5. run testparm to verify that the new configuration is valid
  6. add the specified user to samba like this (you'll be prompted fro a password):
    smbpasswd -a user
    (note that the default settings require that this user be a valid Linux user on the machine where the samba daemon is running)
  7. restart the server:
    invoke-rc.d samba restart
  8. you should now be able to access this directory from a Window$ machine as \\computer-name-or-ip\files after providing the specified user's user name and samba password

Happy sharing.

[09 Aug 2009] UPDATE: if you're running a firewall (and you probably should) you'll need to configure it to accept incoming/outgoing SMB traffic.

I use shorewall, and I had to add these lines to /etc/shorewall/rules and then restart the firewall:
SMB/ACCEPT  $FW      loc
SMB/ACCEPT loc $FW

Note that this rule opens a lot of ports - you should only allow SMB traffic between hosts you fully trust.

No comments:

Post a Comment