daf@daftitanium:~$ lsusb
Bus 003 Device 101: ID 534d:2109 MacroSilicon USB Video
cat /var/log/syslog

Oct 2 11:31:13 daftitanium kernel: [738079.626765] usb 3-3: new high-speed USB device number 102 using xhci_hcd
Oct 2 11:31:13 daftitanium kernel: [738079.778290] usb 3-3: New USB device found, idVendor=534d, idProduct=2109, bcdDevice=21.00
Oct 2 11:31:13 daftitanium kernel: [738079.778298] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Oct 2 11:31:13 daftitanium kernel: [738079.778301] usb 3-3: Product: USB Video
Oct 2 11:31:13 daftitanium kernel: [738079.778303] usb 3-3: Manufacturer: MACROSILICON
Oct 2 11:31:13 daftitanium kernel: [738079.780434] usb 3-3: Found UVC 1.00 device USB Video (534d:2109)
Oct 2 11:31:13 daftitanium kernel: [738079.789530] hid-generic 0003:534D:2109.006D: hiddev5,hidraw12: USB HID v1.10 Device [MACROSILICON USB Video] on usb-0000:00:14.0-3/input4
Oct 2 11:31:13 daftitanium mtp-probe: checking bus 3, device 102: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-3"
Oct 2 11:31:13 daftitanium mtp-probe: bus: 3, device: 102 was not an MTP device
Oct 2 11:31:13 daftitanium systemd-udevd[1632161]: controlC2: Process '/usr/sbin/alsactl -E HOME=/run/alsa -E XDG_RUNTIME_DIR=/run/alsa/runtime restore 2' failed with exit code 99.
Oct 2 11:31:13 daftitanium mtp-probe: checking bus 3, device 102: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-3"
Oct 2 11:31:13 daftitanium mtp-probe: bus: 3, device: 102 was not an MTP device
Oct 2 11:31:14 daftitanium Thunar[1632166]: thunar-volman: Unsupported USB device type "usb".
Oct 2 11:31:14 daftitanium Thunar[1632194]: thunar-volman: Unsupported USB device type "snd-usb-audio".
Oct 2 11:31:14 daftitanium Thunar[1632198]: thunar-volman: Unsupported USB device type "usbhid".
Oct 2 11:31:14 daftitanium Thunar[1632203]: thunar-volman: Unsupported USB device type "snd-usb-audio".
Oct 2 11:31:14 daftitanium Thunar[1632207]: thunar-volman: Unsupported USB device type "uvcvideo".
Oct 2 11:31:14 daftitanium Thunar[1632213]: thunar-volman: Unsupported USB device type "uvcvideo"
dmesg

