IInstallation de Samba sous Ubuntu 18.04 / Accès avec Qemu.
I/ Ordinateur hôte.
Liens :
https://vitux.com/how-to-install-and-configure-samba-on-ubuntu/
https://www.fosslinux.com/8703/how-to-setup-samba-file-sharing-server-on-ubuntu.htm
1/ Installation du serveur Samba.
$ sudo apt install samba
2/ Vérification.
$ sudo systemctl status nmbd
● nmbd.service - Samba NMB Daemon
Loaded: loaded (/lib/systemd/system/nmbd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-03-02 22:26:21 CET; 10min ago
Docs: man:nmbd(8)
man:samba(7)
man:smb.conf(5)
Main PID: 4382 (nmbd)
Status: "nmbd: ready to serve connections..."
Tasks: 1 (limit: 4584)
CGroup: /system.slice/nmbd.service
└─4382 /usr/sbin/nmbd --foreground --no-process-group
mars 02 22:26:21 station66 systemd[1]: Starting Samba NMB Daemon...
mars 02 22:26:21 station66 systemd[1]: Started Samba NMB Daemon.
3/ Création d’un répertoire de partage.
$ mkdir partage
$ sudo chown -R nobody:nogroup partage/
$ sudo chmod -R 0775 partage/
$ sudo touch partage/public.txt
4/ Configuration du partage.
Ouvrir :
/etc/samba/smb.conf
Ajouter à la fin :
[partage]
comment = Partage
path = /home/util01/partage
read only = no
browsable = yes
writable = yes
guest ok = yes
force user = nobody
5/ Activer un mot de passe pour l’utilisateur courant.
$ sudo smbpasswd -a util01
New SMB password:
Retype new SMB password:
Added user util01.
util01@station66:~$
6/ Création d’un partage privé.
$ sudo mkdir -p partage/util01
$ sudo chown -R root:smbgroup partage/util01
$ sudo chmod -R 0770 partage/util01
$ sudo touch partage/util01/prive.txt
7/ Configuration des autorisations.
$ sudo addgroup smbgroup
$ sudo usermod -aG smbgroup util01
8/ Ajout du partage privé.
Ouvrir :
/etc/samba/smb.conf
Ajouter à la fin :
[util01]
path = /home/util01/partage/util01
valid users = @smbgroup
guest ok = no
writable = yes
browsable = yes
9/ Redémarrer le service Samba.
$ sudo systemctl restart smbd.service
II/ Ordinateur invité.
1/ Installation du client Samba.
$ sudo apt install smbclient
2/ Liste des partages.
$ smbclient -L //192.168.1.3/partage
Unable to initialize messaging context
Enter WORKGROUP\util01's password:
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
partage Disk Partage
util01 Disk
IPC$ IPC IPC Service (station66 server (Samba, Ubuntu))
Reconnecting with SMB1 for workgroup listing.
Server Comment
--------- -------
Workgroup Master
--------- -------
WORKGROUP
3/ Connexion au partage publique.
$ smbclient //192.168.1.3/partage
Unable to initialize messaging context
Enter WORKGROUP\util01's password:
Try "help" to get a list of possible commands.
smb: \> ls
. D 0 Mon Mar 2 23:35:59 2020
.. D 0 Mon Mar 2 23:36:28 2020
public.txt N 0 Mon Mar 2 23:35:59 2020
util01 D 0 Mon Mar 2 23:36:20 2020
460440616 blocks of size 1024. 391471368 blocks available
smb: \>
4/ Connexion au partage privé.
$ smbclient //192.168.1.3/util01 -U util01
Unable to initialize messaging context
Enter WORKGROUP\util01's password:
Try "help" to get a list of possible commands.
smb: \> ls
. D 0 Mon Mar 2 23:36:20 2020
.. D 0 Mon Mar 2 23:35:59 2020
prive.txt N 0 Mon Mar 2 23:36:20 2020
460440616 blocks of size 1024. 391463176 blocks available
smb: \>
Comments are closed, but trackbacks and pingbacks are open.