Connections with TCP Wrappers and Systemd Sockets

You can create an extra layer for connections using Systemd Sockets with TCP Wrappers. Firstly, we need check the sshd.socket is stopped: systemctl status sshd.socket Otherwise, we can use the below command to achieve this goal. systemctl stop sshd.socket The next step could be create a job to stop sshd.service and start sshd.socket. The following commands help in this task: sudo at now + 3 minutes at > systemctl stop sshd....

August 2, 2023 · 1 min · 158 words · Carlos Nogueira

SSH Tunnel for Network Traffics

SSH tunnel is Port forwarding via SSH in which you will able to pass traffic that it can use an unencrypted protocol over an encrypted network stream. The command is: ssh -f <remote address> -L <local port>:<remote address>:<remote port> -N

August 2, 2023 · 1 min · 40 words · Carlos Nogueira

Journal Control to investigate service logs

When you face with a problem in one of the service and would like to investigate about its execution through logs, you can use the Journal Control to this task as mentioned in the below command: journalctl -u <service file> Service is an example but the option -u can be used to any unit file, either system or user-defined one.

July 26, 2023 · 1 min · 60 words · Carlos Nogueira

Create a Systemd Timer Unit

In order to schedule an execution for a specific service given a period of time, a timer file can helps achieve this goal. Timers are systemd unit files, in which its name is followed by the suffix .timer, and it has that characteristic. Look into to its file content as demonstrated in the following example, we can notice the presence of section Timer: [Unit] Description=XXXX [Timer] OnCalendar=*-*-* 10:30:00 Persistent=true Unit=<service file> [Install] WantedBy=<target> The Timer section uses the option OnCalendar to establish when the service should be executed (in the above example, always at 10:30) pointing out to its service in the option Unit....

July 26, 2023 · 2 min · 226 words · Carlos Nogueira

Check and change the default target boot for Linux

Systemd is responsible to manage Linux system resources. Those resources are known as units, such as services, targets, sockets and so on. It is possible to use systemd to list all of units are made of by the following command: systemctl list-units Targets represent the state of Linux has reached during startup. It is also possible to run the above command to filter only for target units: systemctl list-units --type=target To get the default target boot has been used for Linux, the following command fit the purpose:...

July 26, 2023 · 1 min · 106 words · Carlos Nogueira

Linux User Management Commands

In the below table there are some commands can be used to handle users and groups: Goal Command add user adduser <username> add user group addgroup <groupname> add specific user group as primary group usermod -g <groupname> <username> append user group as suplementary group usermod -aG <groupname> <username> lock user usermod -L <username> check the user groups id <username> change to root user sudo -i or sudo su - change to another user sudo su - <username> set password passwd <username> To give permissions for specific user/group in order to execute commands with sudo, it can be pointed out in a separeted sudoer file (within sudoers....

July 24, 2023 · 2 min · 216 words · Carlos Nogueira