Minimal samba configuration for access by wholly trusted computers in this residence

Can someone please tell me: How do I start and stop the Samba daemon processes that will read the file below (and then run correctly or fail)?

[global]
workgroup = SIMPLE
log file = /var/log/samba/%m.log
server role = standalone server

[test]
comment = minimal samba sever only for trusted computers within home network
path = /export/redhill
read only = no
guest ok = yes
hosts allow = 10.0.0.0/255.255.255.0

FURTHER EXPLANATION TO ANYONE WHO MAY BE INTERESTED:

That file is a very minimal /etc/samba/smb.conf file that I have created on my Desktop Manjaro computer. It is, in part, somewhat derived from the example in "2.4 A Basic Samba Configuration File" at https://www.oreilly.com/openbook/samba/book/ch02_04.html .

As the computers, which are to access the samba share /export/redhill, are all behind a router under the roof of the house I live in, SECURITY IS OF ABSOLUTELY NO CONCERN TO ME. Nor are any of the other wonderful features one can spend months reading about in the Samba documentation - different kinds of shares, classes of users, "add user script", "algorithmic rid base", "allow trusted domains", printing, etc., etc.

All I want to be able to do is - more than 15 years after I was first told about Samba - be able to copy a large file, say a 312 megabyte webm file, to directory beneath /export/redhill/ and be able to have a person I share this house with, be able to copy that file onto her Windows computer.

My current "file sharing" system is either:

  1. Upload the 312 megabyte webm file into gmail, send that file in an e-mail to the e-mail address of the other resident of this house, then she has to read that e-mail, thence detach and download the file; or

2.Copy the file into a USB flash drive and take that flash drive to another computer.

So, I think it's about time, with a router, switches and RJ45 cables running throught my house and a number of Linux computers Windows computers, for me to have a somewhat more sophisticated file sharing system than those described immediately above.

Thank you for your attention,

daggett

To start samba:

sudo systemctl start samba

To stop samba:

sudo systemctl stop samba

To enable samba on boot:

sudo systemctl enable samba

To disable samba on boot:

sudo systemctl disable samba

daggett: for your application in your home I think samba is overkill. What we use is a very simple easy Python web server that is already included with Manjaro. You then use your browser to transfer files to/from various devices around the home. I put this in my .bashrc :

alias server='python2 -m SimpleHTTPServer'

Then you go to another machine and in the browser just type in the IP address of the machine, with port 8000 , e.g.: http://192.168.0.14:8000 and you will connect to the current directory of that serving machine....

Sorry, didn't really answer your Samba question but you might want to consider this much easier method....

1 Like

Thank you pixel27 and lagagnon,

lagagnon, your suggestion seems to be a simpler way to provide the functionality I need, but, so far, I haven't installed Apache (nor lighttpd, haskell-httpd-sched, darkhttps and sthttpd) Presumably any one of:

sudo systemctl start lighttpd
sudo systemctl start haskell-httpd-sched
sudo systemctl start darkhttps
sudo systemctl start sthttpd
sudo systemctl start httpd

... will start up any one of the named webservers on my desktop after I have installed it and configured it? (However, ultimately, I want to have a webserver on another server computer and not on my desktop.)

pixel27,

The output I have got from your two suggested commands are as follows:

sudo systemctl status samba.service

