1 2 |
# apt-get install samba # apt-get install samba-client |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#vi /etc/samba/smb.conf [global] workgroup = WORKGROUP server string = Samba Server %v netbios name = OPI security = user map to guest = bad user dns proxy = no hosts allow = 192.168.0.0/255.255.255.0 hosts deny = all interfaces = eth0 socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536 [Downloads] comment = Downloads read only = no locking = no path = /home/user/Downloads guest ok = no |
Add Samba users
Samba uses it’s own password system so users need to be added by root. Note that the users have to exist in /etc/passwd
1 2 |
# smbpasswd -a me # smbpasswd -a you |
You will be prompted for a password for each of those users.
To list existing Samba users:
1 |
# pdbedit -w -L |
Restart the Samba daemon
1 |
# /etc/init.d/samba restart |
or, if you are using systemd
1 |
# /usr/sbin/service smbd restart |
Try to access the shares (as a normal user)
Try locally first, then from another machine on the network which also installed samba client. When prompted, use the password entered when adding the user to Samba.
To access my share:
1 |
$ smbclient //ourmachine/me |
To access your share:
1 |
$ smbclient -U you //ourmachine/you |
To access our shared(!) share:
1 |
$ smbclient //ourmachine/ourfiles |
#https://wiki.debian.org/SambaServerSimple
mount smb dir from remote machine:
1 |
sbin/mount.cifs //192.168.1.99/films /mnt/smbsrv/films -o username=USERNAME(,password=PASSWORD) |
Второй вариант без авторизации.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<strong>% cat /etc/samba/smb.conf</strong> [global] workgroup = 9_3 server string = buk hosts allow = 127. 10. 192.168. netbios name = buk usershare allow guests = yes security = user map to guest = Bad User guest account = root [share] comment = share read only = no writable = yes locking = no path = /home/user guest ok = yes browseable = yes public = yes #printable = no guest only = yes |