Monday, March 21, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


My nmcli hotspot broke down since an update, how can I troubleshoot the cause?

Posted: 21 Mar 2022 07:42 AM PDT

Hey I got a fedora desktop PC in my student dorm that I use as a hotspot. I use a hotspot created with nmcli dev wifi hotspot con-name "$name" ssid "$name" password "$password"

I have been using this for the last few years and had no issues with it. Last week I did some updates and since then most of my devices can't connect to the hotspot anymore.

The Machines I have are: 2 Latops(work and privat), Iphone, and Nintendo switch.

  • The Switch still connects with no issues.
  • My work laptop did not work.
  • My privat laptop did work, but then I updated and it stopped working.
  • My Iphone does not connect anymore, I did an update on that but it worked after the update
  • My desktop (the one running the hotspot) also did an update, before that there were no issues but I did the updates at the same time
  • My laptops can still connect to my iphone hotspot

Im really not sure which device is the cause. I can connect to the hotspot of my iphone so that makes me think my desktop pc is the reason. But then I was also able to connect with my laptop before updating.

How can I check what the cause of all this is? And is it possible to undo dnf update transaction? Maybe that would fix my issue

Insert a text at a certain position with sed command on an xml file

Posted: 21 Mar 2022 07:39 AM PDT

I'm trying to figure out how to insert a text in an xml file with sed command. I started to try some basic commands with sed :

sed -i -e ' <property name="prop1" ref="ANOTHER_BEAN" /> ' my_config_file.xml    

it's adding this line but not in the position that I want