[sudo] password for daggett: 
● samba.service - Samba AD Daemon
   Loaded: loaded (/usr/lib/systemd/system/samba.service; disabled; vendor pres>
   Active: failed (Result: exit-code) since Wed 2019-04-24 10:01:54 AEST; 4h 34>
     Docs: man:samba(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 19282 ExecStart=/usr/bin/samba --foreground --no-process-group $SAMB>
 Main PID: 19282 (code=exited, status=1/FAILURE)
   Status: "daemon failed to start: Samba detected misconfigured 'server role' >
    Error: 22 (Invalid argument)

Apr 24 10:01:53 murmansk samba[19282]: root process[19282]:   Copyright Andrew >
Apr 24 10:01:54 murmansk samba[19282]: root process[19282]: [2019/04/24 10:01:5>
Apr 24 10:01:54 murmansk samba[19282]: root process[19282]:   At this time the >
Apr 24 10:01:54 murmansk samba[19282]: root process[19282]:   'server role = ac>
Apr 24 10:01:54 murmansk samba[19282]: root process[19282]:   You should start >
Apr 24 10:01:54 murmansk samba[19282]: root process[19282]: [2019/04/24 10:01:5>
Apr 24 10:01:54 murmansk samba[19282]: root process[19282]:   exit_daemon: daem>
Apr 24 10:01:54 murmansk systemd[1]: samba.service: Main process exited, code=e>
Apr 24 10:01:54 murmansk systemd[1]: samba.service: Failed with result 'exit-co>
Apr 24 10:01:54 murmansk systemd[1]: Failed to start Samba AD Daemon.

$ sudo journalctl -xe

-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A start job for unit NetworkManager-dispatcher.service has finished successf>
-- 
-- The job identifier is 11438.
Apr 24 14:34:01 murmansk systemd[1]: NetworkManager-dispatcher.service: Succeed>
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The unit NetworkManager-dispatcher.service has successfully entered the 'dea>
Apr 24 14:35:04 murmansk dbus-daemon[320]: [system] Activating via systemd: ser>
Apr 24 14:35:04 murmansk dbus-daemon[320]: [system] Activation via systemd fail>
Apr 24 14:35:08 murmansk dbus-daemon[320]: [system] Activating via systemd: ser>
Apr 24 14:35:08 murmansk dbus-daemon[320]: [system] Activation via systemd fail>
Apr 24 14:36:45 murmansk sudo[21028]:    daggett : TTY=pts/3 ; PWD=/home/daggett/dl>
Apr 24 14:36:45 murmansk sudo[21028]: pam_unix(sudo:session): session opened fo>
Apr 24 14:36:45 murmansk dbus-daemon[320]: [system] Activating via systemd: ser>
Apr 24 14:36:45 murmansk dbus-daemon[320]: [system] Activation via systemd fail>
Apr 24 14:36:50 murmansk sudo[21028]: pam_unix(sudo:session): session closed fo>
Apr 24 14:37:19 murmansk sudo[21043]:   daggett : TTY=pts/3 ; PWD=/home/daggett/dl>
Apr 24 14:37:19 murmansk sudo[21043]: pam_unix(sudo:session): session opened fo>
lines 1492-1514/1514 (END)

The beauty of @lagagnon's solution is that you don't need Apache ( or lighttpd, haskell-httpd-sched, darkhttps and sthttpd) or any other webserver.
You just need python2. Running a normal heavy webserver is usually a little bit more complicated, since you need to make sure the webserver user has the right permissions to server files and the configuration is correct.

You just need to run
python2 -m SimpleHTTPServer 8000
in the folder with files you want to share. Then use a Browser to download files on your other system.

Update "server role" to be "standalone" instead of "standalone server" I think they changed the configuration and it appears 99% of the old articles on the web are now incorrect, or maybe they still work on the debian version of samba which might be older than what Manjaro is using.

man smb.conf

Will give you help on the configuration file format.


Old info
https://wiki.archlinux.org/index.php/Samba#Server

Documented smb.conf

Just for completeness - ensure the samba package is installed and the system is fully updated.

sudo pacman -Syu samba

Below is tested in a virtual machine on a bridged network - public is writable by linux guest.

Making access for a Windows user - I have only had success with creating the user in the SAM database. Using the same username/password lets the user access with no prompts.

Create the config file /etc/samba/smb.conf

sudo nano /etc/samba/smb.conf

Insert the following and save the file

[global]
   workgroup = Manjaro
   server string = Samba Server
   server role = standalone server
   log file = /var/cache/samba/log.%m
   max log size = 50

[public]
   path = /srv/samba
   public = yes
   only guest = yes
   writable = yes
   printable = no

test your config

sudo testparm /etc/samba/smb.conf

This step is not needed for Linux users - they just select the anonymous option when connecting. Windows users must be added to the SAM database. Using the same username/password as the Windows login insures painless connection. E.g. a Windows user named fido with the password 1234 - input password when prompted

sudo smbpasswd -a fido

Create the shared folder

sudo mkdir -p /srv/samba

Set permissions to any and all

sudo chmod 777 /srv/samba -R

start the services

sudo systemctl enable --now smb nmb

After making changes to the smb.conf - restart the smb service.

1 Like

I'm 70% through downloading 120gbs of music to a laptop that got a new ssd and manjaro today from another manjaro pc via samba on a home network. Both have manjaroKDE with the oxygen theme.
The steps taken from a clean install ManjaroKDE-

  • install from octopi 'manjaro-kde-settings' & 'manjaro-settings-samba'
  • changed the name of workgroup to myworkgroup in /etc/samba/samba.conf
    -added user to samba group via M-K-settings and added the other pc's user to the new pc and samba group.
    -reboot
    -Dolphin/Network/Smb/.....nothing?? Edit: next day- all shares are now showing in dolphin
    -In dolphin click on 'add entry' in the places/remote column and insert 'smb://192.168.x.x' as location of the other pc obtained from the router bookmarked in chrome.Save.
    -Split dolphin and drag mymusic from that link to this new pc's folder......and about 10% to go!!

notes - samba was already set up on original pc
- 'sudo systemctl start samba' etc was changed some time ago with samba replaced with smb
and nmb....just reboot.
- add all the users to all the pcs including the w10's....from la above-

Windows users must be added to the SAM database. Using the same username/password as the Windows login insures painless connection. E.g. a Windows user named fido with the password 1234 - input password when prompted

-'sudo smbpasswd samba_user' never worked today. Not sure why?

  • smb shares appear in dolphin/network/smb/workgroup on the old machine but not the new??
    this often occurs with dolphin after updates.
    -shared permissions are allowed in the files properties.
    - The oxygen theme makes gui so much easier!!

Easiest way to use samba shares I could find, is to

  • install package pacman -S manjaro-settings-samba,

  • grant X permission for others to your home folder chmod o+x /home/$(whoami)(this step could be integrated into package, but poses potential security risk)

  • and reboot.

KDE's dolphin has sharing built in. If you are using thunar, check if package thunar-shares-plugin is installed.

Thank you, lagagnon and xabbu,

I tried the command

alias server='python2 -m SimpleHTTPServer'

(It isn't yet in my ~/.bashrc .)

When I looked at http://10.0.0.132:8000 from a Windows computer, I got the Firefox "Unable to connect message".

Whilst it would be helpful for me to know how get this python solution (why not python version 3.7.3?) to work, I would stlll like, "more than 15 years after I was first told about Samba" to be able to get a simple basic minimal Samba server to work within my local network, where, right at this moment, there are no security issues.

linux-aarhus, pixel27,

It seems that I have got samba to run on my own desktop computer, but:

  1. I am not able to see the samba shares from the two Windows computers in this house; and

  2. I have forgotten how to view smbd, nmbd and other listening ports and I have forgotten what are the other diagnostic utilities I can use to see evidence that samba is running correctly;

My /etc/samba/smb.conf is:

[global]
workgroup = Manjaro
server string = Samba Server
server role = standalone server
hosts allow = 10.0.0.0/255.255.255.0
log file = /var/cache/samba/log.%m
max log size = 50

[public]
path = /srv/samba
public = yes
only guest = yes
writable = yes
printable = no

The output from "testparm /etc/samba/smb.conf" is:

Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

Global parameters

[global]
log file = /var/cache/samba/log.%m
max log size = 50
server role = standalone server
server string = Samba Server
workgroup = MANJARO
idmap config * : backend = tdb
hosts allow = 10.0.0.0/255.255.255.0

[public]
guest ok = Yes
guest only = Yes
path = /srv/samba
read only = No

Permissions in /srv/samba are:

drwxrwxrwx 3 root root 4096 Apr 22 23:23 .

I start samba with the command:

sudo systemctl enable --now smb nmb

I stop samba with the command:

systemctl disable --now smb nmb

All of the above seems to work, but I am unable to see them from the two other Windows computers on the 10.0.0.0/255.255.255.0 network in this house. Have I missed something? Perhaps I need to stop and start those Windows computers?

Do I also have to add my phone if I want to access samba server via my phone if so how can I add it and my phone doesn't have any password.

Please check post number seven

I don't know much of phones - related to file sharing.

The little I know is on Android - some applications exist to connect to file shares.

One example is the Total Commander app for Android - it has plugins for access to different kinds of servers. Also SMB.

1 Like

I use X-plore app for Windows hopefully it will work for linux too :crossed_fingers:
and I will also try Total commander app

Forum kindly sponsored by