Partage Samba
Environnement de travail :
…
Manipulations :
--- --- Samba File Server ---
---
root@serveur:~# apt-get install samba ...
Paramétrage de samba-common (2:3.5.6~dfsg-3squeeze8) ...
Creating config file /etc/samba/smb.conf with new version Paramétrage de update-inetd (4.38+nmu1+squeeze1) ...
Paramétrage de samba (2:3.5.6~dfsg-3squeeze8) ...
Generating /etc/default/samba...
...
Importing account for nobody...ok Importing account for user...ok
Ajout du groupe « sambashare » (GID 107)...
Fait.
update-alternatives: utilisation de « /usr/bin/smbstatus.samba3 » pour fournir
« /usr/bin/smbstatus » (smbstatus) en mode automatique.
Starting Samba daemons: nmbd smbd.
Paramétrage de samba-common-bin (2:3.5.6~dfsg-3squeeze8) ...
update-alternatives: utilisation de « /usr/bin/nmblookup.samba3 » pour fournir
« /usr/bin/nmblookup » (nmblookup) en mode automatique.
update-alternatives: utilisation de « /usr/bin/net.samba3 » pour fournir
« /usr/bin/net » (net) en mode automatique.
update-alternatives: utilisation de « /usr/bin/testparm.samba3 » pour fournir
« /usr/bin/testparm » (testparm) en mode automatique.
--- a ---
root@serveur:~# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384) Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
obey pam restrictions = Yes pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:*
%n\n *password\supdated\ssuccessfully* . unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m max log size = 1000
dns proxy = No
panic action = /usr/share/samba/panic-action %d [homes]
comment = Home Directories valid users = %S
create mask = 0700 directory mask = 0700 browseable = No
[printers]
comment = All Printers path = /var/spool/samba create mask = 0700 printable = Yes browseable = No [print$]
comment = Printer Drivers path = /var/lib/samba/printers
root@serveur:~# testparm | wc -l
Load smb config files from /etc/samba/smb.conf
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384) Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions 30
root@serveur:~# testparm -v | wc -l
Load smb config files from /etc/samba/smb.conf
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384) Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions 388
root@serveur:~# cat /etc/samba/smb.conf | wc -l 325
--- a ---
root@serveur:~# cat /etc/samba/smb.conf [global]
...
# Change this to the workgroup/NT-domain name your Samba server will part of workgroup = WORKGROUP
...
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server.
# security = user ...
root@serveur:~# nano /etc/samba/smb.conf root@serveur:~# cat /etc/samba/smb.conf [global]
...
# Change this to the workgroup/NT-domain name your Samba server will part of workgroup = WORKGROUP
...
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server.
security = user ...
--- a ---
root@serveur:~# nano /etc/samba/smb.conf ---> ajout à la fin
[partage]
comment = Partage de fichier avec SAMBA path = /srv/samba/partage
browsable = yes guest ok = yes read only = no create mask = 0755
--- a ---
root@serveur:~# mkdir -p /srv/samba/partage
root@serveur:~# chown nobody.nogroup /srv/samba/partage root@serveur:~# /etc/init.d/samba restart
Stopping Samba daemons: nmbd smbd.
Starting Samba daemons: nmbd smbd.
--- a ---
root@serveur:~# echo "bonjour ..." > /srv/samba/partage/f.txt root@serveur:~# ls -l /srv/samba/partage/
total 4
-rw-r--r-- 1 root root 12 19 nov. 15:27 f.txt
--- smbclient --- --- a ---
root@client:~# apt-get install smbclient ...
--- a ---
root@client:~# smbclient -L 192.168.56.101 -U nobody Enter nobody's password:
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.6]
Sharename Type Comment --- ---- ---
IPC$ IPC IPC Service (serveur server) partage Disk Partage de fichier avec SAMBA print$ Disk Printer Drivers
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.6]
Server Comment
--- ---
SERVEUR serveur server Workgroup Master
--- --- WORKGROUP HEDI-LAPTOP
--- a ---
root@client:~# smbclient \\\\192.168.56.101\\partage -U nobody Enter nobody's password:
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.5.6]
smb: \> help
? allinfo altname archive blocksize cancel case_sensitive cd chmod chown
close del dir du echo
exit get getfacl hardlink help
history iosize lcd link lock
lowercase ls l mask md
mget mkdir more mput newer
open posix posix_encrypt posix_open posix_mkdir posix_rmdir posix_unlink print prompt put
pwd q queue quit readlink
rd recurse reget rename reput rm rmdir showacls setmode stat symlink tar tarmode translate unlock volume vuid wdel logon listconnect showconnect .. !
smb: \> ls
. D 0 Mon Nov 19 15:27:11 2012
.. D 0 Mon Nov 19 15:03:35 2012
f.txt 12 Mon Nov 19 15:27:11 2012
61467 blocks of size 131072. 52527 blocks available
---
root@serveur:~# smbstatus Samba version 3.5.6
PID Username Group Machine
--- Service pid machine Connected at
--- partage 1970 client Mon Nov 19 15:53:57 2012 No locked files
root@serveur:~#
--- smb: \> get f.txt
getting file \f.txt of size 12 as f.txt (0,5 KiloBytes/sec) (average 0,5 KiloBytes/sec)
smb: \> quit
root@client:~# ls f.txt
root@client:~# cat f.txt bonjour ...
root@client:~#
--- a ---
root@client:~# apt-get install smbfs Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
libopenraw1 libbabl-0.0-0 libwpg-0.1-1 libplot2c2 pstoedit libgee2 libmagick++3 libgimp2.0 gimp-data perlmagick libmng1 libpstoedit0c2a Veuillez utiliser « apt-get autoremove » pour les supprimer.
Les paquets supplémentaires suivants seront installés : cifs-utils
Les NOUVEAUX paquets suivants seront installés : cifs-utils smbfs
0 mis à jour, 2 nouvellement installés, 0 à enlever et 0 non mis à jour.
....
---> avec Iceweasel (firefox) smb://192.168.56.101/partage/
affiche les résultats
--- a ---
root@serveur:~# smbpasswd -a user New SMB password: MPSamba
Retype new SMB password: MPSamba
Password: MPSamba root@client:~# mount ...
//192.168.56.101/partage/ on /mnt/partage type cifs (rw,mand)
A VERIFIER
--- --- a ---
le home est accessible par défaut? OUI, ça doit être le premier exemple root@client:~# mkdir /mnt/user
root@client:~# smbmount //192.168.56.101/user/ /mnt/user -o username=user Password:
root@client:~# ls /mnt/user/
root@client:~# ls ...
root@client:~#
---
root@serveur:~# testparm
Load smb config files from /etc/samba/smb.conf ...
[homes]
comment = Home Directories valid users = %S
create mask = 0700 directory mask = 0700 browseable = No
...
root@serveur:~#
--- Deux partage : public-ro & public-rw (pas de guest)
--- autres:
AVEC nautilus ça marche:
menu -> se connecter à un serveur -> partage windows -> ...
MAIS
hedi@client:~$ smbclient //192.168.56.101/user/ -o username=user session setup failed: NT_STATUS_LOGON_FAILURE
hedi@client:~$ smbclient \\\\192.168.56.101\\user -o username=user session setup failed: NT_STATUS_LOGON_FAILURE
hedi@client:~$ smbmount //192.168.56.101/user/ /home/hedi/partage -o username=user