Outils pour utilisateurs

Outils du site


issue207:c_c

This weekend I had a chat with someone who had issues with his media box. Specifically, issues he attributed to SAMBA. When talking to him, I realised he knew very little about SAMBA. He was just expecting it to “work”, but it worked only when his firewall was off. Doing some basic troubleshooting with him, I had my CnC article series for the rest of the year. You see, I used to teach Linux+ and LPIC. Though I think the certification is not worth the price, I do respect it, as it did not have “nonsense” questions. (OK when I wrote it, it did not). The questions were practical, and though there were a few suspect ones, I cannot recall any dumb ones. You know, the type Microsoft uses in their exams; if you have a network in Los Angeles, and a network in Washington, and your Administrator is in Barbados, what color is the CEO’s socks? Let me give you the run-down. If, and this is a big IF, I remember correctly, it was part of LPIC-2. First thing you have to remember is that SAMBA uses port 445. In the old days, it ran on port 139, because of NETBIOS. I would suggest that any student who wishes to pass any IT exam, learn the basic ports by heart. You can use Anki – it works great on Ubuntu to make yourself some flashcards. If you are too lazy to do it, you don’t want the certification badly enough. SAMBA runs over TCP/IP, so no fire and forget. The other thing you must get an understanding of is the OSI model. SAMBA runs at the Application layer. SAMBA is a sort of unifying project, aiming to let Windows and Linux talk to each other. Server and workstation.

Ce week-end, j'ai discuté avec quelqu'un qui avait des problèmes avec sa box multimédia. Plus précisément, des problèmes qu'il attribuait à SAMBA. En discutant avec lui, je me suis rendu compte qu'il ne connaissait pas grand-chose à SAMBA. Il s'attendait simplement à ce que cela « fonctionne », mais cela ne fonctionnait que lorsque son pare-feu était désactivé. En procédant à un dépannage de base avec lui, j'ai eu ma série d'articles C&C pour le reste de l'année. Vous voyez, j'avais l'habitude d'enseigner Linux+ et LPIC. Bien que je pense que la certification ne vaut pas son prix, je la respecte, car elle ne comporte pas de questions « absurdes ». (D'accord, quand je l'ai passé, ce n'était pas le cas.) Les questions étaient pratiques, et bien qu'il y ait eu quelques questions suspectes, je ne me souviens d'aucune question stupide. Vous savez, celles que Microsoft utilise dans ses examens : si vous avez un réseau à Los Angeles et un réseau à Washington, et que votre administrateur est à la Barbade, de quelle couleur sont les chaussettes du PDG ?

Laissez-moi vous expliquer. Si, et c'est un grand SI, je me souviens correctement, cela faisait partie de LPIC-2. La première chose à retenir est que SAMBA utilise le port 445. Autrefois, il fonctionnait sur le port 139, à cause de NETBIOS. Je suggère à tout étudiant qui souhaite réussir un examen informatique d'apprendre par cœur les ports de base. Vous pouvez utiliser Anki - qui fonctionne très bien sur Ubuntu - pour vous faire des flashcards. Si vous êtes trop paresseux pour le faire, c'est que vous ne souhaitez pas suffisamment obtenir la certification. SAMBA fonctionne sur TCP/IP, donc ce n'est pas « je mets en route puis je n'y pense plus ». L'autre chose que vous devez comprendre est le modèle OSI. SAMBA fonctionne au niveau de la couche Application. SAMBA est une sorte de projet unificateur, visant à permettre à Windows et Linux de communiquer entre eux. Serveur et station de travail.

