Smokes your problems, coughs fresh air.

Tag: samba (Page 1 of 2)

Configuring a Samba share with unix extensions which all users can write to

Because the unix permission model sucks, it is very hard to have a shared directory where everybody has full access to each others files. The same is true when making a shared samba archive. Luckily, samba has forcing options.

[archief]
  comment = save stuff here
  path = /path
  guest ok = yes
  writeable = yes
  browseable = yes
  force user = samba
  force group = samba
  create mask = 0660
  force create mode = 0660
  directory mask = 0770
  force directory mode = 0770

The key here is the force modes.

Upgrading Samba from Lenny-backports

For some reason, after upgrading to the Samba version from Lenny-backports I needed to support Windows 7 profiles, the workstations suffered from severe problems. The entire profile seemed to be read-only, even though they weren’t on disk. I couldn’t change any setting and reverting profile configuration from backups didn’t help. In the end, the only thing that fixed it was recreating the user profile, both server and client side. This was an upgrade from 3.2.5 to 3.4.7.

Another issue I had is that the user database got a new backend and all the users were gone. You can import your existing smbpasswd file with pdbedit.

So, when doing this again, be sure to make workstation and server backups.

Preventing the creation of $RECYCLE.BIN on Samba shares by Windows 7

Windows 7 kept creating a $RECYCLE.BIN dir on the network share. This in itself is merely annoying, but there were also errors resulting from it. Whenever a file would be deleted, this message would appear (translated from dutch): “The recycle bin is damaged, do you want to delete the contents?” Everything froze until that question was answered.

Samba has an option “veto files” which can be used to stop the creation of that directory. Put this in each share’s section in your smb.conf:

veto files = /*$RECYCLE.BIN/ 

The slashes are not directory separators in this case. Also, I don’t know if the preceeding * is necessary, but it does no harm.

Migrating user accounts when upgrading from samba 3.2 to 3.3 or 3.4

Because I wanted to be able to give Windows 7 machines access to our domain controller, I needed to upgrade samba to 3.4 from lenny-backports. Because the database backend changed, a consequence of this was that the user database was empty; it didn’t migrate it.

pdbedit has an option to import the old smbpasswd file:

pdbedit -i smbpasswd:/etc/samba/smbpasswd

That should take care of it. I didn’t test it this way though, because I already fiddled with the user database by creating new users by hand. I imported one user with which I still had problems correctly this way, but I don’t know if importing this database from the start would have prevented all my errors.

Listing samba users

Newer samba versions no longer have a human readable password file. To see the passwords, use pdbedit. Do “pdbedit -w -L” to get a classic password file layout.

Fixing extremely slow domain logon windows 7

I just installed two Windows 7 machines and both of them take a very long time to logon to the (samba) domain controller. I’ve found several reports on the internet about people with the same issue. This was one of the pages I found. I tried it and it works. It says:

  • Run gpedit.msc.
  • Go to computer configuration.
  • Go to Administrative templates.
  • Go to System.
  • Go to User profiles.
  • Enable “Set maximum wait time for the network if a user has a roaming user profile or remote home directory” and set to 0 seconds

You’d think that this means it can’t logon, because it suggests the wait period was because of network connection problem. However, I tried adding files to the profile on the server and logged in, and the file was synced to the PC. So, it does seem to work.

While I was at it, I also changed the setting not to allow logons with temporary profiles. It’s in the same list as the option above. In Dutch, it’s “gebruikers niet aanmelden met tijdelijke profielen”.

I also found this about slow logons. It’s for Windows XP, but perhaps it’s useful. It sets “Always wait for the network at computer startup and logon” to true. For some reason, the asynchronous loading of the network caused slowdown for that person.

Finally, I also found people who fixed slow logons by setting the desktop to an image, as opposed to solid color. I tested it, and indeed seemed to influence it.

Installing Samba from lenny-backports

With our new Windows 7 machines, we need at least samba 3.3.7. However, our server with Debian stable doesn’t have that in its repository. So, I was forced to install samba with lenny-backports.

I included this line in my /etc/apt/sources.list:

deb http://www.backports.org/debian lenny-backports main contrib non-free 

Because backports are disabled by default, I needed to pin all the packages required for samba:

Package: samba
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: smbclient
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: smbfs
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: samba-common
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: samba-common-bin
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: libwbclient0
Pin: release a=lenny-backports
Pin-Priority: 999
 
Package: libtalloc2
Pin: release a=lenny-backports
Pin-Priority: 999

I haven’t actually installed it, but I will soon. So I don’t know if it will work or not. Aptitude -s suggests it does.

Adding a recycle bin to a samba share

People are stupid and remove things accidentally. You can partly mitigate that by adding recycle bin functionality to a samba share.

[Our documents]
  comment = Central storage for all our documents
  path = /home/smb
  guest ok = yes
  writeable = yes
  browseable = yes
  force group = samba
  create mask = 0660
  directory mask = 0770
 
  ; recycler
  vfs object = recycle:recycle
  recycle:subdir_mode = 0770
  recycle:repository = .recycle ; directory name
  recycle:keeptree = Yes
  recycle:touch = Yes
  recycle:versions = No
  recycle:maxsize = 100000000 ; 100 metric million bytes 

The action is hooked on the delete action. Pressing shift-delete won’t prevent files from being moved to the recycler, which is good.

You can then make a cron job which throws away old files:

# Every day at 6am
0 6 * * * root    find /home/smb/.recycle/  f -mtime +5 -delete > /dev/null
« Older posts

© 2024 BigSmoke

Theme by Anders NorenUp ↑