Thursday, May 20, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Create udev rules to assign names to physical usb ports?

Posted: 20 May 2021 09:55 AM PDT

I want to use a udev rule to assign a name (or symlink) accroding to the physical usb ports regardless of the machine that is there. The "why" is below in the tl;dr.

Here's what's in my 10-local.rules for my raspberry pi.

KERNELS=="1-1.2:1.0", SUBSYSTEMS=="usb",NAME="Row1_Machine1"  KERNELS=="1-1.1.3:1.0", SUBSYSTEMS=="usb", NAME="Row1_Machine2"  KERNELS=="1-1.1.2:1.0", SUBSYSTEMS=="usb", NAME="Row1_Machine3"  KERNELS=="1-1.3:1.0", SUBSYSTEMS=="usb", NAME="Row1_Machine4"  

I tried doing a SYMLINK but that didn't work either.

tl;dr: I'm running four instances of octoprint servers to control my 3D printers which are connected by USB. From my workstation I want to be able to see which row, and what machine (spot 1, 2 3, or 4) I'm accessing. I cannot do attributes of the specific machines because they get swapped out all the time when they break down. I want the cord that runs to row 1, space 1 to ALWAYS report as that name regardless of what machine is swapped into that location.

Can I access any android device which is connected to my own router?

Posted: 20 May 2021 09:43 AM PDT

I have shared my router wifi to my neighbor. Now I want to access camera, internal storage which android device is connected to my own router without sending them any link or installing any application into there device.How can I do this with kali linux... Please help me and ADVANCE thanks.

set or pass an environment variable to a snap application (reach pulseaudio server on another machine via tcp from within a snap application)

Posted: 20 May 2021 09:40 AM PDT

dear power users and devolopers,

i am encountering some problems, adjusting to the way snap works. i always embraced all the possibilities that a GNU/Linux distribution offers me. however, i feel that snap packages are keeping these possibilities from me. not deliberatly of course. but... well, i cannot change things that need to be changed.. system configs files and applications config files, environment variables.

my distribution: ubuntu desktop 20.04 amd64

what i would like to do:

install a (snap) program that supports pulseaudio and depending on the value i set for the environment variable PULSE_SERVER, the program starts using a certain pulseaudio server or socket. i want to be able to always choose between using the local instance of pulseaudio or an instance of pulseaudio running on another machine.