The problem for my specific case is that the text should be add to a certain position (certain bean as it's a java config file)

Example

 <bean id="BEAN_ID_1"      class="com.toto.BeanClass1"      scope="prototype">      <property name="prop1" ref="ANOTHER_BEAN_1" />      <property name="prop2" ref="BEAN1" />   </bean>    <bean id="BEAN_ID_2"      class="com.toto.BeanClass2"      scope="prototype">      <property name="prop_1" ref="ANOTHER_BEAN_2" />      <property name="prop_2" ref="BEAN2" />   </bean>  

I want to add this property to the bean named 'BEAN_ID_1' before the enclosing tag

 <property name="property" ref="ANOTHER_BEANXXX" />  

so the output will be :

 <bean id="BEAN_ID_1"      class="com.toto.BeanClass1"      scope="prototype">      <property name="prop1" ref="ANOTHER_BEAN_1" />      <property name="prop2" ref="BEAN1" />      <property name="property" ref="ANOTHER_BEANXXX" />   </bean>    <bean id="BEAN_ID_2"      class="com.toto.BeanClass2"      scope="prototype">      <property name="prop_1" ref="ANOTHER_BEAN_2" />      <property name="prop_2" ref="BEAN2" />   </bean>   

PS: I can't rely on line number since in production I have no Idea how is the file

Can anybody help me on this ? Thanks a lot

How to unmount all other drives at boot

Posted: 21 Mar 2022 07:36 AM PDT

So, I got an Ubuntu running from an external drive, which I am using at different laptops. I got one with Windows, and one with a Lubuntu (this laptop has only got 16 gb internal storage). What I am afraid of, that Ubuntu will write to one of my other systems, and make them unusable. I am trying to find a way to automatically unmount all other drives that the system detects. Any ideas?

Symmetric Permutations MAXIMA

Posted: 21 Mar 2022 07:23 AM PDT

I would like to attribute a value of permutations like this:

A:[a,b,c]:value permutations(A)

I will have the 6 permutations of A as 6 lists, can I attribute a function to these 6 lists, for example:

[a,b,c] : 1 * value [a,c,b]: (-1)^a+b+c * values [b,a,c]:(-1)^a+b+c * values ...

I hope I am clear

Best regards

Echo contents of for loop automatically

Posted: 21 Mar 2022 07:35 AM PDT

I often use a for loop to i.e. convert a bunch of file formats. In some cases, where text transformations or variables occur, it would be nice to check if the substitutions were performed correctly.

for i in *; do convert $i ${i%jpg}png; done  

Is there an easy way to show the performed command? Following the example above, something along the lines of:

convert image1.jpg image1.png    # command output  convert image2.jpg image2.png    # command output    # ...  

Why do I need to specify `-o auto` for join's `-e` option to work?

Posted: 21 Mar 2022 07:09 AM PDT

With the following two simple files:

a.txt

1 a  2 b  5 c  

b.txt

2 x  4 y  5 z  

The following command does not behave like expected:

$ join -a 1 -a 2 -e 0 a.txt b.txt   1 a  2 b x  4 y  5 c z  

I would expect the option -e 0 to fill up missing values with zeroes. However, the following does work:

$ join -a 1 -a 2 -e 0 -o auto a.txt b.txt   1 a 0  2 b x  4 0 y  5 c z  

Reading documentation from $ man join, I see no connection between -o and -e that would make the above behaviour meaningful. Instead, I find it misleading that a useless -o auto needs to be inserted into my command for -e 0 to work..

Is there an explanation? Or should I file this as a bug to coreutils?

How to make a directory only accessible by local user not remote root user?

Posted: 21 Mar 2022 06:50 AM PDT

I have a CentOS 7.9 machine, logging in as my normal user account and access a directory that has my forms and SSN in it. Other users in the network who has the root account can ssh to my box and access these files (Everyone can ssh to any machine on the network and become root). How can I prevent them from doing so?

Add a disk into volume group

Posted: 21 Mar 2022 07:08 AM PDT

my environment is configured like that ORACLE LINUX 8.X i want to extend a filesystem mounted as /a01 with xfs filesystem. i have an existing virtual disk with 50Go /dev/sdc partitionned with fdisk /dev/sdc1. my current volume group

    pvs              PV         VG        Fmt  Attr PSize   PFree        /dev/sda2  ol        lvm2 a--  146.00g 4.00m        /dev/sdb1  oracle_vg lvm2 a--   99.00g    0        /dev/sdc1  oracle_vg lvm2 a--  <50.00g    0    vgs       VG        #PV #LV #SN Attr   VSize   VFree    ol          1   8   0 wz--n- 146.00g 4.00m    oracle_vg   2   1   0 wz--n-  99.00g    0     lvs        LV            VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert        home          ol        -wi-ao----   5.00g        root          ol        -wi-ao----   5.00g        root00        ol        -wi-ao---- 100.00g        swap          ol        -wi-ao----  16.00g        tmp           ol        -wi-ao----   5.00g        var           ol        -wi-ao----   5.00g        var_log_audit ol        -wi-ao----   5.00g        var_tmp       ol        -wi-ao----   5.00g        lv_a01        oracle_vg -wi-a-----  99.00g  

the output of pvdisplay -m /dev/sdc1

--- Physical volume ---    PV Name               /dev/sdc1    VG Name               oracle_vg    PV Size               <50.00 GiB    Allocatable           NO    PE Size               99.00 GiB    Total PE              0    Free PE               0    Allocated PE          0    PV UUID               8rmxdf-zv2M-SkRQ-YNtt-Y6jK-3Afa-73PrpJ      --- Physical Segments ---  

Why i cannot extend my lv and my vg ? thanks for the help .

------I removed the disk from the vg

pvcreate /dev/sdc1    Physical volume "/dev/sdc1" successfully created.    pvs    PV         VG        Fmt  Attr PSize   PFree    /dev/sda2  ol        lvm2 a--  146.00g   4.00m    /dev/sdb1  oracle_vg lvm2 a--   99.00g      0    /dev/sdc1            lvm2 ---  <50.00g <50.00g  vgs    VG        #PV #LV #SN Attr   VSize   VFree    ol          1   8   0 wz--n- 146.00g 4.00m    oracle_vg   1   1   0 wz--n-  99.00g    0  vgextend oracle_vg /dev/sdc1    Volume group "oracle_vg" successfully extended   vgs    VG        #PV #LV #SN Attr   VSize   VFree    ol          1   8   0 wz--n- 146.00g 4.00m    oracle_vg   2   1   0 wz--n-  99.00g    0  

Configuring VPN connection

Posted: 21 Mar 2022 06:13 AM PDT

Was configuring VPN connection with IKEv2 with strongswan. When i was to connect from ubuntu to vpn server, i need to copy CA from server, into the /etc/ipsec.d/cacerts folder on my own laptop. Then I'm adding into /etc/ipsec.secrets login on my home machine, and password, that are in the same file on server, which acts as VPN. After i need to configure /etc/ipsec.conf, that is going to connect to VPN. The content of the file is as follows

config setup    conn ikev2-rw      right=server_domain_or_IP      # This should match the `leftid` value on your server's configuration      rightid=server_domain_or_IP      rightsubnet=0.0.0.0/0      rightauth=pubkey      leftsourceip=%config      leftid=username      leftauth=eap-mschapv2      eap_identity=%identity      auto=start      ...  

What if i have a few servers, and i want to switch between them. Either one is not working, or the speed is not satisfying. It requires to have two different certificates. If those VPN servers configured to have different certificates, and different IP addresses, is there a way to switch between VPN servers easier, then going into the setting, and manually changing IPs and logins?

PCS illuminant is not D50

Posted: 21 Mar 2022 06:28 AM PDT

I am trying to convert the following JPEG image into PNG:

but I fail to understand what ImageMagick is trying to tell me.

Steps:

% curl -o icc_app2.jpg  https://cloud.githubusercontent.com/assets/1139185/23364727/3da8c474-fcce-11e6-9f39-7e074e78aa33.jpg  % convert icc_app2.jpg icc_app2.png  convert-im6.q16: profile 'icc': 0h: PCS illuminant is not D50 `icc_app2.png' @ warning/png.c/MagickPNGWarningHandler/1668.  

with:

% apt-cache policy imagemagick-6.q16  imagemagick-6.q16:    Installed: 8:6.9.11.60+dfsg-1.3    Candidate: 8:6.9.11.60+dfsg-1.3    Version table:   *** 8:6.9.11.60+dfsg-1.3 500          500 http://deb.debian.org/debian bullseye/main amd64 Packages          100 /var/lib/dpkg/status  

I understand that I can use the --quiet option to get rid of the message. But my point is to craft a valid PNG file. I fail to understand what this message is trying to tell me. In the end I want a PNG equivalent image of the original JPEG with a (possibly modified?) ICC profile.

How to start the service in Linux

Posted: 21 Mar 2022 06:05 AM PDT

I wrote such a tutorial script to run the service mysleep

The service just on the command start starts sleep 10d and on the command stop kills the process on its pid

#!/bin/bash    case "$1" in  start)     echo Сервис mysleep был запущен &     sleep 10d &     echo $!>/var/run/mysleep.pid     ;;  stop)     kill `cat /var/run/mysleep.pid` &     rm /var/run/mysleep.pid     ;;  restart)     $0 stop     $0 start     ;;  status)     if [ -e /var/run/mysleep.pid ]; then        echo Сервис mysleep активен, его идентификатор равен `cat /var/run/mysleep.pid`     else        echo Сервис mysleep еще не был запущен        exit 1     fi     ;;  *)     echo "Usage: $0 {start|stop|status|restart}"  esac    exit 0  

After running the command service mysleep start I get an error Failed to start mysleep.service: Unit mysleep.service not found.

Copy all unique files from multiple directories into one. Rename duplicate names & preserve extension file.png, file (1).png

Posted: 21 Mar 2022 06:02 AM PDT

I'd like copy all unique files from multiple directories into one. Rename duplicate names & preserve extension file.png, file (1).png etc.

At least I'd like to merge all files from all directories and preserve extension. Obviously rsync -b — bad solution. I can delete duplicate files after than by rdfind, for example.

Can deleted groups still function through primary groups in Linux?

Posted: 21 Mar 2022 06:26 AM PDT

With an analyzing program I built, I ran into a bug where a user had a primary group set to a since then deleted group (no longer in the /etc/group file). To scope the impact I ran some tests and run into what appears to be some strange behaviors:

  • Even if a group is deleted, if it is the primary group of a user and there are rights associated to its ID in the sudoers file, the user will still get those rights.
  • If a group is created afterwards, it may get the same group ID as the previously deleted group and the user's primary ID then becomes that group.

It appears that for the rights check in sudoers, both the /etc/group file and the primary group of the user are searched separately and the primary group therefore doesn't have to be an actual group?

Question: Is this correct? What am I missing? I'm not sure why the client had a primary group deleted, but this doesn't seem right.

Device specs:

Linux Ubuntu 20.04.1

5.13.0-1017-azure x86_64

Steps to reproduce:

  1. Create new user: sudo useradd testuser This created both the user and a separate new group with the same name, which became its primary group.

  2. Check groups of new user: groups testuser Result: 'testuser : testuser'

  3. Delete the new group via command: sudo groupdel testuser Got the following error message: groupdel: cannot remove the primary group of user 'testuser'

  4. Delete the new group via manual file adjustment: sudo nano /etc/group This did work as I could simply delete the last line with the relevant group and save the file

  5. Check groups of new user again: groups testuser Result: 'testuser : groups: cannot find name for group ID 1003 1003'

  6. Try to login as the new user, after removing the group Success, could still login

  7. Try to execute sudo command with the new user Failed as expected: 'testuser is not in the sudoers file. This incident will be reported'

  8. Log back in as privileged account (which does have sudo rights)

  9. Give the group name removed in step 4 sudoer rights in the sudoers file: sudo nano /etc/sudoers Then add this to the file: %testuser ALL=(ALL:ALL) ALL

  10. Login as new user and execute sudo command again Still failed: 'testuser is not in the sudoers file. This incident will be reported'

  11. Give the group id removed in step 4 sudoer rights in the sudoers file: sudo nano /etc/sudoers Then add this to the file: %#1003 ALL=(ALL:ALL) ALL

  12. Login as new user and execute sudo command again Success, user now has SUDO rights (I had really hoped this not to be the case)

  13. Create a new group: sudo groupadd testforid New group created with ID 1003

  14. Check groups of new user again: groups testuser Result: 'testuser : testforid'

In what segment does mmap allocate memory

Posted: 21 Mar 2022 06:06 AM PDT

I thought first that it was the heap, but it seems to allocate memory in a different place. radare2 tags it as folowing:

0x00007fb07dacd000 - 0x00007fb07dace000 - usr 4K s rw- unk2 unk2

Since it is not the heap, what do we call the segment where mmapped memory is located?

Bash script with getopt fall into "default" the second argument

Posted: 21 Mar 2022 07:04 AM PDT

I am re-learning getopt with a tiny script in bash, but the second parameters fall into default branch of case.

#! /bin/bash    LONG_OPTION_LIST=(      "arg-a"      "arg-b:"      "arg-c:"  )  SORT_OPTION_LIST=(      "a"      "b:"      "c:"  )  # Read the parameters  opts=$(getopt -q \    --longoptions "$(printf "%s," "${LONG_OPTION_LIST[@]}")" \    --name "$(basename "$0")" \    --options "$(printf "%s" "${SORT_OPTION_LIST[@]}")" \    -- "$@"  )  eval set -- "$opts"    echo "##$1##"  echo "##$2##"  echo "##$3##"  echo "##$4##"  echo "##$5##"  echo "#########"    argA=0  # It it is same a queue (process the head) because $1 and $2  for arg  do      echo $1      echo $2      echo "--------"      case "$arg" in          --arg-a | -a)              argA=1              shift 1              ;;          --arg-b | -b)              argB=$2              shift 2              ;;          --arg-c | -c)              argC=$2              shift 2              ;;          *)              echo "###$1###"              echo "break"              echo "_________"              break              ;;      esac  done    echo "argA $argA"  echo "argB $argB"  echo "argC $argC"  

And some examples:

user@pc:/tmp$ ./test.bash -a  ##-a##  ##--##  ####  ####  ####  #########  -a  --  --------  --    --------  ###--###  break  _________  argA 1  argB   argC   user@pc:/tmp$ ./test.bash -b 111  ##-b##  ##111##  ##--##  ####  ####  #########  -b  111  --------  --    --------  ###--###  break  _________  argA 0  argB 111  argC   user@pc:/tmp$ ./test.bash -a -b 111  ##-a##  ##-b##  ##111##  ##--##  ####  #########  -a  -b  --------  -b  111  --------  --    --------  ###--###  break  _________  argA 1  argB 111  argC   user@pc:/tmp$ ./test.bash -b 111 -a  ##-b##  ##111##  ##-a##  ##--##  ####  #########  -b  111  --------  -a  --  --------  ###-a###  break  _________  argA 0  argB 111  argC   

How can i get permission to copy files from one folder to another?

Posted: 21 Mar 2022 07:38 AM PDT

So i was trying to copy some files from one folder to another using the cp command, but when tried it gave me this error:

debian@OCR-1:/mnt/rootfs/boot$ ls  MLO             omap3-overo-storm-arbor43c.dtb  uEnv.txt  zImage-3.18-20150915  initrd-ubi.img  u-boot.img   zImage  debian@OCR-1:~$ cp /mnt/rootfs/boot/MLO /var/log/MLO  cp: can't create '/var/log/MLO': Permission denied  

so then i tried to execute the same command with sudo but it didn't work either:

debian@OCR-1:~$ sudo cp /mnt/rootfs/boot/MLO /var/log/MLO  -bash: sudo: command not found  

After i tried to see the permissions of each folder:

debian@OCR-1:/var$ ls -l  total 5  drwxr-xr-x  9 root root 4096 May 16  2018 archive  drwxr-xr-x  4 root root    0 Jan  1 00:00 lib  drwxrwxr-x  2 root root    0 Jan  1 00:56 lock  drwxr-xr-x 11 root root 1024 Jan  1 00:00 log  drwxrwxr-x  4 root root    0 Jan  1 00:01 run  drwxrwxr-x  3 root root    0 Jan  1 00:00 spool  drwxr-xr-x  3 root root    0 Jan  1 00:00 www    debian@OCR-1:/mnt/rootfs/boot$ ls -l  total 11160  -rwxr-xr-x 1 root root   59148 Jan 24  2014 MLO  -rwxr-xr-x 1 root root 1220219 Jan  1 00:16 initrd-ubi.img  -rwxr-xr-x 1 root root   69463 Jan 24  2014 omap3-overo-storm-arbor43c.dtb  -rwxr-xr-x 1 root root  470632 Jan 24  2014 u-boot.img  -rwxr-xr-x 1 root root    2038 Jan  1 00:16 uEnv.txt  -rwxr-xr-x 1 root root 4798000 Jan  1 00:20 zImage  -rwxr-xr-x 1 root root 4798000 Jan 24  2014 zImage-3.18-20150915  

but then i don't know what to do next because i don't know how to understand the data. Can somebody help me solve this problem?

[EDIT]

So i tried to see if i had root access, but is shows me this:

debian@OCR-1:~$ id  uid=1000(debian) gid=1002(debian) groups=4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),100(users),106(netdev),108(i2c),1000(admin),1001(spi),1002(debian)  debian@OCR-1:~$ whoami  debian  debian@OCR-1:~$ su -  su: must be suid to work properly  

