1) Download and install Samba:
apt-get install samba samba-common
2) Backup samba.conf:
cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
3) Edit samba.conf:
nano /etc/samba/smb.conf
Replace all with and edit it to your wishes:
[global]
workgroup = arbeitsgruppe
server string = %h server (Samba %v)
log file = /var/log/samba/log.%m
max log size = 1000
encrypt passwords = true
invalid users = root
socket options = TCP_NODELAY
security = user
unix extensions = yes
[homes]
comment = Home Directories
browseable = no
valid users = %S
writable = yes
create mode = 0600
directory mode = 0700
4) Create a samba user:
adduser --disabled-login --shell /bin/false --home <home path - ex. /mnt/seagate> <username>
Add user to samba:
smbpasswd -a <username>
5) Restart samba:
service samba restart or /etc/init.d/samba restart
6) Add samba to windows:
Pictured description will be found on this site (german).
Briefly: Add \\<local or external ip>\<username>
to your windows file explorer.
IMPORTANT:
You can't mount two same devices with different shares in windows file explorer. For example:
\\192.168.1.35\<username1 or share1> and \\192.168.1.35\<username2 or share2>
If you add share2
the windows explorer thinks that there's already a connection (via share1
), but you think the username or password on the samba-server is wrong. No it's a windows-client problem!
To solve it, you need to use netbios alias
.
For example:
[global]
[..]
netbios aliases = alias1 alias2 alias3
[..]
So use this:
\\alias1\<username1 or share1> and \\alias\<username2 or share2>
instead of this:
\\192.168.1.35\<username1 or share1> and \\192.168.1.35\<username2 or share2>
Commands:
$ testparm Test samba configuration
$ pdbedit -L Show all vaild samba users
$ pdbedit -x -u <user> Remove user
$ smbpasswd -a <user> Add user to vaild samba users / Give password
$ smbpasswd -d <user> Remove user from vaild samba users
$ service samba restart Restart samba