the best about samba: hint: this guide is a bit old but (should) still work with Debian 10 (untested!)
thanks for samba, it provides users with a fast (of course depends also on harddisk speed) rock-solid no-limit-to-maximum-users file-server for maximum file-transfer-and-sharing-and-storage productivity (and they will USE that T: temp drive for EVERYTHING! prepare for TERRABYTES OF DATA!)
best hint ever: if there is an errors while smb mounting!
like “Mounting cifs drive gives: mount error(22): Invalid argument”
have a separate root-terminal open that is running this “debug the logs live” script
https://dwaves.de/2017/06/15/linux-monitor-all-logs-in-real-time-d-follow-all-show-changes-to-log-files-under-varlog/
If the user needs an fast, easy, smal-footprint (RAM and DISK) windows-clients-compatible filesharing-server without max-clients limit (Windows 7 Pro the maximal number of connections is 20) this is what the user has been looking for.
Would say min RAM can be as little as 512MB, but more is (of course) always better because GNU Linux is very efficiently using RAM for maximum-file-caching (making accessing the same file over and over again VERY FAST because it is RAM cached).
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,
ping 192.168.0.123
was free.
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
it is not that hard check it out:
https://dwaves.de/2017/05/05/gnu-linux-ssh-generate-public-private-keys-of-8192bits-length/
# it is not necessary anymore to enable root login via ssh
# instead ssh-login-with-non-root-user and then go
su - root
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 -v /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
search for:
[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 on old versions of GNU Linux Debian
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
# mark script executable
# test it
chmod u+x /scripts/reboot.sh
test connecting with a windows client
if it works:
CONGRATULATIONS!
the admin-user just created a file-server that can be very very usefull for teams to work with.
dance dance dance! (10min of shuffeling)
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
vim /etc/issue
and paste this cool ASCII logo (or generate own here (from text) or here (from picture)
together with a little documentation, what needs to be done to add new users and shares:
______ _ _ _____ | ____(_) | / ____| | |__ _| | ___| (___ ___ _ ____ _____ _ __ | __| | | |/ _ \\___ \ / _ \ '__\ \ / / _ \ '__| | | | | | __/____) | __/ | \ 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 =============================
have phun!
links:
https://www.thomas-krenn.com/de/wiki/Einfache_Samba_Freigabe_unter_Debian
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!
