Back to main site

sinablog

I don't even know

Setting up Samba on Solus

May 10, 2017 — ~sinacutie

Solus comes with Samba installed by default, as I am sure some other distributions do too. Last time I dealt with Samba, I wanted to gouge my eyes out, it was so complicatedly awful. This time, however, it was extremely simple by comparison.

If you're new to the command line, please remember that the dollar sign ($) is not part of the command. It denotes that I'm running as a regular user. (Root console has a hash mark (#) instead, on most default setups.)

First thing I needed to do was copy smb.conf to /etc/samba/smb.conf:

sh $ sudo cp /usr/share/defaults/samba/smb.conf /etc/samba/smb.conf

Originally, I had tried to create my Samba password before doing that, but it tossed a ton of errors. I ended up doing that as the last step.

Since I don't want Samba user to be the same as mine, I decided to use a different name. That user must also exist as a Linux user, so we have to first add that:

sh $ sudo useradd -s /sbin/nologin -m share

The command above creates the user "share" with a default home directory of /home/share and no shell, since it doesn't need to be able to log in via SSH.

Now we'll edit /etc/samba/smb.conf to include the location to our shared folder. I recommend adding this to the end of the file, though I added mine after the [homes] section:

ini [Share] comment = Share Folder path = /home/share browsable = yes read only = no

Since this is temporary and I plan on removing these things later, I did not bother commenting out the Printer section, which I usually do. I don't own a printer and there's no reason for it to try and share one. You can if you want; it's your configuration file, after all.

I ran testparm to make sure that there were no typoes. It checks the smb.conf for any errors:

```text $ sudo testparm Load smb config files from /usr/share/defaults/samba/smb.conf rlimitmax: increasing rlimitmax (10000) to minimum Windows limit (16384) Processing section "[homes]" Processing section "[homes]" Processing section "[share]" Loaded services file OK. Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions ```

If there are no errors, it should look similar to what's above. You can either press "enter" or "ctrl+c" — either is up to you.

Since everything is working as intended, we'll finally add the Samba password with smbpasswd before restarting Samba:

text $ sudo smbpasswd -a share New SMB password: Retype new SMB password: Added user share.

If all goes well, it should look like the above. Let's restart Samba, then test on a Windows computer:

sh $ sudo systemctl restart smb

Note: In Solus, the Samba daemon we went to restart is smb, but the name might vary between distributions.

On the Windows machine, I visited my computer by opening the file explorer and typing \\REMEDIOS in the address box, then pressed "enter." I was presented with the folder "share", and was able to log in with the username share and the password I set!

This is a very basic Samba setup, so I encourage you to check out the SambaWiki for more info.

tags: samba, solus, linux