[726177.717306] usb 3-1.3.2.2: new full-speed USB device number 100 using xhci_hcd
[726177.821220] usb 3-1.3.2.2: New USB device found, idVendor=046d, idProduct=c52f, bcdDevice=30.00
[726177.821231] usb 3-1.3.2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[726177.821234] usb 3-1.3.2.2: Product: USB Receiver
[726177.821237] usb 3-1.3.2.2: Manufacturer: Logitech
[726177.829229] logitech-djreceiver 0003:046D:C52F.0069: hidraw9: USB HID v1.11 Mouse [Logitech USB Receiver] on usb-0000:00:14.0-1.3.2.2/input0
[726177.887265] logitech-djreceiver 0003:046D:C52F.006A: hiddev4,hidraw10: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:14.0-1.3.2.2/input1
[726177.947216] logitech-djreceiver 0003:046D:C52F.006A: device of type eQUAD step 4 DJ (0x04) connected on slot 1
[726177.955492] input: Logitech M280/320/275 as /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1.3/3-1.3.2/3-1.3.2.2/3-1.3.2.2:1.1/0003:046D:C52F.006A/0003:046D:4057.006B/input/input113
[726177.955798] logitech-hidpp-device 0003:046D:4057.006B: input,hidraw11: USB HID v1.11 Mouse [Logitech M280/320/275] on usb-0000:00:14.0-1.3.2.2/input1:1
[726185.749246] logitech-hidpp-device 0003:046D:4057.006B: HID++ 4.5 device connected.
[726997.019684] input: DAF QC (AVRCP) as /devices/virtual/input/input114
[736305.306332] usb 3-4: new high-speed USB device number 101 using xhci_hcd
[736305.457861] usb 3-4: New USB device found, idVendor=534d, idProduct=2109, bcdDevice=21.00
[736305.457869] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[736305.457871] usb 3-4: Product: USB Video
[736305.457873] usb 3-4: Manufacturer: MACROSILICON
[736305.459960] usb 3-4: Found UVC 1.00 device USB Video (534d:2109)
[736305.462657] hid-generic 0003:534D:2109.006C: hiddev5,hidraw12: USB HID v1.10 Device [MACROSILICON USB Video] on usb-0000:00:14.0-4/input4
[736440.565674] usb 3-4: USB disconnect, device number 101
[738079.626765] usb 3-3: new high-speed USB device number 102 using xhci_hcd
[738079.778290] usb 3-3: New USB device found, idVendor=534d, idProduct=2109, bcdDevice=21.00
[738079.778298] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[738079.778301] usb 3-3: Product: USB Video
[738079.778303] usb 3-3: Manufacturer: MACROSILICON
[738079.780434] usb 3-3: Found UVC 1.00 device USB Video (534d:2109)
[738079.789530] hid-generic 0003:534D:2109.006D: hiddev5,hidraw12: USB HID v1.10 Device [MACROSILICON USB Video] on usb-0000:00:14.0-3/input4

FROM: https://www.mjt.me.uk/posts/fixing-missing-macrosilicon-ms2109/

I brought a cheap (£10) HDMI-to-USB2 capture device based on the Macrosilicon 2109 – but I encountered a problem where it didn’t appear at /dev/video* when plugged in, despite dmesg showing some recognition of the device.

Fortunately, Nikola_F on the Arch Linux forums had already found the problem and offered a solution: The device is wrongly being treated as a USB audio device. You can confirm this by checking four new symlinks appear in ls -l /sys/bus/usb/drivers/snd-usb-audio/ when you insert the device.

To fix it, I created new udev rules (in a file like /etc/udev/rules.d/91-hdmi-to-usb-ms2109.rules ) to apply Nikola_F’s fix automatically:

# For HDMI-to-USB adaptor:
SUBSYSTEM=="usb", DRIVER=="snd-usb-audio", ATTRS{idProduct}=="2109", ATTRS{idVendor}=="534d", \
RUN+="/bin/sh -c 'echo -n $kernel > /sys/bus/usb/drivers/snd-usb-audio/unbind'"

SUBSYSTEM=="usb", DRIVER=="snd-usb-audio", ATTRS{idProduct}=="2109", ATTRS{idVendor}=="534d", \
ATTR{bInterfaceNumber}=="00", RUN+="/bin/sh -c 'sleep 1; echo -n $kernel > /sys/bus/usb/drivers/uvcvideo/bind'"

Give it a sudo udevadm control --reload-rules then unplug and replug, and it should start working.

This disables the audio function of the HDMI-to-USB converter, but I wasn’t using it anyway. More careful rule-writing could probably solve that problem.
Other hints for using the MS2109

I was able to stream video from the device at 1080p with

ffplay -f video4linux2 -framerate 50 -video_size 1920x1080 -input_format mjpeg /dev/video0

The device seemed to struggle if mjpeg wasn’t used – presumably a lack of USB bandwidth. If you want to use it with software you can’t convince to ask for mjpeg, you can create a loopback camera and use ffmpeg to read mjpeg from the capture card and output regular video to the loopback camera, like so:

sudo apt-get install ffmpeg v4l2loopback-utils

sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="LoopbackCam" exclusive_caps=1
ffmpeg -f video4linux2 -framerate 50 -video_size 1920x1080 -input_format mjpeg -i /dev/video0 -f v4l2 -pix_fmt yuv420p /dev/video10

more at: https://bbs.archlinux.org/viewtopic.php?pid=1919811#p1919811 and
https://www.diyaudio.com/community/threads/macrosilicon-2109-cheap-usb-hdmi-a-v-capture.357873/

Many developers still install a database on their computer and work on it.
It may be a preferable method, but using Docker takes only seconds to set up a database. I used PostgreSQL and Docker in my latest project. As a result, I have achieved efficiency and convenience. I will give you my experience with PostgreSQL and Docker.
I can start with finding the Docker image we will use. There are two easy ways to do this. I prefer to visit the Docker Hub website. Alternatively, it can be used the command below. It will list you similar results to the Docker Hub.
docker search postgresql
I will use the postgres, the official image can be obtained in the search results. I prepared a Docker command with important and necessary parameters. It can be easily customized and used this command.
docker run --name postgresqldb -e POSTGRES_USER=myusername -e POSTGRES_PASSWORD=mypassword -p 5432:5432 -v /data:/var/lib/postgresql/data -d postgres
It looks a little confused, but don’t worry. I will explain these parameters.
  • –name : I set a name for the container.
  • -e POSTGRES_USER : I set the database username.
  • -e POSTGRES_PASSWORD : I set the database password.
  • -p : 5432 port is used by default. But it can be changed this according to preference. Local port and container port can be set separately. The first port is for local, and the second is for container.
  • -v : This parameter is related to the Docker Volume feature. This is important for not losing data. With this feature, I synchronize with the folder containing the data in the database and a folder of my choice on the computer or server. When the container is closed or restarted for any reason, it can be easily started with the same data. The first path can be any folder you prefer. I set it to /data as an example. Please do not change the second path because data is in this path by default.
  • -d : I will run detached mode(background mode). If you run it without using it, the docker container will be stopped when you press the Ctrl + C combination or close the terminal screen. This is undesirable because the container should be running in the background.
  • postgres : Image name.
Let’s run the command together and see the result.
If you have encountered a similar output, you can be sure that everything is fine. You can see the working Docker containers by running the command below.
docker ps
You can also stop or restart your container using start and stop commands. In this example I set the container name as postgresqldb. You can run the start and stop commands with your own chosen name.
docker start postgresqldb
docker stop postgresqldb
You may think it took a long time because I explained the details. Don’t be biased, you can create a PostgreSQL database just by running a single Docker command.

 

Tomado de https://hackernoon.com/how-to-install-postgresql-with-docker-quickly-ki7g363m

I’ve installed 19.04 and removed dsnmasq, disabled systemd-resolve using

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved

and want to use Network Manager to set manually my DNS servers. Now I want to configure a different DNS server, so I went to the network icon on the bar and clicked Wired -> Wired Settings -> Configure -> IPV4, select Automatic (DHCP) and disable DNS as automatic, putting my desired DNS servers. Even after rebooting, my /etc/resolv.conf file now only gets 127.0.0.53, not matter what I do on the Nettwork Manager configuration. Is there a way for the /etc/resolv.conf file to be configured by Network manager?

I’ve found a solution.

First, disable systemd-resolve:

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved

Remove the symlink for resolv.conf and create a file:

rm -rf /etc/resolv.conf
touch /etc/resolv.conf
chmod a+rw /etc/resolv.conf

Now change the configuration file for Network Manager to restore the expected result: vi /etc/NetworkManager/NetworkManager.conf:

[main]
plugins=ifupdown,keyfile
# add this line
dns=default

and leave the rest of the file as is. Restart Network Manager:

sudo /etc/init.d/network-manager restart

and configure your preferred DNS servers. Done!

https://askubuntu.com/questions/1159084/make-dns-follow-configuration-from-network-manager-in-19-04

What is GRUB?

