SAMBA
Installation
_$: apt-get install samba samba-common
Server configuration
_$: mkdir /srv/samba
/etc/samba/smb.conf:
--------------------
...
[global]
workgroup=WORKGROUP
security=user
...
### Samba configuration
[samba]
path=/srv/samba
guest ok=no
read only=no
writable=yes
browsable=yes
comment=SMB share
Comment out the [homes]
section in /etc/samba/smb.conf
if is not already done.
_$: adduser wintenfox
_$: smbpasswd -a wintenfox
_$: smbpasswd -e wintenfox
_$: /etc/init.d/samba restart
_$: service smbd restart
_$: chmod u+rwx,g+rx,o+rx /srv/samba
_$: chown <sambauser>:<sambauser> /srv/samba
iptables
Open the 137
, 138
and 139
TCP and UDP ports.
*filter
...
-A INPUT -p tcp -m state --state NEW -m tcp --dport 137 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 137 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 138 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 138 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 139 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 139 -j ACCEPT
...
-A INPUT -j DROP
COMMIT
Test
(user@client)_$ smbclient -L 192.168.1.192
Enter <user>´s password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
samba Disk SMB share
IPC$ IPC IPC Service (samba server)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
Server Comment
--------- -------
SAMBA samba server
Workgroup Master
--------- -------
WORKGROUP SAMBA
(user@client)_$: echo "ASD" > a
(user@client)_$: smbclient -U <sambauser> //192.168.1.192/samba
Enter <sambauser>´s password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
smb: \> put a
putting file a as \a (2.0 kb/s) (average 2.0 kb/s)
Ubuntu host in graphical mode
From gnome-places
a) Folder /samba
- Server:
192.168.1.192
- Type:
windows share
- Share:
<empty>
- Folder:
/samba
- Domain name:
WORKGROUP
- User name:
<sambauser>
- Password:
<sambapassword>
b) Share /samba
- Server:
192.168.1.192
- Type:
windows share
- Share:
/samba
- Folder:
<empty>
- Domain name:
WORKGROUP
- User name:
<sambauser>
- Password:
<sambapassword>
Windows host:
From the file explorer connect to \\192.168.1.192\samba
- User:
<sambauser>
- Password:
<sambapassword>