====== UNIX ======

Configuration of ''[UNIX]'' section of the Synchronet initialization file (e.g. ''[[dir:ctrl]]/[[config:sbbs.ini]]'').

===== User/Group =====
If you are **not** [[howto:linux_non-root|starting sbbs as ''root'']], then you should **not** set these values.

==== User ====

Default: <none>

==== Group ====

Default: <none>

If you do not want to run Synchronet (and all external programs/doors) as
root (the Unix //administrator// user), you will have to set the ''User'' and ''Group'' key values.

Example:

  User=sbbsuser
  Group=sbbsgroup
  
NOTE: the ''sbbsuser'' and ''sbbsgroup'' names are just examples. You must pick valid user/group names for your system (e.g. exist in your system's ''/etc/passwd'' file) and both the user and group name may be the same.
  
Also, the Synchronet file
permissions/ownership should be such that this user/group would have read
and write access to them.  The best way to accomplish this is a command
like:

  # chown -R sbbsuser:sbbsgroup /sbbs

If you do this, then be sure to run any Synchronet utilities (e.g. [[util:SCFG]]) as the same user that the BBS is going to run as:
  
  # su -c /sbbs/exec/scfg sbbs  

===== Logging =====
==== LogFacility ==== 

Default: ''U'' (User)

Supported Values: ''0''-''7'' ("Local0" through "Local7" facility), ''U'' (for "User" facility), and ''S'' or ''F'' (for "Standard" facilities)

If you have ''sbbs'' installed to run in the background as a daemon, logging
via [[monitor:syslog]] rather than the local console, you may want to set the ''LogFacility'' key value. A good value to use is:

  LogFacility=3
 
Then, in ''/etc/syslog.conf'' (or ''/etc/rsyslog.d/sbbslog.conf'') you will need to add the line:

  local3.*                 /var/log/sbbs.log

Depending on how your vendor set up ''syslog.conf'' initially, you may also want
to exclude local3.* from other log files (Noteably ''/var/log/messages''). how to
do this varies with your syslogd implementation, but for BSD based ones
(Which BSD and many Linux distros use) you would add ";local3.none" to the
end of the first field in the ''/var/log/messages'' line.

You will have to create this file manually initially by running:
  # touch /var/log/sbbs.log

Then send a HUP to syslogd like so:
  # killall -HUP syslogd
  
Or it might be necessary to:
  # service syslogd restart
  
You could then monitor the Synchronet daemon log output with:
  # tail -f /var/log/sbbs.log

You will want to investigate how your system rotates logs and set it up to
rotate ''sbbs.log'' also.

  # cat /etc/logrotate.d/sbbs
  /var/log/sbbs*.log {
        weekly
        missingok
        rotate 52
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
                invoke-rc.d rsyslog reload > /dev/null
        endscript
  }


Further use of the ''LogFacility'' setting is beyond the scope of this document.
Read your ''syslog.conf'' manpage for more information about this.  In particular,
do NOT use the 'S' setting unless you are familiar with advanced syslogd
configuration.  The S setting will use different facilities for each feature
of Synchronet as appropriate.  Specifically, S will use:

    LOG_AUTH
    LOG_DAEMON
    LOG_FTP (If available)
    LOG_MAIL
    LOG_CRON
    
Note: the LogFacility value in the ''sbbs.ini'' file may be overridden with the ''-d'' command-line option (e.g. ''sbbs -d3'' to daemonize ''sbbs'' with LogFacility of ''Local3'').
   
==== LogIdent ====

Default: ''Synchronet''

This is the value passed as the ''ident'' argument to the system's ''openlog'' function. Run ''man openlog'' for more details on this setting.

===== Process Control ===== 

==== PidFile ====

Default: ''sbbs.pid''

This key contains the path of the file which will contain the process identifier (PID) of Synchronet and may be used by background/daemon startup scripts to query the current state of ''sbbs''. When no path is specified, the file (e.g. ''sbbs.pid'') will be created in the Synchronet ''[[dir:ctrl]]'' directory.

  # service sbbs status
  Synchronet BBS services status: [running]
  PID(s): 6270

If you change the value of this key, you may also need to modify your startup script (e.g. ''/etc/init.d/sbbs'').

==== umask ====

Default: ''077''

Sets ''sbbs'''s  file mode creation mask.

Note: If the value begins with a ''0'', it will be interpreted in //octal// notation.

Run ''man umask'' for more details on this setting.

==== Daemonize ====

Default: ''false''

When set to ''true'', forces ''sbbs'' to run daemonized (in the background) without specifying the ''-d'' command-line option. Setting this value to ''true'' is not recommended.

===== Email =====

Synchronet's mail base and mail server can be used as your UNIX system's email system, if you wish.

==== sendmail.js ====

The Synchronet ''[[module:sendmail]]'' module can be used as a suitable replace for:
  * /usr/sbin/sendmail
  * /usr/bin/mail
  * /usr/bin/mailx

This is achieved by making symbolic links (e.g. using ''ln -s'') from those locations to the Synchronet ''[[dir:exec]]/sendmail.js'' file. For example:

  lrwxrwxrwx 1 root root     37 Feb 13  2023 /usr/bin/mail -> /home/sbbs/sbbs/exec/sendmail.js
  lrwxrwxrwx 1 root root     37 Feb 12  2023 /usr/sbin/sendmail -> /home/sbbs/sbbs/exec/sendmail.js
  
This works because the ''sendmail.js'' has a "shebang" that auto-invokes [[util:jsexec]]. That shebang has the path ''/sbbs/exec/jsexec'' hard-coded in it (as is the UNIX way), so you may need a symlink from ''/sbbs'' to wherever the proper 'sbbs' location is for that to work as expected:
  #!/sbbs/exec/jsexec -x

===== See Also =====
  * [[:config:|Configuration]]
  * [[:monitor:syslog]]


{{tag>configuration unix operating_system sendmail email}}