GRUB stands for Grand Unified Bootloader is the default bootloader for all linux and Unix like Operating Systems. It was first invented by Sir Erich Stefan Boleyn on year 1995. GRUB2 bootloader is used to load the kernel and then kernel loads the Operating System, In short GRUB is the Module which is used to start the Operating System.

The Versions of GRUB are GRUB and GRUB2 Bootloader and there are some changes are made in latest version of GRUB ( i.e. GRUB2 Bootloader ) like in GRUB the main configuration file was “grub.conf” but in GRUB2 bootloader its “grub.cfg“. In GRUB2 the harddisk number starts with 1 as it was 0 in pervious version of GRUB and So on. RHEL/CentOS 7 comes with GRUB2 Bootloader.

Follow the Steps to Protect the GRUB2 Bootloader with Password :

Step : 1 Generate Encrypted Password

First we have to generate encrypted password using command grub2-mkpasswd-pbkdf2. After execute the command it will ask to  enter passsword, So here you enter the password which is you want to set to protect GRUB2 Bootloader.

Note : Below the generated encrypted password is highlighted in blue color.

# grub2-mkpasswd-pbkdf2     # Use this command to Generate Encrypted Password
Enter password:
Reenter password:
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.FECBECE234528AAC47780D5B3C2A24E099DA822F6C9432407EE4A0B66EF5A691774C86E21CB6D9C19CFE96353E34475228286E25A6F12A42758B087F18D5D0F9.6C84C084FA82EEB9E9A239B752F76898C2667FB4FAB8F300A12353E1291DDA3D85F664F1CC546DFC17EB1F47765276078C3EA070F1F3B4EDCAB1F9629644CD81

So now we have the encrypted password which we have to set on GRUB2 Bootloader main configuration file which is grub.cfg. But it is Recommended that we should not edit the boot.cfg configuration file directly, So we have to copy the encrypted password on GRUB2 custom menu i.e. 40_custom which is located at /etc/grub.d/. Refer the below output.

# ls /etc/grub.d/
00_header  10_linux      20_ppc_terminfo  40_custom  README
00_tuned   20_linux_xen  30_os-prober     41_custom

Step : 2 Set the Password on GRUB2 main Configuration File

So before edit the 40_custom menu file we recommend you to take a backup using below command.

# cp /etc/grub.d/40_custom /etc/grub.d/40_custom.backup

Now edit the file using below command and enter the lines shown below which is highlighted in blue color.

# nano /etc/grub.d/40_custom   # Edit the GRUB Custom Menu
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512.10000.FECBECE234528AAC47780D5B3C2A24E099DA822F6C9432407EE4A0B66EF5A691774C86E21CB6D9C19CFE96353E34475228286E25A6F12A42758B087F18D5D0F9.6C84C084FA82EEB9E9A239B752F76898C2667FB4FAB8F300A12353E1291DDA3D85F664F1CC546DFC17EB1F47765276078C3EA070F1F3B4EDCAB1F9629644CD81

Step : 3 Update the grub.cfg File

Now we have to update the grub.cfg file by using grub2-mkconfig command, but before that let’s take the backup of grub.cfg file.

# cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.backup

Run the below command to Update the grub.cfg file.

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-7c6e54925d804adcae1a4e795e596226
Found initrd image: /boot/initramfs-0-rescue-7c6e54925d804adcae1a4e795e596226.img
done

After update the GRUB2 Bootloader main configuration file the encrypted password will set on grub.cfg file, We can check it by open the file using cat or less command.

Checking the encrypted Password in grub.cfg file

As we can see on the snapshot above the password is there on grub.cfg file on the 40_custom Section.

We are done with all required configuration, Now just restart the system to check if GRUB Bootloader is protected with password or not.

# reboot   # Restart the System

After restart the system interrupt the normal boot process by pressing SPACE BAR and select the GRUB menu as highlighted in blue color on the snapshot below and then press e to edit the GRUB.