i can neither find a way to successfully pass an environment variable to the command, nor to set the environment variables of the snap packages in general. (also i cannot find any real documentation or ways to adjust the snap interfaces "audio-playback","audio-record", and the deprecated "pulseaudio" ... (i just had these interfaces connected to a snap in order to test them and disconnected them afterwards)

so, a program installed with snap seems to be bound to connect to the pulseaudio socket of the host, that is beeing created by pulseaudio with the default configuration (e.g. /run/user/1000/pulse/native if started by user with UID 1000)

please can you help me finding a solution? (preferably a way to successfully set/pass the PULSE_SERVER variable, but other solutions would also be interesting)

thanks in advance

How to configure samba for a shared folder for 2 groups, each with write and read access on all files

Posted: 20 May 2021 09:31 AM PDT

I need to create a samba shared folder, 2 users must have access this folder with write and read capabilities on all files, they should be able to modify and read each others files on the full directory tree, but they should not be able to delete files only the ones they created.I really cant get my head around this problem...need some help to construct the config file and set the initial permissions.Thanks

root folder and swapfile error in Filesystem Linux Mint 20.1

Posted: 20 May 2021 09:00 AM PDT

I am new to Linux mint 20.1 Ulyssa. I saw in File System under My Computer the root folder with the error symbol, and a swap file is unknown. I also see 2 unknown volumes under Devices, but i am not sure what they are, i do not have any external devices connected to my laptop. And i never saw these Devices before. I deleted some files from snap list today. Maybe it is the reason for that? Could anyone maybe help? Thank you in advance.

root folder and swap file unknown devices un

Failed to boot STM32mp157a-dk1 using a buildroot image

Posted: 20 May 2021 08:22 AM PDT

I'm trying to boot an STM32MP157a-dk1 using an image that i made with buildroot but when i boot i got this message :

Unable to write "/uboot.env" from mmc0:4
enter image description here

Help me please !!

H.M

How to match a literal string containing an unclosed quote with ripgrep?

Posted: 20 May 2021 09:08 AM PDT

I have a file that contains the some python code. There is a line that contains the following(including the quotes)

'hello "value"'

I want to search 'hello "value" in the file. Notice the unclosed quote. I'm using ripgrep with the folowing command:

rg -F 'hello "value"

The above command is not working for the input 'hello "value" in bash/ zsh. All i want is the literal match. I have used the flag F but because of unclosed quotes in the input string it is not working at all. I also tried enclosing the input inside single/ double quotes as so:

rg -F "'hello "value"" or rg -F ''hello "value"'

The above is not working as well.

Why is it so mystifying to literal search a string with ripgrep even with the flag F which tells ripgrep to consider the input literally as it is? How do i fix it?

Add another root with different uid and name

Posted: 20 May 2021 08:29 AM PDT

I know that root has full admin rights thanks to something in the kernel that gives to uid 0 those rights.
I think that also the name "root" is defined in the kernel, right?

And the location of the home (/root) is also defined in the kernel?
I can set it anyway in the /etc/passwd file.

How can I add another root with different uid and name?
Let's call it toor as in some unix operative systems, but there toor is simply another user with uid 0.

This toor should have uid at least 1000 as standard users, since I would like to use it as my account.

I thought about it and I think that is a good idea to have an user with full admin rights.
If I set the same uid is like using root.

Some services treat root as a system user and some use it for some processes, therefore I would like to do this.
Not that I have problems but it seems better.
Furthermore some apps have root check that you have to remove if you are using root.

I use the kernel provided from my OS, Debian 10:

uname -r  5.10.0-0.bpo.5-amd64  

How can I remove duplicate line based on group name?

Posted: 20 May 2021 09:47 AM PDT

How can I remove duplicate line based on group name and keep the line with directoryId="1"?

<Group id="123" groupName="ABC" lowerGroupName="abc" active="1" local="1" createdDate="2017-08-21 09:28:30.581" updatedDate="2017-08-21 09:28:30.581" type="GROUP" directoryId="10100"/>  <Group id="456" groupName="ABC" lowerGroupName="abc" active="1" local="0" createdDate="2017-08-21 09:28:30.634" updatedDate="2017-08-21 09:28:30.634" type="GROUP" directoryId="1"/>  

My D-Bus is completely messed up. How do I fix it, or at the very least fully start from scratch?

Posted: 20 May 2021 07:21 AM PDT

I'm running an EndeavourOS (Arch-based) install with i3, and everything is mostly fine except for my D-Bus and some keyring-related issues. However, I'm pretty sure all of these are linked to D-Bus, though I'm not exactly sure how, or even what the exact issue is. One issue seems to be that the D-Bus service files are being generated improperly, as even when I completely remove them, and then pacman -Syu dbus, they regenerate without an [Install] portion.

[me@Endeavour ~]$ cat /usr/lib/systemd/system/dbus.service  [Unit]  Description=D-Bus System Message Bus  Documentation=man:dbus-daemon(1)  Requires=dbus.socket    [Service]  ExecStart=/usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only  ExecReload=/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig  OOMScoreAdjust=-900  [me@Endeavour ~]$   

I honestly don't know exactly what my issue with D-Bus even is, but will be happy to provide any information that could help narrow that down. If that doesn't work, however, how would I go about completely wiping all hints of D-Bus config files, so that I can reinstall it and hopefully get everything to just magically work?

Thanks for the help!

Receive notification new messages localhost MAC OS?

Posted: 20 May 2021 07:20 AM PDT

I need to received notification when my script backup is sucessfully. First i try to send e-mail the localhost to Thunderbird, but newer version Thunderbird haven't Unix spoolmail for configure. Is possible to do output command mail to send a notification GUI in screen?

Httpd port not available from outside

Posted: 20 May 2021 07:12 AM PDT

I found out port 7080 of my local Linux server isn't accessible externally but locally it is.

Any tips about how to resolved it?

Bash to send variable value to csv?

Posted: 20 May 2021 07:44 AM PDT

I've the following data. I've only given 2 servers here for the sake of simplicity. This servers list might be change from time to time, the same goes with the variable value.

hostname = 'server1'  var1 = 'abc'  var2 = 'xyz'  var3 = 'def'    hostname = 'server7'  var1 = 'ghi'  var2 = 'mno'  var3 = 'jkl'  

Would it be possible to send it to csv format, probably something like this?

output.csv

Hostname    Variable    Value  server1     var1        abc  server1     var2        xyz  server1     var3        def  server7     var1        ghi  server7     var2        mno  server7     var3        jkl  

At the moment, I copy paste the value manually to Ms Excel. I would like to automate this process, but not sure about the implementation yet.

I really appreciate if you could share some ideas or sample code.

Can bootloaders be placed outside the EFI directory on an ESP partition?

Posted: 20 May 2021 09:44 AM PDT

Is the EFI directory a mandatory part of the EFI standard or can bootloaders be placed in other directories.

I'm contemplating moving my whole /boot over to the ESP partition (ensuring I have a large enough ESP partition). Now Debian based distributions (and others) have scripts which expect the ESP directory mounted at /boot/efi/ putting the EFI directory hard coded at /boot/efi/EFI.

So I see two options to work with this:

  • Mount ESP to /boot and then bind mount /boot/EFI to /boot/efi/EFI to satisfy the OS scripts.
    This needs both an efi and an EFI directory on a FAT32 formatted partition so I'm not entirely happy about doing this.
  • Install the bootloader to /efi/EFI on the ESP partition and tell the bios to took elsewhere for the bootloader (eg: /efi/EFI/ubuntu/grubx64.efi)

What I don't know is whether or not the EFI directory is a mandatory part of the specification, if I'm likely to get problems in my BIOS or if I can just safely move it.

Applying numfmt on a specific column in awk

Posted: 20 May 2021 09:29 AM PDT

I'm writing a script in tcsh (yes... I know but I have to) to analyze all users disk usage in a specific directory.

In the end, I want to produce a report in the next format:

user1 1.6GB  user2 1.1GB  ..  user69 10MB  

First I'm running

find . -printf "%u  %s\n" | awk '{user[$1]+=$2}; END{ for( i in user) print i " " user[i]}' > example.tmp  

and then I managed to convert the 2nd column to human-readable size by:

awk '{ print $2 }' example.tmp | numfmt --to=iec-i --suffix=B --padding=7  

yet I was not able to merge it back in place of the previous column. Is there a way to inject the numfmt command directly into the awk summation?

I'm a little weak with 'awk' commands, so pardon my bad code.

zsh find -execdir rename "no such file or directory"

Posted: 20 May 2021 08:28 AM PDT

I'm trying to write a zsh script on MacOS Big Sur that will recursively rename some files and directories that have special characters I don't want. Been at it for days and every time I think I have it cracked, I get hit with a new problem. It's basically done, except that when I run the find command in dry run mode:

find . -d -type f -execdir rename -n -X ${=CHARACTER_SUBSTITUTIONS} {} +  

I get the correct list of files in my test folder:

'untitled file3 [].txt' would be renamed to 'untitled file3 --.txt'
'untitled file2. [].txt' would be renamed to 'untitled file2. --.txt'

But when I run it for realsies, it can't find them anymore:

find . -d -type f -execdir rename -X ${=CHARACTER_SUBSTITUTIONS} {} +  

Result:

Can't rename 'untitled file3 [].txt' to 'untitled file3 --.txt': No such file or directory
Can't rename 'untitled file2. [].txt' to 'untitled file2. --.txt': No such file or directory

Banging my head against a wall. Any help would be greatly appreciated.

In case it's relevant, CHARACTER_SUBSTITUTIONS is just a long list of the subs I want to make.

echo ${=CHARACTER_SUBSTITUTIONS}  -S [ - -S ] - -S + - -S # - -S % - -S { - -S } - -S \ - -S < - -S > - -S * - -S ? - -S $ - -S ! - -S : - -S @ - -S ` - -S | - -S ' - -S " - -S & - -S  - -S = -  

Details:
zsh
MacOS Big Sur
rename v1.601 (the Perl version)

Issue processing multiple files, counting lines

Posted: 20 May 2021 07:25 AM PDT

Sorry if it's long and confusing, but I have three files, namely cat, dog, and cow.

My code is something like this:

echo -e "Enter file name: \c"    read filename                   #saves variable   if [ -e "$filename" ]  then  total =$(wc -l $filename)       #calculate total lines in the*CAT* file   echo There are $total         #prints There are *numberoflines*  echo $total > newfile           #writes the answer into a newly created file  else  echo $filename not found  fi  

When I run the above code, the following happens:

  Enter file name : cat    There are 5 cat   

(I input cat at the prompt and I see the number of lines in the file.)

It will give me an output of 5 cat when I run the file called cat which has 5 lines in it.

But let's say when I want to run all three files at the same time, what do I have to do?

Let's say I want it to display as following

Enter file name : cat dog cow   5 cat   2 dog  14 cow  Total 21  

Unfortunately, it displays

file not found  

when I run all files at the same time, but if I run the script on the files one by one, nothing is wrong.

X11 forwarding, how to force audio to the host?

Posted: 20 May 2021 08:34 AM PDT

i am connecting from a laptop:

$ uname -a  Linux fedora 5.11.18-200.fc33.x86_64 #1 SMP Mon May 3 15:05:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux  

to a single-board-computer:

$ uname -a  Linux mobian 5.10-sunxi64 #2 SMP PREEMPT Tue Jan 12 09:55:56 UTC 2021 aarch64 GNU/Linux    

over SSH with compressed X11 forwarding:

ssh -YC user@mobian  

everything seems great except for the fact, that audio plays in the laptop and I want it to play in the remote machine. how is this achieved?


P.S. I suspect this is something fedora-specific as the same ssh -YC user@mobian connection from a different device:

$ uname -a  Linux sxmo 5.11.0 #1-postmarketos-allwinner SMP Sat Mar 27 14:48:00 UTC 2021 aarch64 GNU/Linux  

leaves the audio-output on the remote machine.


EDIT based on comments:

locally on fedora:

[user@fedora ~]$ xprop -root | grep PULSE  PULSE_COOKIE(STRING) = "28d747cacea4736118f778c450628a4b88489d1158cc10899f3bc54a078fe37b843810ebeb397abece2533b0d988569f3d01b838b2f7fa560712c78cc9d64cbba2d0e9e34f602b348ccf589d4f0bf159c9a078bf1a6e9a8140f930b2d5e4cb21cb31bf8f22112b2cfd2476f02694e3060ae9f3918e58629a49ec1fbb730c2af4dee1f42de13c0046b2f7fc664302724fbc3d27a0863e98dcede752d9451644d6f8b5e10f0a1ec88320b8686b292b6225c02c043719818a4d4041fcb60bfeef97ebfb6601f83c5d8052a64489c5507ac02876d171a6bb942f20991e0a31271c97d2ba3b9f8baef66a06affb5d33aa198be394f798622d6ffd8d2a5926a8402a08"  PULSE_SERVER(STRING) = "{f5e96850fbf948e19c0eba4f100fa72a}unix:/run/user/1000/pulse/native tcp:fedora.localdomain:4713 tcp6:fedora.localdomain:4713"  PULSE_SESSION_ID(STRING) = "2"  PULSE_ID(STRING) = "1000@f5e96850fbf948e19c0eba4f100fa72a/1985"  

remotely on mobian without -YC:

user@mobian:~$ xprop -root | grep PULSE  xprop:  unable to open display ''  

remotely on mobian with -YC:

[user@fedora ~]$ ssh user@mobian -YC    ...    user@mobian:~$ xprop -root | grep PULSE  PULSE_COOKIE(STRING) = "28d747cacea4736118f778c450628a4b88489d1158cc10899f3bc54a078fe37b843810ebeb397abece2533b0d988569f3d01b838b2f7fa560712c78cc9d64cbba2d0e9e34f602b348ccf589d4f0bf159c9a078bf1a6e9a8140f930b2d5e4cb21cb31bf8f22112b2cfd2476f02694e3060ae9f3918e58629a49ec1fbb730c2af4dee1f42de13c0046b2f7fc664302724fbc3d27a0863e98dcede752d9451644d6f8b5e10f0a1ec88320b8686b292b6225c02c043719818a4d4041fcb60bfeef97ebfb6601f83c5d8052a64489c5507ac02876d171a6bb942f20991e0a31271c97d2ba3b9f8baef66a06affb5d33aa198be394f798622d6ffd8d2a5926a8402a08"  PULSE_SERVER(STRING) = "{f5e96850fbf948e19c0eba4f100fa72a}unix:/run/user/1000/pulse/native tcp:fedora.localdomain:4713 tcp6:fedora.localdomain:4713"  PULSE_SESSION_ID(STRING) = "2"  PULSE_ID(STRING) = "1000@f5e96850fbf948e19c0eba4f100fa72a/1985"  

locally on mobian:

user@mobian:~$ xprop -root | grep PULSE  PULSE_COOKIE(STRING) = "8139d0fdc04752954ff9018ca4006d741d1b8aef9ed8fdd041184fda6080bad0fbf0e0ca00ecc6eacd5b4adde99d84ac33932773da3b8dd99a2adaeb085cd622daefbd75ab193690185f856457ac9541a1e4075a8217484df1bd136d00bc6c0c80abef6e3ee86daed144c33fece49cd9a896c3bb7dcb6520441f21c48a7f045693d9d6e47e2f7bc32ce6ce4b958df2842f8d7298d690e48a1343fbed5310fa50475acaf928047802978cf0f417502c298332b56e5a66a75b97e9ddb59a739e4d34c8f63fbb7ce883b35ed115c44639db11d5e543665978dfcbe43b5d8d41677ee68195c153103986283d80b2ce3239559f12d2928b9ffb05054e3cca70ff277d"  PULSE_SERVER(STRING) = "{e5ca38bfe5be445f838be0328a1c5f33}unix:/run/user/1000/pulse/native tcp:mobian.localdomain:4713 tcp6:mobian.localdomain:4713"  PULSE_ID(STRING) = "1000@e5ca38bfe5be445f838be0328a1c5f33/615"  

v4l-utils for CentOS Stream 8?

Posted: 20 May 2021 09:52 AM PDT

I have problems with webcam and I need v4l-utils package. As per this page:

https://centos.pkgs.org/7/centos-x86_64/v4l-utils-0.9.5-4.el7.x86_64.rpm.html

It was availbel in CentOS 7 official repos. However for CentOS Stream 8 I cannot find it:

  $ sudo dnf search v4l-utils  Last metadata expiration check: 13:59:10 ago on Sat 15 May 2021 10:19:51 CEST.  No matches found.  [admin@localhost ~]$ sudo dnf search v4l2-utils  Last metadata expiration check: 13:59:55 ago on Sat 15 May 2021 10:19:51 CEST.  No matches found.  
  1. Why was the package deprecated?
  2. What has replaced it?
  3. Any other hints for uvcvideo diagnostics?

Sysdig does not show exit event for write syscall

Posted: 20 May 2021 10:00 AM PDT

I'm trying to capture write to stdout (or stderr), but apparently the actual data is related to the exit event. I wrote a simple C program that writes to stdout and stderr.

#include <stdio.h>  int  main()  {      printf("Standard output\n");      fprintf(stderr, "Standard error\n");      return 0;  }  

I compile it with 'gcc example.c -o example'. If I now start sysdig with

sudo sysdig --unbuffered -X syscall.type=write and proc.name=example  

and run ./example, I get to following output

91612 20:12:09.273696708 2 example (12909) > write fd=1(<f>/dev/pts/1) size=16   91613 20:12:09.273726879 2 example (12909) > write fd=2(<f>/dev/pts/1) size=15   

No data is shown, and only the enter event (>) is shown. Also the stdout chisel doesn't produce any output

sudo sysdig --unbuffered -X -c stdout syscall.type=write and proc.name=example  

Is the problem in my example program or where? If I run sysdig without any parameters, it sometimes shows also the exit event for some processes.

I'm running Ubuntu 20.04 distribution, and the version of sysdig is 0.26.4. For more information on sysdig, see GitHub repository of sysdig .

PF states table give preoccupant results

Posted: 20 May 2021 07:22 AM PDT

I freshly install openBSD on a VPS. It is my first time. I did nothing but check the firewall setup, say pf. I ran pfctl -sa and it show

all tcp IP0:22 <- IP1:rnd ESTABLISHED:ESTABLISHED  all tcp IP0:22 <- IP2:rnd ESTABLISHED:ESTABLISHED  all tcp IP0:22 <- IP3:rnd FIN_WAIT_2:FIN_WAIT_2  all tcp IP0:22 <- IP4:rnd TIME_WAIT:TIME_WAIT  

with IP0 my server IP, IP1 my local IP, but IP2, IP3, IP4, are completely unknown IP to me. There is some repetitions of the last two lines with diferent port number (rnd). I tried to understand the information in the table with few success, I am completely a newby in web traffic and so on...

Should I be preoccupated with that second line which suggest a third party is connected to my server? Thanks!

Troubleshooting sSMTP: Authorization failed

Posted: 20 May 2021 08:49 AM PDT

My requirements are:

  • send an email from the terminal (for the sake of batch processing)
  • attach a pdf file to that email (the pdfs would be identical for all recipients, except for a watermark)
  • specify a reply-to address (myusername@gmail.com)

I've tried the "simplest answer to sending one-line messages via gmail is to use ssmtp", and several variants, and keep getting:

laptop sSMTP[19226]: Authorization failed (535 5.7.8 https://support.google.com/mail/?p=BadCredentials d13sm3920147qkj.27 - gsmtp)

Google settings:

  • IMAP enabled
  • Allow less secure apps is ON

For each ssmtp.conf setup that I tried, I have done DisplayUnlockCaptcha just before:

$echo "Testing...1...2...3" | ssmtp myusername@gmail.com  

Looking at the stated thread alone, there is no consensus as to how /etc/ssmtp/ssmtp.conf should be set up:

  • mailhub=smtp.gmail.com:587 vs 465
  • UseTLS=YES vs UseSTARTTLS=Yes (or both?)
  • hostname=localhost vs whatever was put there as the default (in my case, laptop)

Could someone make a suggestion to sort this out, and possibly paste in full a working conf file?

There is a claim in a thread from 2017, that:

You can not use external applications with your normal password, you must go to https://security.google.com/settings/security/apppasswords

Is that the case? (I'm not able to do it)

What alternatives are there?

PS:

  • OS: Linux Mint 19 Tara
  • ssmtp was tested from a clean install preceded by upgrade/update
  • a couple of years ago, I was a able to send emails using the same OS (earlier version)
  • To make sure the value of AuthPass is correct, I used it to manually log into my google account.

How to set cron job for every 5 hours

Posted: 20 May 2021 07:50 AM PDT

Can I use below code to set cron job for every 5 hours?

0 */5 * * * script.sh  

What time my script.sh will be executed?

  1. 0000, 0500, 1000, 1500, 2000, 0100, 0600, 1100, 1600, 2100 and so on...

OR

  1. 0000, 0500, 1000, 1500, 2000, 0000, 0500, 1000, 1500, 2000 and so on...

If we can not set cron job for every 5 hours with this traditional method, is there any other way to set such job?

How to sharing Android VPN with Linux?

Posted: 20 May 2021 09:01 AM PDT

I have a rooted galaxy note5 with Android 7, and an Asus laptop with Ubuntu 16.04. I like to share my phone VPN connection with my laptop. I tried some apps like VPNTether,DF tethering fix, TetherNet, Pdanet+, etc. but they didn't work!

I think I could use the VPNTheter on windows 10 and it worked, but they don't work on Ubuntu!

Also I tested two Wi-Fi and USB cable methods.

Also I found this method but couldn't understand what it says in numbers 6 and 7 ?

  1.  You need a rooted device    2.  Make sure you have a VPN app, like OpenVPN or DroidVPN ( I use DroidVPN and its the best)    3.  Download Terminal Emulator    4.  Activate your hotspot and connect to your VPN    5.  Launch Terminal emulator and on the first line type "su" (without the quotes) and press enter      6. Copy and paste this to the Terminal Emulator. Make sure to paste to a new folder using Root Browser first and copy to T.E. in the exact format as shown below:    iptables -t filter -F FORWARD  iptables -t nat -F POSTROUTING  iptables -t filter -I FORWARD -j ACCEPT  iptables -t nat -I POSTROUTING -j MASQUERADE  ip rule add from 192.168.43.0/24 lookup 61  ip route add default dev tun0 scope link table 61  ip route add 192.168.43.0/24 dev wlan0 scope link table 61  ip route add broadcast 255.255.255.255 dev wlan0 scope link table 61      7. That's about it. Also, be sure to make a folder with Root Browser and paste the code there, as this resets after re-boot. It worked on my LG G3 on android 4.4.2  

How to replace the first line using sed?

Posted: 20 May 2021 09:43 AM PDT

Hi i am trying to replace the header line from my file using the sed command as mentioned below,

sed "1s/.*/$new_header/" Test_file.csv   

The above line replaces the header and prints in stdout , But How can i redirect the output to new file or replace in the files directly ?

sed "1s/.*/$new_header/" Test_file.csv > new_file.csv   

The above command works fine , But i want to redirect to same file.

Add a user for Postgres on Mac

Posted: 20 May 2021 10:00 AM PDT

I've had a very difficult time trying to set up a postgres database. I am using Mac OS X 10.9.2.

I am using this tutorial: http://tutorials.jumpstartlab.com/topics/environment/environment.html

The Postgres section can be found 2/3 of the way down the page.

After installing Homebrew and commanding brew install postgresql

we create a database by:

sudo mkdir -p /usr/local/pgsql/data  sudo chown postgres:postgres /usr/local/pgsql/data  sudo su postgres  initdb -D /usr/local/pgsql/data  createuser `whoami`  

When I do

sudo chown postgres:postgres /usr/local/pgsql/data  

it returns the error

chown: postgres: illegal user name  

I can't seem to find a simple command to add a user - adduser and useradd have returned "command not found", with and without sudo. I am not sure what the problem is. Is there a simple command I can do?

Is there a method for making Google Chrome open textareas in vim?

Posted: 20 May 2021 07:45 AM PDT

I used to use Firefox on a daily basis but have switched to Google Chrome, and have been using it for 2+ years now. The one plugin that I miss is this one, It's All Text!. This plugin allowed for the textarea to be opened into a separate vim or gvim window where I could do editing and then save the contents when done, back to Firefox.

The closes thing I've found is this plugin is TextAid, but I find it a bit of kludge since it requires a separate web server to be kept up.

I'd really prefer not having to use TextAid, does anyone know of any alternative methods to achieving this using Chrome?

"Wrong version of libnet" when configuring nemesis

Posted: 20 May 2021 08:00 AM PDT

Whenever I try to configure Nemesis it stops at "checking libnet version....no" and claims I have the wrong version. I have checked my libnet folder to make sure, and I do have the right version. Version 1.0.2a. So why is it believing that I have the wrong version?

Configuration session:

dividan-System nemesis-1.4 # ./configure --with-libnet-includes=/usr/nembuild/Libnet-1.0.2a/include --with-libnet-libraries=/usr/nembuild/Libnet-1.0.2a/lib  checking for a BSD-compatible install... /usr/bin/install -c  checking whether build environment is sane... yes  checking for gawk... gawk  checking whether make sets $(MAKE)... yes  checking build system type... x86_64-unknown-linux-gnu  checking host system type... x86_64-unknown-linux-gnu  checking for style of include used by make... GNU  checking for gcc... gcc  checking for C compiler default output file name... a.out  checking whether the C compiler works... yes  checking whether we are cross compiling... no  checking for suffix of executables...   checking for suffix of object files... o  checking whether we are using the GNU C compiler... yes  checking whether gcc accepts -g... yes  checking for gcc option to accept ANSI C... none needed  checking dependency style of gcc... none  checking for gcc option to accept ANSI C... none needed  checking for gcc... (cached) gcc  checking whether we are using the GNU C compiler... (cached) yes  checking whether gcc accepts -g... (cached) yes  checking for gcc option to accept ANSI C... (cached) none needed  checking dependency style of gcc... (cached) none  checking how to run the C preprocessor... gcc -E  checking for egrep... grep -E  checking whether gcc needs -traditional... no  checking for an ANSI C-conforming const... yes  checking for gawk... (cached) gawk  checking for a BSD-compatible install... /usr/bin/install -c  checking whether ln -s works... yes  checking for fabs in -lm... yes  checking for inet_ntoa in -lnsl... yes  checking for socket in -lsocket... no  checking for hstrerror in -lresolv... yes  checking for libnet_build_ip in -lnet... yes  checking for ANSI C header files... yes  checking whether time.h and sys/time.h may both be included... yes  checking for sys/types.h... yes  checking for sys/stat.h... yes  checking for stdlib.h... yes  checking for string.h... yes  checking for memory.h... yes  checking for strings.h... yes  checking for inttypes.h... yes  checking for stdint.h... yes  checking for unistd.h... yes  checking for unistd.h... (cached) yes  checking errno.h usability... yes  checking errno.h presence... yes  checking for errno.h... yes  checking for strings.h... (cached) yes  checking netdb.h usability... yes  checking netdb.h presence... yes  checking for netdb.h... yes  checking limits.h usability... yes  checking limits.h presence... yes  checking for limits.h... yes  checking machine/endian.h usability... no  checking machine/endian.h presence... no  checking for machine/endian.h... no  checking sys/time.h usability... yes  checking sys/time.h presence... yes  checking for sys/time.h... yes  checking sys/param.h usability... yes  checking sys/param.h presence... yes  checking for sys/param.h... yes  checking arpa/inet.h usability... yes  checking arpa/inet.h presence... yes  checking for arpa/inet.h... yes  checking netinet/in.h usability... yes  checking netinet/in.h presence... yes  checking for netinet/in.h... yes  checking libnet.h usability... no  checking libnet.h presence... no  checking for libnet.h... no       ERROR!  Libnet header not found, go get it from     http://www.packetfactory.net/projects/libnet/     or use the --with-libnet-* options, if you have it installed     in unusual place  dividan-System nemesis-1.4 #  

Guide I followed exactly - http://insecurety.net/?p=54

After more attempts, the guide stops at "checking for libnet.h" instead of checking the version. I have checked where it is talking about and yes there is a libnet.h file in it.

config.log extracts (full text: http://pastebin.com/dgb4BjBq):

This file contains any messages produced by compilers while  running configure, to aid debugging if configure makes a mistake.    It was created by configure, which was  generated by GNU Autoconf 2.59.  Invocation command line was      $ ./configure --with-libnet-includes=/usr/nembuild/Libnet-1.0.2a/include --with-libnet-libraries=/usr/nembuild/Libnet-1.0.2a/lib    …    configure:5276: checking libnet.h usability  configure:5288: gcc -c -g -O2 -Wall -funroll-loops -pipe  -I/usr/nembuild/Libnet-1.0.2a/include -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -I/usr/local/include -I/sw/include conftest.c >&5  In file included from conftest.c:70:0:  /usr/nembuild/Libnet-1.0.2a/include/libnet.h:87:8: warning: missing terminating " character [enabled by default]  /usr/nembuild/Libnet-1.0.2a/include/libnet.h:87:2: error: #error "byte order has not been specified, you'll  /usr/nembuild/Libnet-1.0.2a/include/libnet.h:88:1: error: unknown type name 'need'  /usr/nembuild/Libnet-1.0.2a/include/libnet.h:88:1: error: stray '#' in program  /usr/nembuild/Libnet-1.0.2a/include/libnet.h:88:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'define'  /usr/nembuild/Libnet-1.0.2a/include/libnet.h:88:10: error: unknown type name 'define'  /usr/nembuild/Libnet-1.0.2a/include/libnet.h:89:50: warning: missing terminating " character [enabled by default]  /usr/nembuild/Libnet-1.0.2a/include/libnet.h:89:1: error: missing terminating " character  configure:5294: $? = 1  configure: failed program was:  | /* confdefs.h.  */  |   | #define PACKAGE_NAME ""  | #define PACKAGE_TARNAME ""  | #define PACKAGE_VERSION ""  | #define PACKAGE_STRING ""  | #define PACKAGE_BUGREPORT ""  | #define PACKAGE "nemesis"  | #define VERSION "1.4"  | #define LINUX 1  | #define HAVE_LIBM 1  | #define HAVE_LIBNSL 1  | #define HAVE_LIBRESOLV 1  | #define HAVE_LIBNET 1  | #define STDC_HEADERS 1  | #define TIME_WITH_SYS_TIME 1  | #define HAVE_SYS_TYPES_H 1  | #define HAVE_SYS_STAT_H 1  | #define HAVE_STDLIB_H 1  | #define HAVE_STRING_H 1  | #define HAVE_MEMORY_H 1  | #define HAVE_STRINGS_H 1  | #define HAVE_INTTYPES_H 1  | #define HAVE_STDINT_H 1  | #define HAVE_UNISTD_H 1  | #define HAVE_UNISTD_H 1  | #define HAVE_ERRNO_H 1  | #define HAVE_STRINGS_H 1  | #define HAVE_NETDB_H 1  | #define HAVE_LIMITS_H 1  | #define HAVE_SYS_TIME_H 1  | #define HAVE_SYS_PARAM_H 1  | #define HAVE_ARPA_INET_H 1  | #define HAVE_NETINET_IN_H 1  | /* end confdefs.h.  */  | #include <stdio.h>  | #if HAVE_SYS_TYPES_H  | # include <sys/types.h>  | 

No comments:

Post a Comment