Ceci est une ancienne révision du document !
Last issue we looked at SAMBA basics and getting a test VM running. If you are planning on writing LPI, know that for some reason, the “weight” on SAMBA is more than others, meaning you are likely to get more questions based thereon. If I remember correctly, it features in all three of the LPIC exams. I’m looking at my old notes here while I write this, so while everything should be technically correct, there may be some things that may be out of date. It has been a while since I taught students and versions do change. However, I generally find that if you know the origins of something, you understand it better.
Just in case you forgot where we are, fire up your VM and let's take a look. Quick recap, (also helps me get my train of thought in-line)
SAMBA is an amalgamation of three daemons:
1. smbd - resource locking - user authentication - data sharing via SMB protocol - printing - file sharing (Mnemonic RUDE PF - as in PF sense firewall fill in your own word for the E or remember it is silent)
2. nmbd - NETBIOS translator - Windows browser (like Network neighbourhood)
3. winbindd - Windows USER and GROUPS translator. Via: PAM, NSS RPC - Maps windows users onto Linux
NOTE: Samba cannot use /etc/pwd or /etc/shadow to authenticate users directly!
In your VM, make sure SMB is still there:
ps aux | grep smb
ps aux | nmbd
sudo smbstatus
Happiness?
Let’s quickly cover the other basics as well, I’ll put them here, as I have them in *my notes, which my help you remember things easier. At any point, feel free too grab an LPIC book lying about or check on the latest LPIC objectives: https://www.lpi.org/our-certifications/lpic-2-overview/
As I said before things change (but the more they stay the same?)
Please also check out: https://socradar.io/what-are-smb-ports/
Because our VM server is a blank slate, you may need to install the net-tools package if you want to tun commands such as netstat.
sudo apt install net-tools.
In the last issue, we just set up as this page: https://ubuntu.com/tutorials/install-and-configure-samba#3-setting-up-samba, but we did not talk about it. On your freshly created VM, type:
man smb.conf
It is one of the better man pages. It is intense, I know, but I want you to make a bit of an effort and go through it at least once, more if you need to. So if anything went wrong in the previous issue for you, you need to look here. Parameters are in the format of NAME = VALUE
You may have realised from my list that we do not have SAMBA users. Now just as we were blindly following the Ubuntu SAMBA page, in the previous issue, we will continue, there is a part four there. The problem is they do not say much and a newbie may get caught here. Let’s expand.
We start by adding a generic SMB user, the name is up to you. At this stage you should know how to add a user. You can use ‘smbpasswd’ to add a password for the newly created user. You cannot use smbpasswd to create and set a password for a user, the user must already exist.
Your homework lies here: https://ubuntu.com/server/docs/introduction-to-samba Please read this at least once. That will lead us here: https://ubuntu.com/server/docs/samba-as-a-file-server
But how do we access this SMB share from another Ubuntu computer?
Where my friend was looking in “Windows shares” originally, I suspect a lot of newbies my look here, but it is not in the “windows” part. (though it reports Windows shares once connected) Your eyes need only travel to the bottom of the finder window. (that part only appears when you click on other locations)
“Connect to Server” (see image above) – type :
smb:<ip address of SMB server> A quick demonstration in pictures: 1. my server we have been faffing on: my IP address is: 10.0.2.4 2. On my workstation side: 3. I click connect. 4. Once you know what the names of the shares are, you can “map” them. The say a picture is worth a thousand words, so I hope every newbie knows how to make and connect to SAMBA shares now. For the more salted Ubuntu users, I know this is time consuming, but I’d like to have everyone on board before moving forward. The concepts are simple, you just need to make sure you edit your files correctly. OK now on the server side, if you wish to end the share, you can use systemctl, like so: systemctl stop smbd nmbd -and obviously replace stop with start to do the reverse. Last bit of reading I’m going to ask you to do on your own machine today: man smbdcontrol You may see there is says winbindd as well. We did not talk about that, but that is because winbindd is independent and can run on its own. However, I think it is a big enough chunk for this issue, more and you will probably not absorb it all. If I’m going too slow or too fast, please let us know and we can try to adjust accordingly. As always: misc@fullcirclemagazine.org