Now it’s asking for Username and Password as shown on the snapshot below, So here just enter the Username as root and Password which we have set on Step : 1.

So after a successful authentication we able to edit the GRUB2 Bootloader as shown on the snapshot below.

This is how we can protect the GRUB2 Bootloader with Password.

If you found this article useful then Like us, Subscribe us, Share the article Or if you have any thing to say then comment on the comment box below the post.

Fuente: http://www.elinuxbook.com/how-to-protect-grub2-bootloader-with-password-in-linux/

and configure SMTP options for Gmail, Yandex or custom SMTP server…

In this tutorial we will install latest mutt (on day: 31/03/2017) from source, configure it only for email sending (no receiving or other thing) over SMTP and with SSL and use it. We doing this in CentOS 7 Minimal Linux so maybe some of packages you already have.

# Install dependencies
yum install wget gcc ncurses-devel openssl-devel cyrus-sasl-devel perl cyrus-sasl-plain

############## Variables ##############
# (version of mutt-a) #
# http://www.mutt.org/download.html #
#######################################
MUTT_VERSION="1.8.0"
#######################################

# Download and prepare
cd /usr/src
wget ftp://ftp.mutt.org/pub/mutt/mutt-${MUTT_VERSION}.tar.gz
tar zxvf mutt-${MUTT_VERSION}.tar.gz
rm -f mutt-${MUTT_VERSION}.tar.gz
cd mutt-${MUTT_VERSION}/

# Start with install - and only with needed options for mail send over SMTP
./configure --prefix=/usr --sysconfdir=/etc \
--enable-smtp \
--with-ssl \
--with-sasl \
--with-gss \
--with-gnutls \
--with-docdir=/usr/share/doc/mutt-${MUTT_VERSION} \
--enable-debug
#
make
make install

Create new .muttrc config for email servers which you use

touch ~/.muttrc
chmod 700 ~/.muttrc
vi ~/.muttrc

Gmail/Google Apps .muttrc config

################ Config za Google / Google Apps SMTP ####################
set from = "your-email-on-google-appsu-or-gmail@your-domain-or-gmail.com"
set realname = "Full name"
set smtp_url = "smtp://your-email-on-google-appsu-or-gmail@your-domain-or-gmail.com@smtp.gmail.com:587/"
set smtp_pass = "Password for your Gmail/GoogleApps email account"

Yandex .muttrc config

###################### Config za Yandex SMTP ############################
set from = "your-email@yandex.com"
set realname = "Full name"
set smtp_url = "smtps://your-email@yandex.com@smtp.yandex.com:465/"
set smtp_pass = "Password for your Yandex email account"

Custom, Shared hosting, cPanel with SSL-om .muttrc config

########## Config za Shared hosting, cPanel, with SSL ###################
set from = "your-email@your-domain.com"
set realname = "Full name"
set smtp_url = "smtps://your-email@your-domain.com@tvoj-email-server:465/"
set smtp_pass = "Password for your cPanel email"
unset ssl_verify_host

Sending check
echo "Everything is OK" | mutt -s "TEST email - mutt SMTP" your-email@current-mail.com

Fuente: kompjuteras.com

En el Master

  1. Instalo los paquetes necesarios:
    yum install nfs-utils rpcbind
  2. Editar archivos /etc/exports y agregar:
    /mbt/archivos Server_Client_IP(no_root_squash,rw,sync)
    RUTA QUE QUIERO COMPARTIR | IP DONDE LA QUIERO COMPARTIR | permisos
  3. Agrego el puerto en el FWfirewall-cmd --zone=public --add-port=2049/tcp --permanent?
    firewall-cmd --reload?
  4. Reinicio los servicio
    sservice rpcbind start
    service nfs start

