Which config files could disable the automatically starting ssh server, so a headless connect becomes impossible? - raspberry-pi

Which config files could disable the automatically starting ssh server, so a headless connect becomes impossible?
I need to know the config files that might interfere with the ssh server to normally start up at boot.

I believe that you are looking for the following commands (assuming you are running the last version of raspbian):
sudo systemctl stop sshd
sudo systemctl disable sshd
sudo systemctl mask sshd
stop Basically stops the service immediately. disable disables the service from starting at bootup. Additionally, mask will make it impossible to load the service.
Digging deeper into what each command does, on modern linux distributions there are configuration files for each service called unit files. They are stored (usually) in /usr/lib/systemd. These are basically the evolution of scripts to start services.
the stop command just calls the sshd.service unit file with a stop parameter, in order to shut down the server.
the disable (or enable) command removes(or creates) a symlink of the unit file in a directory where systemd looks into when booting services (usually, /etc/systemd/system).
systemctl mask creates a symlink to /dev/null instead of the unit file. That way the service cant be loaded.

Related

modify haproxy systemd configuration

I'm running Ubuntu 18.04 and I've installed haproxy 1.8.8. I want to modify the config so that the "-f" option will read a directory rather than a single haproxy.cfg file.
I see /lib/systemd/system/haproxy.service and also /etc/init.d/haproxy were installed. I think systemd is managing haproxy. But I've read that I'm not supposed to modify the installed haproxy.service.
I copied haproxy.service to /etc/systemd/system/ and edited it there. The changes I made were not picked up when I ran sudo systemctl daemon-reload; sudo service haproxy restart.
Which file do I need to modify and then get systemd to recognize the changes? TIA
As you suspected, you should not edit the unit-files (provided by the OS packager) directly. You can supply a drop-in-snippet using the command
systemctl edit haproxy
and customize the relevant directives (ExecStart)

Best way to run a pyramid pserve server as daemon

I used to run my pyramid server as a daemon with the pserve --daemon command.
Given that it's deprecated, I'm looking for the best replacement. This link recommends to run it with screen or tmux, but it seems too heavy to just run a web server. Another idea would be to launch it with setsid.
What would be a good way to run it ?
Create a service file in /etc/systemd/system. Here a example (pyramid.service):
[Unit]
Description=pyramid_development
After=network.target
[Service]
# your Working dir
WorkingDirectory=/srv/www/webgis/htdocs/app
# your pserve path with ini
ExecStart=/srv/www/app/env/bin/pserve /srv/www/app/development.ini
[Install]
WantedBy=multi-user.target
Enable the service:
systemctl enable pyramid.service
Start/Stop/Restart the service with:
systemctl start pyramid.service
systemctl restart pyramid.service
systemctl stop pyramid.service
The simplest option is to install supervisord and setup a conf file for the service. The program would just be env/bin/pserve production.ini. There are countless examples online of how to do this.
The best option is to integrate with your system's process manager (systemd usually, but maybe also upstart or sysvinit or openrc). It is very easy to write a systemd unit file for starting pserve and then it will be started/stopped along with the rest of your system. Log files are even handled automatically in these cases.

Centos Service not starting

Running Centos7, I have init.d service that I'm trying to start. When I do so it comes back with an OK message which = success. Yet when I use TOP I don't see it running.
Now if I take the command that the service should be running from the cat /etc/init.d/XXXX it starts as expected.
How can I go about debugging this? I've checked /messages, and /secure and even dmesg but I don't see anything amiss.
Try systemctl start <command>
Eg if you want to start ssh
systemctl start sshd
or
systemctl start sshd.service
Look for man pages of systemctl
Explaination
CentOS 7 / RHEL 7 / Fedora Linux (many other modern distor) uses Systemd. It is a system and service manager for Linux operating systems. In newer distro such as CentOS7/RHEL7 systemd replaces Upstart as the default init system
In case you have scripts for starting & stopping of a particular process or code
you can place a file /etc/init.d/ directory
with somewhat below logic
#!/bin/bash
SCRIPT_PATH=/pathtoscriptdirectory
case $1 in
start)
sh $SCRIPT_PATH/startup.sh
;;
stop)
sh $SCRIPT_PATH/shutdown.sh
;;
restart)
sh $SCRIPT_PATH/shutdown.sh
sh $SCRIPT_PATH/startup.sh
;;
esac
exit 0
Its good practice to make start stop restart blocks, you can have your custom blocks too
Also make sure that you have executable permission over all the files in this lineup
Then run it like you run the normal services

Stop or restart beanstalkd manually on command line

Beanstalkd is running on my Ubuntu VPS. I don't know how to stop or shut down the beandstalkd server. I want to stop the server manually on the command line.
I've found monitoring tools and a configurations script, but no commands for the commandline.
Beanstalkd is normally run with the standard OS-level tools (so, on Ubuntu, upstart). There are a number of example configuration scripts for LaunchD, systemD and Upstart in the Beanstalkd repo.
For an Ubuntu system, you would copy the Upstart .conf file, making any required tweaks to the command line you need (to enable the binary log, for example) and drop it into the /etc/init/ directory. Then the usual start, restart, stop & status commands would be able to control the Beanstalkd daemon, and it could be auto-started on bootup.
If it's not already under upstart control, then you can simply kill the process, like anything else, by finding the process ID (pgrep -lf beanstalkd).

Where is the web server root directory on Angstrom Linux (BeagleBoard | BeagleBone)?

I'm trying to find the default web server directory on my BeagleBone with Angstrom Linux. That is, where are the files served when I go to:
http://beaglebone.local:80
Another way would be to answer this question: How do I find out what directory a port number points to on my BeagleBone with Angstrom Linux?
The BeagleBone|BeagleBoard Angstrom Linux distribution ships with a socket server that runs as a service using node.js and bonescript in:
/var/lib/cloud9/bonescript/
and can be accessed at: http://beaglebone.local:80
You can also install lighttpd with
opkg install lighttpd
and will install a config file into
/etc/lighttpd.conf
which can be altered to set the default web directory wherever you like.
I found the following worked, evenutally:
systemctl disable bonescript.service
systemctl disable bonescript-autorun.service
systemctl disable cloud9.service
systemctl disable bonescript.socket
Use 'systemctl list-units' to check they've stopped. Possibly, there's a correct order you have to do these in, I had to fiddle around and repeat these a bit before they were all dead. You could probably just nuke the symlinks in /etc/systemd/system/multi-user.target.wants and reboot.