If you need an fast, easy, smal-footprint (RAM and DISK) windows filesharing server without max-clients limit (Windows 7 Pro the maximal number of connections is 20) this is for you.
i would say 512MByte RAM is more than enough for such a server. (it is currently using like 100MByte out of 1024MByte possible)
1. get minimal iso Debian Netinst-CD-Image
2. follow the ascii-grafical setup
… i recommend you to stick with ext3 for the next 3-4-5 years until ext4 is not selfdestructing on fsck. (fuck the speed, we need secure, reliable systems)
3. software package wise: You will not need anything, deselect all packages (unless you want a grafical desktop… best is gnome or lxde i guess… )
4. after you selected to not participate in the package-popularity contest and selected grub to install on /dev/sda the system will reboot and you can login.
5. now i would install 3x basic apps
apt-get update; # upgrade package definitions (probably not necessary) apt-get install ssh rsync vim htop; # install ssh, rsync, vim and htop
htop is nice to minitor the resources of your server…
6. network config, you probably want your server to have a fixed ip (not dhcp, the ip keeps changing, unreliable) so ping whatever is in your range and find out if this ip is not taken,
vim /etc/network/interfaces; # edit network config file
modify like this
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface allow-hotplug eth0 # iface eth0 inet dhcp iface eth0 inet static address 192.168.0.123 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 192.168.0.1
7. ssh: in order to login i will weaken security because this is an INTRANET server NOT connected to the internet.
For security reasons ONLY use ssh-keys to connect to your server via internet.
vim /etc/ssh/sshd_config; # edit ssh config PermitRootLogin yes
8. reboot the system and ping it from some client to see if things work…
9. now you can use (under windows) putty to login to your server for easier copy and pasting of commands (r-click into putty window to paste into it)
10. setup users
adduser username; # adds a user to the linux system, those users will also be allowed to connect (have the same username and password on windows as on linux) smbpasswd -a username; # set smb-password (should be same as on clients)
11. setup shares
apt-get install samba; # install samba, the windows-filesharing software mkdir /shares; # create a folder that contains shares mkdir /shares/transit; # create a folder to share chown -R username:username /shares/transit/; # asign owner to user username cp /etc/samba/smb.conf /etc/samba/smb.bak; # make a copy of the original samba config, just in case one messes up vim /etc/samba/smb.conf; # edit the config and go to the very end
[username] comment = "private files only accessable to username" path = /shares/username browseable = yes read only = no valid users = username create mask = 0755 [transit] comment = "share accessable to everybody" path = /shares/transit browseable = yes read only = no create mask = 0777
12. search config again for workgroup and modify accordingly (Windows-Clients should be in the Same Workgroup)
#======================= Global Settings ======================= [global] ## Browsing/Identification ### # Change this to the workgroup/NT-domain name your Samba server will part of workgroup = WORKGROUP
reboot your server and try to connect with a windows client like this:
… if you have a local user „username“ with the same password as on the linux-fileserver… you should be immediately be granted access to your share.
13. paranoia tweaks: in order to enshure filesystem consistancy over a long time, let’s reboot the server every week and
vim /etc/rc.local; # this file is executed on every boot
before exit 0 put this:
# By default this script does nothing. touch /forcefsck; # force filesystem check on every boot exit 0
14. modify crontab to reboot every first sunday of month
crontab -e; # edit crontab
add this line at the end
00 09 * * 7 [ $(date +\%d) -le 07 ] && /scripts/reboot.sh # first sunday of every month reboot, check filessytem etc.
create the script:
mkdir /scripts; vim /scripts/reboot.sh;
fill with this content:
#!/bin/bash echo $(date) >> /scripts/reboot_last.txt; # record time of last reboot to check if its working touch /forcefsck; # force filesystem check on every boot shutdown -r +0
make script executable:
chmod u+x /scripts/reboot.sh
CONGRATULATIONS! YOU JUST FREED YOURSELF A LITTLE BIT MORE FROM WINDOWS SERVER, BILL GATES & CO.
last tweaks (optional):
enable ll and make it colorful
echo 'alias ll="ls -lah --color"' >> /etc/bash.bashrc; # add because otherwise ll is not available and not colorful
give example on login prompt how to add users/share
and paste this:
______ _ _ _____ | ____(_) | / ____| | |__ _| | ___| (___ ___ _ ____ _____ _ __ | __| | | |/ _ \\___ \ / _ \ '__\ \ / / _ \ '__| | | | | | __/____) | __/ | \ V / __/ | |_| |_|_|\___|_____/ \___|_| \_/ \___|_| ============================= ====== smb users: ==== add user: 1. add linux user adduser username 2. add smbuser smbpasswd username 3. create shared folder mkdir /shares/username chmod 0755 /shares/username chown username:username /shares/username 4. put entry into /etc/smb.conf check out existing entries for inspiration 5. reboot server =============================