En el Cliente

  1. Instalo los paquetes necesarios:
    yum install nfs-utils rpcbind?
  2. ?Iniciamos el servicio:
    service rpcbind start?
  3. ?Creamos la carpeta donde lo vamos a montar:
    mkdir -p /mnt/archivos
  4. Montamos la carpeta?:
    ?mount 192.168.2.75:/mnt/archivos /mnt/archivos

 

  1. Instalar Postfix
    # yum remove sendmail
    # yum install postfix
  2. Ponemos postfix como default MTA para el systema
    # alternatives --set mta /usr/sbin/sendmail.postfix
  3. Configuramos Postfix
    # vi  /etc/postfix/main.cf
    myhostname = mail.tecadmin.net
    mydomain = tecadmin.net
    myorigin = $mydomain
    inet_interfaces = all
    mydestination = $myhostname, localhost, $mydomain
    mynetworks = 127.0.0.0/8, /32
    relay_domains = $mydestination
    home_mailbox = Maildir/
  4. Reiniciamos postfix y lo ponemos como servicio
    # service postfix restart
    # chkconfig postfix on/
  5. Abrimos el puerto del firewall
    # firewall-cmd --permanent --add-port=25/tcp
    # firewall-cmd --permanent --add-port=25/udp
    # firewall-cmd --reload

Fuente: tecadmin.net

Para buscar archivos, el clasico find:bash-logo-small

$ find . -mtime -1

  • el . es la ruta
  • -mtime fecha de modificacion
  • -1 archivos modificados en el ultimo dia…

Alternativas:

  • -amin Cuando fue utilizado en minutos
  • -atime Cuando fue accedido en dias
  • -cmin Cuando fue creado en minutos
  • -ctime Cuando fue creado en dias
  • -mmin Cuando fue modificados en minutos

Puede ser:

-mtime -0.5
  • -1 24hs
  • -0.5 12hs
  • -0.25 6hs
  • +3 mas de 3 dias.

SNMP320x320Bueno, despues de remarla en dulce de leche, le encontre la vuelta al monitoreo via SNMP de los Centos 7.

Lo mas facil fue publicar todo via la version 1 de SNMP, y limitarlo por la IP de quien lo puede acceder a leer estos datos. Si queres usar v2 o v3, adelante, y ¡contame como te va!.

  1. Instalar las utilidades necesarias:
    yum install net-snmp-utils net-snmp
  2. Configuramos el demonio:Editar el archivo /etc/snmp/snmpd.conf, no te olvides de hacer un backup, y reemplazar el contenido por el siguiente:
    #Creo la comunidad public de solo lectura
    rocommunity public 
    
    
    #La misma puede ser consultada desde la ip 127.0.0.1 y la 192.168.150.141
    com2sec local localhost public
    com2sec net1 192.168.150.141/32 public
    
    #Asigno los grupos para que esten disponibles en v1 y v2
    group MyRo v1 local
    group MyRo v1 net1
    group MyRo v2c local
    group MyRo v2c net1
    
    #Que voy a mostrar, ¡todo!
    view all-mibs included .1 80
    
    #La idea es que quien entra no navegue, sino que sepa que busca.
    access MyRo "" v1 noauth exact all-mibs none none
    access MyRo "" v2c noauth exact all-mibs none none
    
    #No me acuerdo que hace esto ;P
    dontLogTCPWrappersConnects yes
    
    #Y lo mas importante, tus datos, para poder ubicarte y mandarte emails.
    syscontact The DBA Team diego@daf.com.ar
    syslocation Tu direccion postal
  3. Ahroa, reiniciamos el servicio del SNMP:
    systemctl restart snmpd

    en Centos 6.8

    service snmpd restart 
  4. y ahora, simplemente lo probamos:
    snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
  5. No olviden abrir el puerto del firewall:
    firewall-cmd --permanent --add-port=161/tcp
    firewall-cmd --permanent --add-port=161/udp
    firewall-cmd --reload

    en Centos 6.8 editar el /etc/iptables y agregar

    -A INPUT -p tcp -m state --state NEW -m tcp --dport 161 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m udp --dport 161 -j ACCEPT