And then i tried to install sudo, but i can't:

debian@OCR-1:~$ apt update && apt install -y sudo  -bash: apt: command not found  

Raspberry Pi bridge eth0\eth1

Posted: 21 Mar 2022 07:01 AM PDT

I have a Raspberry Pi and a device/sensor which connects to the Pi via eth1. Eth0 is connected to my router, giving access to the internet.

I'd like to bridge my eth0/eth1, so that traffic from the device can go to the internet.

I'd like to do this using a netplan. Here is what I have so far:

network:      version: 2      renderer: networkd  ethernets:      eth0:          dhcp4: no      eth1:          dhcp4: no  bridges:      br0:          interfaces: [eth0, eth1]  

How can I tell my system to use this netplan? Is it configured correctly? Do I need to use dhcp4: yes anywhere and for the br0, do I need to include any additional parameters?

I really have no idea what I am doing here, so any help would be appreciated.

Using `openssl` to display all certificates of a PEM file

Posted: 21 Mar 2022 06:00 AM PDT

I can use the following command to display the certificate in a PEM file:

openssl x509 -in cert.pem -noout -text  

But it will only display the information of the first certificate. A PEM file may also contain a certificate chain. How can I display all contained certificates?

How to check if a terminal can display undercurl from within a bash/zsh script?

