How to auto-mount an NFS share using systemd

If you want to auto-mount an NFS share during boot time, you may run into the issue that by the time the auto-mount procedure is being executed, the network is not yet up and hence the mount of the NFS share will fail. Luckily, there is an easy way around it by using systemd and let it worry about when to mount the share.

Continue reading “How to auto-mount an NFS share using systemd”

How to list dependencies of a rpm package via dnf

The other day while writing up the blog post How to install Oracle Database 18c XE on Oracle Linux 8 I stumbled across the question of how to list all the dependencies of a rpm package on Oracle Linux 8. The solution was easier than I thought but required some googling, so here is it for easy reference:

The dnf command provides a nice little sub command called repoquery which is equivalent to rpm -q and to the repoquery command provided by yum-utils on Linux 7. It’s quite a powerful little command which is reflected by the long list of parameters it takes. You can check for yourself by just typing dnf repoquery --help. One of these parameters is --requires which allows you to, as the documentation puts it “Display capabilities that the package depends on.

Continue reading “How to list dependencies of a rpm package via dnf”

How to set the date and time on Linux

A quick post for how to set the date and time on Oracle Linux via the date command. This post is more for my own documentation but hey, it might help others as well. To set a date or time you have to pass on the information via a formatted string to the date command. I find calling date twice, once for the date and once for the time, the easiest. The +%D format option allows you to pass on the date as YYYY-MM-DD, e.g. 2019-08-01 for the 1st of August 2019. To set the time, I use the +%T format option to pass on the time as HH24:MI:SS, e.g. 22:31:04.

date +%D -s 2019-08-01
date +%T -s 22:31:04


date +%D -s YYYY-MM-DD
date +%T -s HH24:MI:SS

Enabling SFTP-only access on Linux

Recently I had the need to share a zip file with a bunch of people that was big enough not to fit into email anymore. So I wanted to get it onto my server so that folks could grab it via SFTP from there. SFTP is setup by default on my Linux environment, so them accessing the machine was trivial. However, I didn’t want to give them full access to the entire machine where they could randomly up- and download files anywhere. What I needed was some way of giving them a user which was self-contained, with no SSH privileges and bound to a single location on the filesystem. Luckily, setting something like this up was much easier than I thought, and here is how you can do it yourself. Note, all commands below are executed as the root user:


  1. useradd <your sftp user> -s /sbin/nologin -M
  2. passwd <your sftp user>
    1. Enter your sftp user password and confirm
  3. vi /etc/ssh/sshd_config
  4. Match User <your sftp user>
       ChrootDirectory <your sftp user directory>
       ForceCommand internal-sftp
       AllowTcpForwarding no
       X11Forwarding no
  5. service sshd restart

Continue reading “Enabling SFTP-only access on Linux”

Disable SELinux on Oracle Linux 7

Sometimes when I want to test something or write a prototype of some sort SELinux (Security-Enhanced Linux) kicks in and hinders me, given that it is enabled by default on OL 7 UEK 4. STOP! Before I let you continue to read take a mental note of my disclaimer: I am an advocate of having security turned on by default. It helps us provide better and obviously more secure systems which, in turn, helps the world save time and money. Security should never, ever be turned off for production systems!
With this being said, here are a couple of quick steps for how to get around it.


  • setenforce 0
  • vim /etc/sysconfig/selinux
  • SELINUX=permissive

Here is also a short video on this topic:

Continue reading “Disable SELinux on Oracle Linux 7”