Skip to content

Tag: unix

bash does not get root permissions with setuid program

I have the following home-grown implementation of su: To allow for proper execution, the permissions and ownership information are set accordingly: When I invoke a shell, such as /bin/sh, I am able to modify root-owned files and directories: However, /bin/bash doesn’t seem to get root permissions: Answe…

Piping To Grep Is Giving Too Many Results

I’m trying to check whether a particular service is running via a Linux terminal, and the following command doesn’t seem to be filtering the results as expected. Not sure what I’m doing wrong… This produces several lines of output, including, for example, I’m not sure why this is…

Login script using Python and SQLite

I’m trying to create a login script using SQLite to store the user data. Any ideas on how to to that? I have research over hours and found nothing of the kind. I would appreciate any help! 🙂 This is what I got so far: But it always returns Login failed… I want to check the input “user”…

Date manipulation in awk variable : Non Military Format

In the mentioned code : | awk ‘{ print $1, $2 }’ AWK $2 is having “Thu Nov 19 17:00:00 2015” in it. I want to manipulate this date String there only in inline awk in Non Military format “Thu Nov 19 05:00:00 PM 2015”. Please help. Answer This line should give you the expecte…

How to find whether a given address is in heap or in stack

I have a requirement to find whether a given address is in heap or in stack. Is there a reliable way to do this in Linux? I have thought about the following approach assuming that the stack will grow downward and heap will grow up towards stack. How reliable is this solution? We don’t use gcc split-stac…

Running a script in terminal using Linux

Im trying to run this script in the terminal but its not working and says permission denied. scriptEmail is filename. scriptEmail is written as follows: My read write permission Answer As for permissions: Check that your shebang is at the very top of your file, and that it starts exactly with #!; # ! will not…

linux cmp utility output: what is a “line”?

Could someone tell me what the “line” number represents in the output of a cmp command? I ask this because, first, I can’t find it explained anywhere. Second, I am getting results comparing a set of files where the “char” outputs are identical (as expected) but the “line&#8…