Shell Person Help me keep the shell people alive.

18Mar/100

Lightweight Debian Samba Fileserver

Granny's flowers by Abbie F (C) via Flickr

(The above photo is "Granny's flowers", by Abbie F (C) via Flickr).

This is the lightest way I know of installing a samba fileserver (network fileserver compatible with Windows machines).  This will work for any extremely old machine you may have around.  Once it's set up, you can run it headless (just the tower connected to power and the network; no monitor, keyboard, or mouse).

  1. Download and burn the Debian "netinst" cd image.  You can get it at http://www.debian.org/CD/netinst/.
  2. Boot the computer from the netinst disk.  You can follow most of the defaults in the installation.  Obviously you'll want to make note of any user names, passwords, host names, etc. that you choose.  When you get to the Select and Install software section, de-select everything (no Desktop Environment, no Standard System, or whatever they're calling it -- nothing).
  3. Once it's installed, login.  This will be a text-only login, nothing fancy.
  4. mkdir ~/shared
  5. su (then enter your password) (this makes you the super user, AKA root).
  6. apt-get update && apt-get dist-upgrade
  7. apt-get install samba
  8. cd /etc/samba
  9. cp smb.conf smb.conf.original
  10. vim smb.conf (or you can use nano if you don't like vim: nano smb.conf)
  11. Erase everything in the file and replace it with the text from my smb.conf file (found below) (make sure you replace YOURUSERNAME with your actual username, and make sure all of the quotes are straight quotes), then save and close the file.
  12. /etc/init.d/samba restart
  13. smbpasswd -a YOURUSERNAME (and enter the password you want to use when asked)

Here's my smb.conf file.  Other than changing the YOURUSERNAME to your actual user name, most users won't need to make any changes (there are a few exceptions though).  Make sure all of the quotes are "straight" quotes, as WordPress likes replacing them with "smart" quotes, which breaks stuff (you are seriously going to have to replace those quotes).

[global]
server string = Fileserver
interfaces = 127.0.0.0/8, eth0
bind interfaces only = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
smb ports = 139
load printers = No
printcap name = /dev/null
disable spoolss = Yes
show add printer wizard = No
panic action = /usr/share/samba/panic-action %d
printing = bsd
print command = lpr -r -P'%p' %s
lpq command = lpq -P'%p'
lprm command = lprm -P'%p' %j
[files]
comment = Shared files
path = /home/YOURUSERNAME/shared
force user = YOURUSERNAME
force group = YOURUSERNAME
read only = No
create mask = 0775
directory mask = 0775

That's it.  You can access the fileserver from a Windows machine by typing \\THEHOSTNAMEYOUPICKED and entering your username and the password you selected in the "smbpasswd" step.  I usually also install ssh and set up a static IP address, but that's beyond the scope here.  Feel free to mention any problems, omissions, errors, and security flaws.

Filed under: tech Leave a comment