Posted: 21 Mar 2022 06:28 AM PDT

How to check if a terminal can display undercurl from within a bash/zsh script?

In a recent project I used undercurl escape sequence for output printed by a zsh script. It works well in modern terminals, but Apple's Terminal.app shows that as a reversed background-foreground. It would be nice to be able to detect if the terminal has the ability to display undercurl, and only then use undercurl or default to regular underline.

Minor kernels updates applicability for people running custom kernel builds

Posted: 21 Mar 2022 07:45 AM PDT

Imagine the situation.

You're running a custom kernel which you compiled from the vanilla sources using your own .config. A new minor update gets released, let's say 5.16.16 which was released just yesterday, while you're already running 5.16.15.

How can you determine for sure that 5.16.16 contains changes that actually affect your setup? Should you compile and reboot into it or it has zero changes for you and you may safely skip it?

I was thinking of this:

  • Apply the patch
  • Revert the kernel version back to the one you're already running
  • Build the kernel and install it into a temporary directory
  • Binary compare the resulting files

This will not work. Modules might match (I'm not even totally sure about that) but vmlinuz will be different because it contains the build date/time and the number which identifies how many times the kernel has been built, i.e. Linux localhost.localdomain 5.16.15 #1 SMP PREEMPT Thu Mar 17 11:20:15 2022 x86_64 x86_64 x86_64 GNU/Linux - you can see #1.

This has to be skipped somehow.

In other words I'm looking for a reproducible kernel build which ignores any local variables.

There's TuxMake but I cannot figure out how to use my custom .config and nothing else.

How can I make GNU mailutils to use an external SMTP server?

Posted: 21 Mar 2022 05:27 AM PDT

Does anybody on this planet know what the equivalent GNU mailutils command to the following looks like? Is this even possible without a local MTA with mailutils? Using s-nail it works as intended.

s-nail -s "$subject" -S $smtp_server -r $from_user $to <<<$message  

according to the GNU mailutils manual I tried:

mail --subject "$subject" \   --set smtp=$smtp_server \   --exec "set sendmail=smtp://$smtp_server" \   --append "From:$from_user" \   $to <<<$message  

mail: Cannot open mailer: Input/output error
mail: cannot send message: Input/output error

this is not a duplicate of can-i-set-up-system-mail-to-use-an-external-smtp-server as they used a local MTA or heirloom-mailx or s-nail or other tools. I am using Debian.

Cannot record microphone with SimpleScreenRecorder

Posted: 21 Mar 2022 06:35 AM PDT

As mentioned in the title, I'm unable to simultaneously record my headset microphone and my desktop audio when using SimpleScreenRecorder in KDE Neon 5.24.

In the "Audio Input" section of the recording settings, I selected "PulseAudio" as Backend, whereas for Source I've tried both "Built-in Audio Analog Stereo" as well as "Monitor of Built-in Audio Analog Stereo" (see below):

enter image description here

When selecting "Built-in Audio Analog Stereo", the microphone gets recorded but the desktop audio does not, while the situation is exactly the opposite when I select "Monitor of Built-in Audio Analog Stereo" (can record desktop audio but not headset microphone).

Does anybody have an idea of how to solve this issue?

dd command on running system makes backup image with older versions of files

Posted: 21 Mar 2022 04:26 AM PDT

I use these commands in a script to create an image backup of an SD card while a Linux OS is running on it -- OpenWrt.

The rootfs is 1000MiB so I only dd the first 300 blocks. This way I can restore the boot and root filesystems in the backup to any other sd card I like using Win32 Disk Imager, (selecting "Read Only Allocated Partitions")

imagesPath="/mnt/usb/openwrt/BackupOfImages/"  image_file=${imagesPath}OpenWrt-Image-$(date "+%Y-%m-%d-%H-%M-%S").img.gz    sync  dd if=/dev/mmcblk0 bs=4M count=300 | pv | gzip > $image_file  

However, when I gunzip and mount the created .img file I see that certain files I was working on... the latest versions of them were not backed up but instead the backup contains older versions of those files. Recent edits I made before running the backup script are not included in the backup. I thought that using the sync command before the dd command in my script would flush caches so the latest versions of all files would be backed up?

I know that best practice is to unmount the filesystems on the sd card before running the dd command but my use case will not allow me to do that. What else am I doing wrong?

Cheers.

how can I set a right click and open terminal in context menu

Posted: 21 Mar 2022 05:01 AM PDT

I am using Debian 10.1 See the following screenshot. right click and no terminal I am used to a Ubuntu environment where I do a right click and terminal opens. Is this kind of a thing possible for Debian environment. If it is possible please let me know how can I enable it?

If the same can be added to context menu like in the screenshot I see following three options
1)Change Background
2)Display Settings
3)Settings
Here can I add the option in black menu in screenshot to open terminal (I am not referring to the Ctrl+Alt+T to open terminal) some how tweaking gnome?

