I’m working on a C program on Linux (unprivileged). Is it possible to get a reference to struct socket or struct sock from the socket descriptor? Thank you. Answer If you’re working in user mode (eg. not kernel mode), you cannot directly manipulate kernel structures (including struct sock). If you…
Tag: linux
How do you use wget to download most up to date file on a site?
Hello I am trying to use wget to download the most update to day McAfee patch and I am having issues singling out the .tar file. This is what I have: However when I run the above command it gives me: When I need it to just be the most recent.tar file in between the <a> </a> which in this
What happened to USB MTP gadget driver in mainline Linux kernel?
I’m trying to make a embedded device work as a MTP device, using USB gadget driver. I know have Android switched from mass storage gadget to MTP gadget for quite a while, and found the source code for MTP gadget driver in a few Android repositories. However in the mainline kernel code I didn’t fin…
bash loop with GNU less that refreshes every 2 minutes
I have a linux machine with a data folder and a script that produces a report xlsx spreadsheet file on the ever changing content of the folder where it is being run. I use a xlsx2tsv script to convert it to tsv text which takes less than one second. The script takes about 1 minute to produce the spreadsheet f…
Security updates pending even with unattended-upgrades on Debian
I installed a few days ago the unattended-upgrades package to install automatically the security updates on my debian 8 system. I notice when I run : That I have a few security updates pending. What’s wrong with my configuration? Answer You need either /etc/apt/apt.conf.d/20auto-upgrades or /etc/apt/apt…
How to catch new thread in gdb console mode?
I am running my Qt app from gdb, and i want to stop when new threads creates. (when gdb prints message [New Thread address (LPW number)]. I have set breakpoint b __pthread_create_2_1. That allows me to catch most of new threads prints. but i still got few new threads that are not catched. What else can i do t…
SSH into AWS EC2 instance gives Permission denied (publickey)
I created a new EC2 Instance form my AWS Console and tried to ssh using my keyfile I was able to login into the server and did these things : installed httpd. isntalled php. installed mysql. created a new group “web” and added user apache and ec2-user to this group.Changed my default home director…
Difference in behaviour between code executed by a pthread and the main thread in x64-assembly
When writing some x64 assembly, I stumbled upon something weird. A function call works fine when executed on a main thread, but causes a segmentation fault when executed as a pthread. At first I thought I was invalidating the stack, as it only segfaults on the second call, but this does not match with the fac…
How to install hook in server?
I use Bitnami for local webserver I want try this system. But I have no experience with this script, I want understand how I can install it on my localhost. The documentation describe: how I should execute this command? Someone could explain me? Answer Bitnami developer here If you have installed an AMP Stack…
sed substitute with partial string
Is it possible to replace the last 5 characters of the line with the last 4 characters of the line in sed? My filenames can be any length but the end is always predictable i.e. the part I want to substitute is always 5 characters from the end Answer Just match them separately, and omit the undesired character…