Change root password Windows Subsystem for Linux

Today I was setting up Windows Subsystem for Linux and wanted to change to the root user using the command:

su -

I was prompted for the password, but had no idea what it was. So I needed to figure out another way of switching to the root user instead of prefixing every command with sudo. Did I say switch and prefix and sudo? O yes, stupid me.

sudo su

Don’t forget to exit once you are done. And be careful not to wrech havoc while working under the root account. Have fun!

Validating a json file from the command line in Linux

Today I needed to validate a json file on one of my servers. It turns out there is a simple nodejs program or actually a linter to do this with.

Just execute the following line and you are in business.

sudo npm install jsonlint -g

This assumes nodejs is already installed. If not, execute the following line.
sudo apt-get install -y nodejs npm

To validate a json file run the following command.

jsonlint -qc settings.analyzer.json

When running the program the first time I ran into the problem that the json file contains comments. Yes, I know this is not in line with the spec, but it is damn handy for understanding the file. So I needed to strip the comments to valiate the file. After googeling around a bit I found an awk command to do just this. Try the following command.

awk '{sub(/\/.*$/,"")}1' settings.analyzer.json > settings.analyzer.json

Now run jsonlint again and it should work.

P.s. I know the title of this post says Linux, but jsonlint will also work under any other system that nodejs runs on.

Hope this saves someone some time.

PT Magic setup on Ubuntu 17.10

TD;LR

In this post I will explain how to install, configure and run PT Magic (PTM), a free add-on for the Profit Trailer (PT) cryptocurrency trading bot, on a VPS using Ubuntu. As an extra security precaution the PTM GUI is only accessible through a SSH tunnel using PuTTY with port forwarding. This avoids opening additional ports on the VPS to the outside world.

Continue reading

Installing Oracle JDK 7 in Debian/Ubuntu/Mint

I am currently learning Scala and wanted to install the Scala IDE. In the process I ran into some problems that it programs would not compile correctly, which seemed to be caused by the OpenJDK 7. So I decided to remove OpenJDK 7 and install Oracle JDK 7. All the instructions I could find to do this where downloading based on manually downloading the Oracle JDK 7 and installing it interactively. As I also wanted the installation to work in a Docker container I wanted a fully automated solution. Continue reading

What happened to the user and group management commands in QNAP?

Had an interesting time figuring out how user and group management works from the command line on my QNAP server. At first the usual Linux commands do not seem to exist:

useradd
usermod
userdel
groupadd
groupmod
groupdel

After some Google research (who’s your friend?) I found some forum posts that pointed out the commands have been replaced by QNAP’s own special versions: Continue reading