Categories
Filesharing

Samba v3.2.15 (4/4) – smb.conf for mac specific veto files

smb.conf (macports)

/opt/local/etc/samba3/smb.conf

Example (untested)

[global]
 ...
[shared]
 comment = My shared files
 path = /data/shared
 ...
 veto files = /.AppleDB/.AppleDouble/.AppleDesktop/.AppleDBcnid.lock/:2eDS_Store/Network Trash Folder/Temporary Items/TheVolumeSettingsFolder/.@__thumb/.@__desc/.DS_Store/
 delete veto files = true  ...

For Details see http://forum.qnapclub.de/viewtopic.php?f=27&t=5001#p27650

Links

http://www.webdomination.de/2011/03/appledouble-und-andere-mac-spezifischen-dateien-auf-einer-samba-freigabe-ausblenden/

 

Categories
Filesharing

org.samba.smbd.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <dict>
                <key>Label</key>
                <string>org.samba.smbd</string>

                <key>ProgramArguments</key>
                <array>
                        <string>/opt/local/sbin/smbd</string>
                        <string>-D</string>
                </array>

                <key>RunAtLoad</key>
                <true/>

                <key>KeepAlive</key>
                <dict>
                       <key>SuccessfulExit</key>
               <false/>
                </dict>
         </dict>
</plist>
Categories
Filesharing

org.samba.nmbd.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <dict>
                <key>Label</key>
                <string>org.samba.nmbd</string>

                <key>ProgramArguments</key>
                <array>
                        <string>/opt/local/sbin/nmbd</string>
                        <string>-D</string>
                </array>

                <key>RunAtLoad</key>
                <true/>

                <key>KeepAlive</key>
                <dict>
                       <key>SuccessfulExit</key>
               <false/>
                </dict>

         </dict>
</plist>
Categories
Filesharing Unexpected behaviour

smbd and nmbd daemons stop working unexpectedly

Problem
Samba services were started automatically when the server is powered on.
But after some time, the Samba services are not running any more.

Cause
Unknown.
smbd and nmbd daemons stopped working unexpectedly.
pgrep smbd and pgrep nmbd return no process id
What does the log say? See /opt/local/var/log.smbd and log.nmbd

Solution
Unknown.

Workaround
Restart the services manually

sudo launchctl start org.samba.nmbd; sudo launchctl start org.samba.smbd

Hint
Maybe adding a “keep alive” option in the org.samba.smbd.plist / org,samba.nmbd.plist will help?

                <key>KeepAlive</key>
                <dict>
                       <key>SuccessfulExit</key>
               <false/>
                </dict>

Beware:
Use SuccessfulExit = false!
So samba services only gets restarted in case of an unexpected error.
Otherwise, you’ll get a loop, when launchd is restarting samba over and over again.

Categories
Filesharing System

launchctl – Start / Stop services

Start/Stop the apache service

$ sudo launchctl start|stop org.apache.httpd

Start/Stop the samba service

$ sudo launchctl start|stop org.samba.nmbd
$ sudo launchctl start|stop org.samba.smbd

List all services

$ sudo launchctl list

Find the name of a service

$ sudo launchctl list|grep samba
-    0    org.samba.smbd
-    0    org.samba.nmbd

List info about one service

$ sudo launchctl list org.samba.smbd
 {
    "Label" = "org.samba.smbd";
    "LimitLoadToSessionType" = "System";
    "OnDemand" = true;
    "LastExitStatus" = 0;
    "TimeOut" = 30;
    "ProgramArguments" = (
                           "/opt/local/sbin/smbd";
                           "-D";
                          );
 };

Links

Categories
Filesharing

Samba v3.2.15 (3/4) – smb.conf for “network trash cans”

smb.conf (macports)

/opt/local/etc/samba3/smb.conf

Example

[global]
 ...
[shared]
 comment = My shared files
 path = /data/shared
 ...
 vfs objects = recycle
 recycle:repository = ___recycle___
 recycle:exclude = .DS_Store|._.DS_Store
 recycle:keeptree = yes
 ...

For Details see http://www.samba.org/samba/docs/man/Samba3-HOWTO/VFS.html#id2651247

Categories
Filesharing

Samba v3.2.15 (2/4) – smb.conf for “security=SHARE”

smb.conf (macports)

/opt/local/etc/samba3/smb.conf

Example

[global]
   workgroup = WORKGROUP
   server string = Samba OS X Lion
   security = share

   # ---------------------------------------------------------
   # Create all files and folders as this user/group
   # ---------------------------------------------------------
   # Hint:
   #    This only works for users without root privileges!
   # ---------------------------------------------------------
   force user = foo
   force group = staff

   # ---------------------------------------------------------
   # Misc
   # ---------------------------------------------------------
   dns proxy = no
   load printers = no

[shared]
   comment = shared
   path = /data/shared
   public = yes
   only guest = yes
   writable = yes
   printable = no

More examples: http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/FastStart.html#anon-rw

Result

  • The new share is now available in the finder.
  • There is no need to log in as a special user, the guest user will be used instead.

Troubleshooting

Hint #1
Make sure, the user “foo” has no root privileges on your lion server.
Why? Samba will not allow access for root users.

force user = foo
force group = staff

Hint #2
Simple starting & stopping of smbd and nmbd while tailoring your smb.conf
See man smbd and man nmbd for details.

$ sudo /opt/local/sbin/nmbd -i -debuglevel=2
$ sudo /opt/local/sbin/smbd -F -S --debuglevel=2

Hint #3
Do not start smbd as root in interactive mode. It will not work. See hint #1.

$ sudo /opt/local/sbin/smbd -i

Hint #4
Add/enable/no pw for forced user with smbpasswd? Not sure about that one…

$ sudo smbpasswd –a foo
$ sudo smbpasswd –e foo
$ sudo smbpasswd –n foo

See man smbpasswd for details



Categories
Filesharing

Samba v3.2.15 (1/4) – Install Samba via macports

Install

Configure

Create plists for launchd

Tell launchd to process the files (when system is booted the next time)

  • $ sudo launchctl load /Library/LaunchDaemons/org.samba.smbd.plist
  • $ sudo launchctl load /Library/LaunchDaemons/org.samba.nmbd.plist

Starting/Stopping via launchctl (manually)

Categories
Filesharing Lion Server Unexpected behaviour

Apple replaced Samba with SMBX

Problem

I have been using custom sharing by configuring /etc/smb.conf in earlier Mac OS X. But I cannot find any user-configurable file for this custom sharing in 10.7 Lion.
Is there a method for this purpose in Mac OS X 10.7 Lion?
http://forums.macrumors.com/showthread.php?t=1155665

Cause
Apple has removed it.
All Configuration is to be done via the server.app GUI.

Solution
None

Workaround
Install Samba via macports

Links

Categories
Filesharing Unexpected behaviour

No “Trash” with Network Share over AFP

Problem
When a user tries to delete a file from the shared folder from one of the clients, it deletes immediately and does not go through the OS X “Trash” system.

Cause
The network trash cans went away when AFP 3 came in. Local files still get sent to .Trashes but it is no longer possible to do anything but delete files immediately with network shares.

Solution
None

Workaround

Links