edit

based on discussion below package gnome-tweak-tool and nautilus-extension-gnome-terminal were installed. Then when required setting were not found as in videos here
1)https://youtu.be/scOYZZIyoM4
2) https://www.youtube.com/watch?v=scOYZZIyoM4&feature=youtu.be
gsettings get org.gnome.desktop.background show-desktop-icons
has been set to true
gsettings set org.gnome.desktop.background show-desktop-icons true

Still the desired results have not been achieved. What I want is I do a right click on any area on my desktop and in the context menu I want to see an option to open terminal.

udevadm rule works using "udevadm test" but not with "udevadm trigger"

Posted: 21 Mar 2022 07:04 AM PDT

I have created a simple rule called "99-usb.rules" that simply names a tty port of a specific device

KERNEL=="ttyACM*", ATTRS{idVendor}=="2341", NAME="mydevice"  

This rule works fine when I run a udevadm test with the command

udevadm test $(udevadm info -q path -n /dev/ttyACM0)  

Running this command causes "/dev/mydevice" to appear, and I can communicate with my usb device through "mydevice". The problem is, I can't get this rule to be triggered outside of the test environment. I have tried "udevadm control -R" and "udevadm trigger" aswell as disconnecting and reconnecting the device and rebooting my system. Any ideas why "udevadm trigger" would fail? I am using udev version 173 on OS OpenWrt Barrier Breaker 14.07.