OK, now you take a piece of paper and pull out four facts from that paragraph. What you also need to understand is that SAMBA is not only for file sharing, you can share printers with SAMBA as well. Why? Let’s go one step down and look at SMB (Server Message Blocks). The SMB protocol (“protocol” here is important) requires a response. It will send a request and will wait for a response. Now when we have Windows in the mix, be it workstation or server, you need to read up on CIFS. (Common Internet File Service). A way to remember that the “C” in CIFS stands for common, is to remember that it needs a common way to talk to Linux. Not common as in found everywhere, but common as in shared. One thing to be aware of, if you are using older stuff at home, is that IPV6 should rather be avoided. For work and for the exam, however, know that IPV6 is supported, but only on port 445, here’s that number again. Now CIFS on IPV6 requires the IBM Data Ontap Library v 7.3.x (in other words, 1-onwards) to work. (https://documents.uow.edu.au/~blane/netapp/ontap/upgrade/upgrading/concept/c_oc_upg_revert_ipv6.html). Now with CIFS, there are UDP ports at play, 137 & 138, because of NETBIOS, but you should not get it as an exam question, but keep that info handy. Nine times out of ten, when someone mentions SAMBA, think SMB over TCP. TIP: Just remember that NETBIOS does not support IPV6.

OK, maintenant vous prenez une feuille de papier et vous tirez quatre faits du paragraphe précédent.

Ce que vous devez également comprendre, c'est que SAMBA ne sert pas seulement à partager des fichiers, mais aussi des imprimantes. Pourquoi ? Allons un peu plus loin et examinons le SMB (Server Message Blocks). Le protocole SMB (« protocole » est ici important) exige une réponse. Il envoie une demande et attend une réponse. Lorsque Windows est impliqué, qu'il s'agisse d'une station de travail ou d'un serveur, vous devez vous familiariser avec le CIFS (Common Internet File Service - Service de fichiers Internet communs). Pour mémoriser que le « C » de CIFS signifie commun, il faut se rappeler qu'il a besoin d'un moyen commun pour parler à Linux. Pas commun comme dans « trouvé partout », mais commun comme dans « partagé ». Une chose dont il faut être conscient, si vous utilisez des choses plus anciennes à la maison, c'est que l'IPV6 devrait plutôt être évité. Pour le travail et l'examen, cependant, sachez que l'IPV6 est supporté, mais seulement sur le port 445, voici à nouveau ce numéro. CIFS sur IPV6 nécessite la bibliothèque IBM Data Ontap Library v 7.3.x (en d'autres termes, à partir de 1) pour fonctionner. (https://documents.uow.edu.au/~blane/netapp/ontap/upgrade/upgrading/concept/c_oc_upg_revert_ipv6.html). Avec CIFS, il y a des ports UDP en jeu, les 137 et 138, à cause de NETBIOS, mais cela ne devrait pas être une question d'examen, mais gardez cette information à portée de main. Neuf fois sur dix, lorsque quelqu'un mentionne SAMBA, il pense à SMB sur TCP.

CONSEIL : N'oubliez pas que NETBIOS ne prend pas en charge IPV6.

Here is your reading for this section: https://www.varonis.com/blog/smb-port – don’t worry, it is very short. TIP: If you use SAMBA for LDAP, the port you need to pay attention to is port 389, it is easy to remember, as the RDP port is 3389. Let’s quickly talk about configuring SAMBA. I’ll break it up into a Linux section and a Windows section. Since we are Linux people, let’s talk about Linux configuration first. Here comes the practical part. (what, you didn’t think you could do this as a mind experiment now?). Fire up Virtualbox and install Ubuntu server. https://ubuntu.com/download/server I suggest you also grab the CLI cheat sheet. Just fill the form out with junk and once done, the cheat sheet will download, without you getting spam or your details leaked. Obviously you will put in your own password on the next screen, and “next” through it. You are going to do the same with the configuration, just “Done” through it. Once completed, reboot and log in. Your first order of business is going to be: sudo apt install samba and once done: whereis samba

Voici votre lecture pour cette section : https://www.varonis.com/blog/smb-port - ne vous inquiétez pas, c'est très court.

ASTUCE : Si vous utilisez SAMBA pour LDAP, le port auquel vous devez prêter attention est le port 389. Il est facile à retenir, car le port RDP est 3389.

Parlons rapidement de la configuration de SAMBA. Je vais diviser cela en une section Linux et une section Windows. Puisque nous sommes des Linuxiens, parlons d'abord de la configuration Linux.

Voici la partie pratique. (Quoi, vous ne pensiez pas quand même que vous pouviez faire cela seulement dans votre tête ?) Lancez Virtualbox et installez Ubuntu server. https://ubuntu.com/download/server

Je vous suggère également de vous procurer l'aide-mémoire CLI. Remplissez simplement le formulaire avec des données - n'importe lesquelles - et une fois que c'est fait, l'aide-mémoire se téléchargera, sans que vous receviez de spam ou que vos données soient divulguées.

Il est évident que vous allez entrer votre propre mot de passe sur l'écran suivant, et que vous allez passer à la suite.

Vous ferez la même chose avec la configuration, et vous n'aurez qu'à cliquer sur « Terminé ».

Une fois l'opération terminée, redémarrez et connectez-vous.

Votre première tâche sera la suivante :

sudo apt install samba

et une fois que c'est fait :

whereis samba

If you already have a server set up that you can use, you can check if the daemons are running: systemctl status smbd systemctl status nmbd I’m just going to follow along here to get it done: https://ubuntu.com/tutorials/install-and-configure-samba#3-setting-up-samba When we do the configuring, I will explain each bit so that a newbie would get it, so for now, just go along as this is the easy part. mkdir /home/<username>/sambashare/ sudo nano /etc/samba/smb.conf at the end of the file, add: [sambashare] comment = Samba on Ubuntu path = /home/<username>/sambashare read only = no browsable = yes One, two, three, spaces, it does not matter, the indentation here is not white space sensitive.

Si vous avez déjà un serveur configuré que vous pouvez utiliser, vous pouvez vérifier si les démons sont en cours d'exécution :

systemctl status smbd

systemctl status nmbd

Je vais me contenter de suivre le processus pour le mener à bien : https://ubuntu.com/tutorials/install-and-configure-samba#3-setting-up-samba

Lorsque nous ferons la configuration, j'expliquerai chaque partie de manière à ce qu'un novice puisse la comprendre, donc pour l'instant, il suffit de suivre le mouvement car c'est la partie la plus facile.

mkdir /home/<username>/sambashare/

sudo nano /etc/samba/smb.conf

à la fin du fichier, ajoutez :

[sambashare]

  comment = Samba sur Ubuntu
  path = /home/<username>/sambashare
  read only = no
  browsable = yes

Un, deux, trois espaces, peu importe, l'indentation ici n'est pas sensible aux espaces blancs.

As always, after any reconfiguration, restart the service: sudo service smbd restart or you can use: systemctl restart smbd If you use UFW, then you need to allow SAMBA to pass: sudo ufw allow samba Nothing fancy or difficult (and, as you can see, I made a mistake that I need to fix quick. This is why syntax highlighting is great!). The catch here is read only = no is equivalent to writeable = yes Now if you are like me and prone to type the wrong thing, please type: testparm It will check your config file for errors. What you are looking for is, “Loaded services file OK.” Just like that, we have our base that we will be working from. Join us in the next issue for adding a samba user and explaining a bit more, to paint out the picture. If I explained anything badly, misc@fullcirclemagazine.org

Comme toujours, après toute reconfiguration, redémarrez le service :

sudo service smbd restart

ou vous pouvez utiliser :

systemctl restart smbd

Si vous utilisez UFW, vous devez autoriser SAMBA à passer :

sudo ufw allow samba

Rien d'extraordinaire ou de difficile (et, comme vous pouvez le voir, j'ai fait une erreur que je dois corriger rapidement. C'est pourquoi la mise en évidence de la syntaxe est géniale !)

Le problème est que « read only = no » est équivalent à « writeable = yes ».

Maintenant, si vous êtes comme moi et que vous avez tendance à taper la mauvaise chose, tapez : testparm

Il vérifiera si votre fichier de configuration contient des erreurs.

Ce que vous recherchez, c'est « Loaded services file OK » (le fichier de service a été chargé correctement).

C'est ainsi que nous avons notre base de travail. Rejoignez-nous dans le prochain numéro pour ajouter un utilisateur samba et donner un peu plus d'explications, afin de compléter le tableau.

Si j'ai mal expliqué quelque chose, misc@fullcirclemagazine.org

issue207/c_c.txt · Dernière modification : 2024/07/29 15:56 de andre_domenech