Skip to content
Advertisement

Compiler version in C++ vs pre-compiled C libraries

I have a code that uses std=c++20. I want to use a C library that was build with old gcc version. Should I recompile the C library using the same compiler ? If no, how could you judge that the 2 ABIs are compatible? Answer There should be no problem using the library as it is. Don’t forget to add

Chain SSH script

Let’s say I have 3 linux servers. I need a script that will login from s1 to s2 via ssh, then from s2 to s3 via ssh, then check, if there is already exists string in ~/.ssh/authorized_keys from s1 then do nothing otherwise do s1 and s2 are constant, s3 can be variable. ssh from s1 to s2 already settled

How to replace newlines between brackets

I have log file similar to this format Here is the echo command to produce that output $ echo -e “test {nseq-cont {nttt0,nttt67,nttt266nttt},nttgrp-id 505nt}n}ntest{nttest1{nttvalnt}n}n” Question is how to remove all whitespace between seq-cont { and the next } that may be multiple in the file. I want the output to be like this. Preferably use sed to produce the output.

Root privileges needed for “systemctl suspend” command

On an embedded Linux device (Colibri module with an iMX7d processor) I am not able to run the command systemctl suspend as an non-root user in order to switch into suspend mode. When I log in as root user, the command is executed and the system switches to suspend mode. The same command runs on a Ubuntu PC system as

run a command with a file pattern

I have this file patterns.txt And I want to run a specific command for every pattern like this: I tried to used for loop like this: but i didn’t work Answer The 2 typical approaches are: and Note that I would expect both of those to fail, since scp expects at least 2 arguments. How you want that 2nd argument

Restart Opencanary from Crontab

I have a programm called opencanary running at a virtual environment at my Raspberry Pi with Ubuntu 18.04 installed. I want to restart it every 30 Minutes using crontab. For testing I set the script to run every 3 Minutes as you can see below. When I execute the script manually it’s working fine. When using crontab to run it

Protecting against Time-of-check to time-of-use?

I was reading: https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use They showed this code to be buggy and I totally understand why it’s so: But the real question is how to protect against this type of exploits? Answer You can use the O_NOFOLLOW flag. It will cause the open to fail if basename of the path is a symbolic link. That would solve the described attack.

Advertisement