Find latest files

Posted: 21 Mar 2022 05:11 AM PDT

How do I find out the most recently accessed file in a given directory?

I can use the find command to list out all files modified/accessed in last n minutes. But here in my case, I'm not sure when the last file was modified/accessed? All that I need is to list all the files which were accessed/modified very recently among all other sub-files or sub-directories, sorted by their access/modified times, for example.

Is that possible?

Automount post-unmount script

Posted: 21 Mar 2022 05:22 AM PDT

My intention is to spin-down an external USB drive after 20 minutes of not being used. In the normal case I would use hdparm for this but unfortunately this doesn't work on my external USB drive. It gives me errors like this:

hdparm -S240 /dev/sdc    /dev/sdc:   setting standby to 240 (20 minutes)  SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  

Then I head of sdparm.

sdparm --flexible -C stop /dev/sdc      /dev/sdc: SAMSUNG   HD153WI   

It spins down the disk for less than one second and then immediately spins up again. Even if the filesystem is not mounted.

Then I found out that

eject /dev/sdc  

indeed spins down the disk but also unmounts it.

The next idea was to use automount to mount the drive when someone accesses its mount-path in the filesystem. Mounting works but after the drive unmounts, it doesn't spin down. What I want to do is to execute the eject command as above after automount unmounts the drive.

Do you have any ideas how to do that? Or even better do you have an easier solution?

Restricting who can send to an email address

Posted: 21 Mar 2022 06:01 AM PDT

I'd like to do so that only certain From: addresses can send to an email address (mailing list) on an Ubuntu system running Postfix.

Understanding the Postfix the manuals are requires a lot of knowledge, so I'm hoping to get a complete recipe I can use. Currently this is what I have:

/etc/postfix/main.cf:  smtpd_recipient_restrictions =    check_recipient_access hash:/etc/postfix/protected_destinations  smtpd_restriction_classes = insiders_only  insiders_only = check_sender_access hash:/etc/postfix/insiders, reject    /etc/postfix/protected_destinations:  protected.list@example.com insiders_only    /etc/postfix/insiders:  allowed.user@example.com OK  another.allowed.user@example.com OK  

This gives:

fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit  

I am open to any suggestions. It doesn't have to be Postfix. It can be procmail or any other standard solution.

Note: the recipient is a mailing list, and thus does not have a user account on the system account. So any solution must work without an account.

Current mailing list implementation

/etc/postfix/virtual:  protected.list@example.com user1@example.com, user2.example.com, ...  

No comments:

Post a Comment