title: Point USB phone to specific /dev/ttyACM using udev

text: We have a `Nagios` + `check_mk` setup on Ubuntu 12.04 LTS server with `smstools` for sending text message notifications. We are using an old Nokia 6230 phone connected by a USB cable, though I do not remember the vendor symbol of the cable. Occasionally the device becomes unresponsive - apparently the `tty` device address changes from `/dev/ttyACM0` to `/dev/ttyACM1` or the other way around. According to the `smstools` log:               2013-05-28 16:51:16,3, GSM1: Could not send character A, cause: Input/output error     2013-05-28 16:51:18,3, GSM1: Could not send character A, cause: Input/output error      and nothing more in fact (I haven't used the full debug mode though). After the restart of the `smstools` service it is:               2013-05-28 22:29:09,3, GSM1: Cannot open serial port /dev/ttyACM0, error: No such file or directory      It is possible that some of these occurrences were caused by one of our tech guys inadvertently and unknowingly disconnecting the phone for a few seconds while connecting some other device. I cannot be sure though. **The question is, how do I make the phone always use the same`tty` address?** I suppose there is no problem with using `udev` rules for that, but I have little experience with those. `lsusb` output for the phone is:               Bus 002 Device 004: ID 0421:040f Nokia Mobile Phones 6230 GSM Phone      It is a live production server monitoring some 250 hosts and I have not another phone at hand for experiments at the moment, so I cannot really test it by trial and error myself. **EDIT**. The output of `udevadm info -q all -n /dev/ttyACM1 --attribute-walk`:                 looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.1/tty/ttyACM1':         KERNEL=="ttyACM1"         SUBSYSTEM=="tty"         DRIVER==""            looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.1':         KERNELS=="2-1.6:1.1"         SUBSYSTEMS=="usb"         DRIVERS=="cdc_acm"         ATTRS{bInterfaceNumber}=="01"         ATTRS{bAlternateSetting}==" 0"         ATTRS{bNumEndpoints}=="01"         ATTRS{bInterfaceClass}=="02"         ATTRS{bInterfaceSubClass}=="02"         ATTRS{bInterfaceProtocol}=="01"         ATTRS{supports_autosuspend}=="1"         ATTRS{bmCapabilities}=="6"            looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6':         KERNELS=="2-1.6"         SUBSYSTEMS=="usb"         DRIVERS=="usb"         ATTRS{configuration}==""         ATTRS{bNumInterfaces}=="11"         ATTRS{bConfigurationValue}=="1"         ATTRS{bmAttributes}=="e0"         ATTRS{bMaxPower}=="  8mA"         ATTRS{urbnum}=="391970"         ATTRS{idVendor}=="0421"         ATTRS{idProduct}=="040f"         ATTRS{bcdDevice}=="0550"         ATTRS{bDeviceClass}=="02"         ATTRS{bDeviceSubClass}=="00"         ATTRS{bDeviceProtocol}=="00"         ATTRS{bNumConfigurations}=="1"         ATTRS{bMaxPacketSize0}=="64"         ATTRS{speed}=="12"         ATTRS{busnum}=="2"         ATTRS{devnum}=="4"         ATTRS{devpath}=="1.6"         ATTRS{version}==" 1.10"         ATTRS{maxchild}=="0"         ATTRS{quirks}=="0x0"         ATTRS{avoid_reset_quirk}=="0"         ATTRS{authorized}=="1"         ATTRS{manufacturer}=="Nokia"         ATTRS{product}=="Nokia 6230"            looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1':         KERNELS=="2-1"         SUBSYSTEMS=="usb"         DRIVERS=="usb"         ATTRS{configuration}==""         ATTRS{bNumInterfaces}==" 1"         ATTRS{bConfigurationValue}=="1"         ATTRS{bmAttributes}=="e0"         ATTRS{bMaxPower}=="  0mA"         ATTRS{urbnum}=="59"         ATTRS{idVendor}=="8087"         ATTRS{idProduct}=="0024"         ATTRS{bcdDevice}=="0000"         ATTRS{bDeviceClass}=="09"         ATTRS{bDeviceSubClass}=="00"         ATTRS{bDeviceProtocol}=="01"         ATTRS{bNumConfigurations}=="1"         ATTRS{bMaxPacketSize0}=="64"         ATTRS{speed}=="480"         ATTRS{busnum}=="2"         ATTRS{devnum}=="2"         ATTRS{devpath}=="1"         ATTRS{version}==" 2.00"         ATTRS{maxchild}=="6"         ATTRS{quirks}=="0x0"         ATTRS{avoid_reset_quirk}=="0"         ATTRS{authorized}=="1"            looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2':         KERNELS=="usb2"         SUBSYSTEMS=="usb"         DRIVERS=="usb"         ATTRS{configuration}==""         ATTRS{bNumInterfaces}==" 1"         ATTRS{bConfigurationValue}=="1"         ATTRS{bmAttributes}=="e0"         ATTRS{bMaxPower}=="  0mA"         ATTRS{urbnum}=="24"         ATTRS{idVendor}=="1d6b"         ATTRS{idProduct}=="0002"         ATTRS{bcdDevice}=="0302"         ATTRS{bDeviceClass}=="09"         ATTRS{bDeviceSubClass}=="00"         ATTRS{bDeviceProtocol}=="00"         ATTRS{bNumConfigurations}=="1"         ATTRS{bMaxPacketSize0}=="64"         ATTRS{speed}=="480"         ATTRS{busnum}=="2"         ATTRS{devnum}=="1"         ATTRS{devpath}=="0"         ATTRS{version}==" 2.00"         ATTRS{maxchild}=="2"         ATTRS{quirks}=="0x0"         ATTRS{avoid_reset_quirk}=="0"         ATTRS{authorized}=="1"         ATTRS{manufacturer}=="Linux 3.2.0-38-generic ehci_hcd"         ATTRS{product}=="EHCI Host Controller"         ATTRS{serial}=="0000:00:1d.0"         ATTRS{authorized_default}=="1"            looking at parent device '/devices/pci0000:00/0000:00:1d.0':         KERNELS=="0000:00:1d.0"         SUBSYSTEMS=="pci"         DRIVERS=="ehci_hcd"         ATTRS{vendor}=="0x8086"         ATTRS{device}=="0x1e26"         ATTRS{subsystem_vendor}=="0x1043"         ATTRS{subsystem_device}=="0x84ca"         ATTRS{class}=="0x0c0320"         ATTRS{irq}=="23"         ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f"         ATTRS{local_cpulist}=="0-3"         ATTRS{numa_node}=="-1"         ATTRS{dma_mask_bits}=="32"         ATTRS{consistent_dma_mask_bits}=="32"         ATTRS{enable}=="1"         ATTRS{broken_parity_status}=="0"         ATTRS{msi_bus}==""         ATTRS{companion}==""         ATTRS{uframe_periodic_max}=="100"            looking at parent device '/devices/pci0000:00':         KERNELS=="pci0000:00"         SUBSYSTEMS==""         DRIVERS==""      I am not sure which attributes from which parent tree level I am to use. I tried with `SUBSYSTEM=="usb",ATTRS{product}=="Nokia 6320",NAME="ttyACM*",SYMLINK+="nokia"` and variations (`SYMLINK` - without `+`; `KERNEL=="2-1.6"`, without `NAME` and so on), all in `/etc/udev/rules.d/10-local.rules` file. I just get no symlink or no noticeable change at all. **Perhaps the problem is with the way the rules were applied** - I cannot afford to reboot the machine and I hoped I won't have to send a tech to the server room only for plugging in and out a USB cable. I used `/etc/init.d/udev restart`, `udevadm control --reload-rules` and `udevadm trigger` with some combinations of `\--attr-match=vendor="Nokia"`, `\--attr-match=product="Nokia 6320"` and so on, as described in this answer. Should I just send a tech to plug the thing in and out or buy another (cheap) phone for tests?


title: Openswan ipsec hub and spoke setup is not working

text: I have configured Hub and Spoke using openswan ipsec. Tunnel is immediately getting UP but the problem is:               Spoke1 can ping/access HUB's LAN and vice-versa (S1 -- HUB && HUB -- S1)     Spoke2 can ping/access HUB's LAN and vice-versa (S1 -- HUB && HUB -- S2)      But,               Spoke1 can **not** ping/access Spoke2 and vice-versa (**S1 -- S2 && S2 -- S1 NOT WORKING**)      Configurations:               Hub: 10.103.6.7/23          LAN: 10.1.0.0/16     Spoke1: 10.103.6.40/23      LAN: 10.1.2.0/24     Spoke2: 10.103.6.97/23      LAN: 10.1.1.0/24      Configuration on Spoke1: (`/etc/ipsec.conf`)               config setup         nat_traversal=yes         oe=off         protostack=netkey          conn NGpassthrough         left=10.1.2.1         right=0.0.0.0         leftsubnet=10.1.2.0/24         rightsubnet=10.1.2.0/24         authby=never         type=passthrough         auto=route          conn NG         right=10.103.6.7         rightsubnet=10.1.0.0/16         left=10.103.6.40         leftsubnet=10.1.2.0/24         leftnexthop=10.103.6.1         leftupdown="ipsec _updown --route yes"         auto=start         leftid=10.103.6.40         rightid=10.103.6.7         #x_rightdynamic=yes         authby=secret         compress=no         failureshunt=drop         dpddelay=15         dpdtimeout=60         dpdaction=restart         pfs=yes         ike=aes128-md5-modp1024,aes192-md5-modp1024,aes256-md5-modp1024,aes128-sha1-modp1024,aes192-sha1-modp1024,aes256-sha1-modp1024,3des-md5-modp1024,3des-sha1-modp1024,aes128-md5-modp1536,aes192-md5-modp1536,aes256-md5-modp1536,aes128-sha1-modp1536,aes192-sha1-modp1536,aes256-sha1-modp1536,3des-md5-modp1536,3des-sha1-modp1536,aes128-md5-modp2048,aes192-md5-modp2048,aes256-md5-modp2048,aes128-sha1-modp2048,aes192-sha1-modp2048,aes256-sha1-modp2048,3des-md5-modp2048,3des-sha1-modp2048         esp=aes128-md5,aes192-md5,aes256-md5,aes128-sha1,aes192-sha1,aes256-sha1,3des-md5,3des-sha1      Configuration on HUB: (/etc/ipsec.conf)               config setup         nat_traversal=yes         oe=off         protostack=netkey          conn NGpassthrough         left=10.1.0.1         right=0.0.0.0         leftsubnet=10.1.0.0/16         rightsubnet=10.1.0.0/16         authby=never         type=passthrough         auto=route          conn NG         right=10.103.6.40         rightsubnet=10.1.2.0/24         left=10.103.6.7         leftsubnet=10.1.0.0/16         leftnexthop=10.103.6.1         leftupdown="ipsec _updown --route yes"         auto=start         leftid=10.103.6.7         rightid=10.103.6.40         #x_rightdynamic=yes         authby=secret         compress=no         failureshunt=drop         dpddelay=15         dpdtimeout=60         dpdaction=restart         pfs=yes         ike=aes128-md5-modp1024,aes192-md5-modp1024,aes256-md5-modp1024,aes128-sha1-modp1024,aes192-sha1-modp1024,aes256-sha1-modp1024,3des-md5-modp1024,3des-sha1-modp1024,aes128-md5-modp1536,aes192-md5-modp1536,aes256-md5-modp1536,aes128-sha1-modp1536,aes192-sha1-modp1536,aes256-sha1-modp1536,3des-md5-modp1536,3des-sha1-modp1536,aes128-md5-modp2048,aes192-md5-modp2048,aes256-md5-modp2048,aes128-sha1-modp2048,aes192-sha1-modp2048,aes256-sha1-modp2048,3des-md5-modp2048,3des-sha1-modp2048         esp=aes128-md5,aes192-md5,aes256-md5,aes128-sha1,aes192-sha1,aes256-sha1,3des-md5,3des-sha1               conn NG1passthrough         left=10.1.0.1         right=0.0.0.0         leftsubnet=10.1.0.0/16         rightsubnet=10.1.0.0/16         authby=never         type=passthrough         auto=route          conn NG1         right=10.103.6.97         rightsubnet=10.1.1.0/24         left=10.103.6.7         leftsubnet=10.1.0.0/16         leftnexthop=10.103.6.1         leftupdown="ipsec _updown --route yes"         auto=start         leftid=10.103.6.7         rightid=10.103.6.97         #x_rightdynamic=yes         authby=secret         compress=no         failureshunt=drop         dpddelay=15         dpdtimeout=60         dpdaction=restart         pfs=yes         ike=aes128-md5-modp1024,aes192-md5-modp1024,aes256-md5-modp1024,aes128-sha1-modp1024,aes192-sha1-modp1024,aes256-sha1-modp1024,3des-md5-modp1024,3des-sha1-modp1024,aes128-md5-modp1536,aes192-md5-modp1536,aes256-md5-modp1536,aes128-sha1-modp1536,aes192-sha1-modp1536,aes256-sha1-modp1536,3des-md5-modp1536,3des-sha1-modp1536,aes128-md5-modp2048,aes192-md5-modp2048,aes256-md5-modp2048,aes128-sha1-modp2048,aes192-sha1-modp2048,aes256-sha1-modp2048,3des-md5-modp2048,3des-sha1-modp2048         esp=aes128-md5,aes192-md5,aes256-md5,aes128-sha1,aes192-sha1,aes256-sha1,3des-md5,3des-sha1      Configuration on Spoke2: (/etc/ipsec.conf)               config setup         nat_traversal=yes         oe=off         protostack=netkey               conn NGpassthrough         left=10.1.1.1         right=0.0.0.0         leftsubnet=10.1.1.0/255.255.255.0         rightsubnet=10.1.1.0/255.255.255.0         authby=never         type=passthrough         auto=route          conn NG         right=10.103.6.7         rightsubnet=10.1.0.0/16         left=10.103.6.97         leftsubnet=10.1.1.0/255.255.255.0         leftnexthop=10.103.6.1         auto=start         leftid=10.103.6.97         rightid=10.103.6.7         #x_rightdynamic=yes         authby=secret         compress=no         failureshunt=drop         dpddelay=15         dpdtimeout=60         dpdaction=restart         pfs=yes         ike=aes128-md5-modp1024,aes192-md5-modp1024,aes256-md5-modp1024,aes128-sha1-modp1024,aes192-sha1-modp1024,aes256-sha1-modp1024,3des-md5-modp1024,3des-sha1-modp1024,aes128-md5-modp1536,aes192-md5-modp1536,aes256-md5-modp1536,aes128-sha1-modp1536,aes192-sha1-modp1536,aes256-sha1-modp1536,3des-md5-modp1536,3des-sha1-modp1536,aes128-md5-modp2048,aes192-md5-modp2048,aes256-md5-modp2048,aes128-sha1-modp2048,aes192-sha1-modp2048,aes256-sha1-modp2048,3des-md5-modp2048,3des-sha1-modp2048         esp=aes128-md5,aes192-md5,aes256-md5,aes128-sha1,aes192-sha1,aes256-sha1,3des-md5,3des-sha1      Route added on Spoke1:               10.1.0.0/16 via 10.1.2.1 dev br0 (lan interface)      Route added on HUB:               10.1.1.0/24 via 10.1.0.1 dev br0 (lan interface)     10.1.2.0/24 via 10.1.0.1 dev br0 (lan interface)      Route added on Spoke2:               10.1.0.0/16 via 10.1.1.1 dev br-lan (lan interface)      Packets are coming in HUB's PREROUTING table but not getting in FORWARD table or INPUT table. I have removed routes and flushed iptable too. But still facing same issue.


title: Where is the best location for finding information on /yum?

text: So I'm trying install `php-mcrypt` on one server and `git-core` on another server. It seems like locating packages is where I'm falling short. (just learning server administration) I'm very ignorant of repositories and how they play into the whole installation bit. I know that I need to add additional repositories, but that all confuses me and I never know if I did it right, or if I need to update after... I'm just confused. Can you tell me how to manage my `yum` repositories? what commands to use and where I should find repositories. how I can search all of the repositories for a certain package. Just the basic `yum` repositories 101.


title: How to see if an interface is connected in Centos/Linux

text: With Centos installed on a server with 2 onboard ethernet ports, how can I check which port has an IP? In windows you can go to network & sharing center and you can see the network interface with a red X to show that the cable is unplugged. In Centos what command can I run to check which interface is connected or unplugged.


title: What information is sent from client to the server when a SSH connection is established?

text: So let's say I'm on machine A and connect to machine B, and then from there I connect to machine C (with three different usernames). So the SSH connections are:               A (john) --> B (eli) --> C(bill)          john@A ~ $ ssh eli@B     eli@B  ~ $ ssh bill@C     bill@C ~ $      My questions are:   1. What information, other than the originating IP and port (as in `$SSH_CONNECTION` variable), is sent when a SSH connection is established?      * For example, what information about machine A is known to machine B?      * Is it possible for B to know that the username of the user corresponding to the current connection is `john` on machine A?   2. In the above schema, is it possible for machine C to know that the user is actually coming from machine A?


title: How do I make an application beep when I click on it to launch it?

text: Summary: I use Debian with LXDE desktop environment. On the Panel that runs along the bottom of the desktop, there are small program icons (such as for File Manager, Konsole, Kate editor). When I single-click on them, the application should be launched. Could you tell me please, how to cause a beep to occur when my click has truly caused the application to launch. Full Details: The reason that I want to do the above is because often, when I click on one of these icons, NOTHING HAPPENS. The application doesn't launch (after waiting the usual few seconds for it to launch). So I have to click a second time on the icon to make it launch. Sometimes, when the mouse pointer is over the icon, the "description bubble" appears (you know, saying what that icon launches). I get the feeling that sometimes (not always) that this bubble is interfering with the clicking on the icon, perhaps stopping the click being registered. So I'd like to HEAR a beep to tell me that the application has definitely been launched. This is so that if it HASN'T been launched, I can click the icon again straight away, and don't have to wait a few seconds to discover that it wasn't launched.


title: ssh-agent on CentOS 6.5 keeps "disabling" itself

text: I recently installed `git` on my CentOS 6.5 system. During the process I setup a `key/pair` for `GitHub` so I don't have to enter a password for every `git` process. I did this by adding the `rsa` file to `ssh-agent` which worked fine. About an hour or so later I received this message while doing a `git push`:               Permission denied (publickey).     fatal: The remote end hung up unexpectedly      I did:               eval $(ssh-agent)      which started it back up again and then re-added the `rsa` file again to the `ssh-agent` So I guess there's a setting that is turning off `ssh-agent` every so often. Coming from Ubuntu, I'm not used to this behavior so what configuration do I need to change in order to keep `ssh-agent` ON and persist the keys?


title: How to prevent files from getting deleted on reboot?

text: Every time I reboot my Linux VM, all the previous files and folders get deleted. How can I prevent this?


title: Keyboard shortcut to set gnome-terminal tab title

text: I like to work in Linux without using the mouse, because of that I would like to know if there is any method to set a keyboard shortcut to set gnome- terminal tab title.


title: How should I go about setting up vim-pathogen plug-ins for a group as a user with no root permissions?

text: I do not have root permission on a linux cluster, but I would like to share my vim-plugins to all other members of a linux group using vim-pathogen. We have a group-accessible folder, so that's where I can store all my vim-pathogen files; if I can maintain the files in my account I would prefer that (as I have everything done through a git repo). Should I request the admin to source a vim file, change /etc/bashrc etc.? I want to ask in a way that would involve the admin the least and let me have ownership over the content of vim plug-ins. For example, I have syntax files useful for software that we write, and would like to share them with my working group. A vim blogger here shows in his .vimrc http://of-vim-and- vigor.blogspot.com/2012/05/my-vimrc.html               " Initialize Plugin Manager     "---------------------------     " https://github.com/Raimondi/vim-pathogen     " Raimondi's pathogen allows multiple bundle dirs and     " provides a command interface to interrogate, enable and     " disable plugins.          call pathogen#infect('bundle/shared', 'bundle/local')          " bundle/shared contains plugins used by all     " bundle/local is for personal plugins      Would I just ask the admin to add in a line to source another vim file that I can manage for my group?


title: Using Multiple Desktop environments on fedora

text: Is it possible to add a lightweight DE, say LXDE of XFCE, to fedora so that I can choose to boot into either?   Would I be able to select in grub or would there be an intermediate step? That way I have an option to not have to wait for GNOME to start if I want to just to a little light browsing.


title: VMWare CenOS files disappear after reboot

text: Solved: I used install to hard disk file from CentOS desktop. after instalation I have two CentOS in VMWare player. The new installation saves everything. I've installed VMWare player and CentOS on it. I create file.txt on desktop in CentOS. After I restart CentOS, the file disappears. How can I make CentOS save files?


title: Are the major, minor number unique

text: Are the `major, minor` number Unique? Do we have any citations and reference to it?               NAME   MAJ:MIN RM   SIZE RO MOUNTPOINT     sda      8:0    0 465.8G  0      ├─sda1   8:1    0 298.2M  0      ├─sda2   8:2    0     3G  0      ├─sda3   8:3    0 458.7G  0 /     ├─sda4   8:4    0     1K  0      └─sda5   8:5    0   3.8G  0      sr0     11:0    1  1024M  0


title: AT&T UNIX System V Release 4 - How do I create a new "Administrator" user?

text: I am running AT&T UNIX System V Release 4 Version 2.1 inside VirtualBox, and want to create a new "user account" for myself. At first, I simply created a new user with the `useradd` command, but didn't specify a group. When I logged in, I didn't even have a high enough permission level to create a new directory in my home folder. I then deleted my account and recreated it using the same command, except that I specified that the group is "adm". After doing this, I was able to create a new directory. This indicates to me that I now have a higher permission level. **Is this the correct way to add an administrator user? If so, what limitations are still in place?**


title: Track HDD access?

text: How can I track HDD access? Not in a monitoring sense of MB/s like `iotop`. My internal mass storage HDD gets permanently woken up and I want to find the evil process with an absolute list of accesses.


title: How to sort with a delimiter that is several characters long?

text: INPUT:               $ cat a.txt      1FOO2FOO3     4FOO5FOO5     2FOO1FOO9     $       OUTPUT:               $ cat a.txt | sort SOMEMAGIC     2FOO1FOO9     1FOO2FOO3     4FOO5FOO5     $       **Question** : How can I sort, if I have a several character long delimiter? ("FOO")? In the example `a.txt` is sorted by second column. Question is in general, numbers in `a.txt` could be anything.


title: make: *** [all] Error 2

text: I tried to install a decompiler on my macbook, but the terminal returned errors below.               ouekihodos-MacBook-Pro:radare2 LewisWang$ gmake     /Applications/Xcode.app/Contents/Developer/usr/bin/make -C libr/util     ../config.mk:29: /Users/LewisWang/Desktop/Computer: No such file or directory     ../config.mk:29: Programming/Hack/radare2/libr/../global.mk: No such file or directory     ../config.mk:30: /Users/LewisWang/Desktop/Computer: No such file or directory     ../config.mk:30: Programming/Hack/radare2/libr/../mk/.mk: No such file or directory     make[1]: *** No rule to make target `Programming/Hack/radare2/libr/../mk/.mk'.  Stop.     make: *** [all] Error 2


title: AIX equivalent of Solaris' iostat -E

text: On Solaris you can use the command `iostat -En` to view "disk error statistics" as counted by the kernel since the last reboot, where the `-n` option causes iostat to show "nice" device names. I'm looking for a way to similar statistics on AIX. Bonus question: How to get this kind of information out of Linux? smartctl? Parse syslog?


title: GREP for Processes by Directory and Kill it

text: I'm trying to `grep` for processes that originate from the /Applications/ directory (to kill them), but my `grep` command keeps catching some false ones as well. What am I doing wrong here?               $ ps -ef | grep -e '/Applications/' | grep -v grep | awk '{print $8}'     /Library/Application        I DON'T WANT THIS     /Library/Application        I DON'T WANT THIS     /Applications/Firefox.app/Contents/MacOS/firefox     /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal     /Applications/Notes.app/Contents/MacOS/Notes


title: With opendkim, what might cause "signature doesn't verify" errors with Port25's DKIM email tester?

text: As far as I know, I've followed all the instructions in this post from Steve Jenkins about how to install and configure opendkim for sendmail under CentOS. http://stevejenkins.com/blog/2011/08/installing-opendkim-rpm-via-yum-with- postfix-or-sendmail-for-rhel-centos-fedora/ Everything on the server seems to work - I don't see any errors in maillog or when I restart sendmail or opendkim. But when I use Port25's email checking tool (sending email to check- auth@verifier.port25.com from the server), I get a fail, saying the signature doesn't verify.               DKIM check details:     ----------------------------------------------------------     Result:         fail (signature doesn't verify)     ID(s) verified:     Canonicalized Headers:         subject:Test'20'message'20'to'20'see'20'if'20'opendkim'20'is'20'working'0D''0A'         date:Tue,'20'3'20'Jun'20'2014'20'12:52:29'20'-0700'0D''0A'         to:check-auth-ace=tidbits.com@verifier.port25.com'0D''0A'         from:"Adam'20'C.'20'Engst"'20'<tc-comments@tidbits.com>'0D''0A'         dkim-signature:v=1;'20'a=rsa-sha256;'20'c=relaxed/simple;'20'd=tidbits.com;'20's=default;'20't=1401825149;'20'bh=z6rEhTm6k/MRH02Uwz6CoDfNxAxYcEAZxvynRlx4keQ=;'20'h=Subject:Date:To:From;'20'b=          Canonicalized Body:         Let'27's'20'see'20'what'20'this'20'does.'20'Ignore'20'it'20'if'20'it'20'gets'20'out.'0D''0A'         '0D''0A'         cheers...'20'-Adam='0D''0A'               DNS record(s):         default._domainkey.tidbits.com. 120 IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD5c8Qbiw2aLlYk9ewZiVpEL3TwABiRZqIf3tlKtVmkj5QTEfWLjNsnkQ+p+o/IbO7tzXypaGso3dfqVVz/WftpqsXQLT9Yd9VZn8qyeMnOBcSl7Xj0McMFmdGmnpHR8KX+/tiYJL169UPo6EotcLRXbW63ZbNnft5W4FBSvhrP2QIDAQAB"          Public key used for verification: default._domainkey.tidbits.com (1024 bits)          NOTE: DKIM checking has been performed based on the latest DKIM specs     (RFC 4871 or draft-ietf-dkim-base-10) and verification may fail for     older versions.  If you are using Port25's PowerMTA, you need to use     version 3.2r11 or later to get a compatible version of DKIM.      Similarly, if I use Brandon Checketts' Email Validator at http://www.brandonchecketts.com/emailtest.php, I get a similar sounding fail, saying the message has been altered:               DKIM Signature               Message contains this DKIM Signature:     DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tidbits.com;         s=default; t=1401825040;         bh=z6rEhTm6k/MRH02Uwz6CoDfNxAxYcEAZxvynRlx4keQ=;         h=Subject:Date:To:From;         b=B7XhogAmuX1/FsHKdxVQBvYy3x2CXo+RvcmTqgVqUQ3zhee9Wfc5tQf+l+tGPqWSY          4QNIs/G+AwV24o4oOWhmjEORouHbXF6U9jPzallMT6PlJgOxs+t1cXsgyhp7GaFvuJ          d93sPM6PnJRV+CwascsNPfWnYvY8lHoa1cPUJjvs=               Signature Information:     v= Version:         1     a= Algorithm:       rsa-sha256     c= Method:          relaxed/simple     d= Domain:          tidbits.com     s= Selector:        default     q= Protocol:             bh=                 z6rEhTm6k/MRH02Uwz6CoDfNxAxYcEAZxvynRlx4keQ=     h= Signed Headers:  Subject:Date:To:From     b= Data:            B7XhogAmuX1/FsHKdxVQBvYy3x2CXo+RvcmTqgVqUQ3zhee9Wfc5tQf+l+tGPqWSY          4QNIs/G+AwV24o4oOWhmjEORouHbXF6U9jPzallMT6PlJgOxs+t1cXsgyhp7GaFvuJ          d93sPM6PnJRV+CwascsNPfWnYvY8lHoa1cPUJjvs=     Public Key DNS Lookup               Building DNS Query for default._domainkey.tidbits.com     Retrieved this publickey from DNS: v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD5c8Qbiw2aLlYk9ewZiVpEL3TwABiRZqIf3tlKtVmkj5QTEfWLjNsnkQ+p+o/IbO7tzXypaGso3dfqVVz/WftpqsXQLT9Yd9VZn8qyeMnOBcSl7Xj0McMFmdGmnpHR8KX+/tiYJL169UPo6EotcLRXbW63ZbNnft5W4FBSvhrP2QIDAQAB     Validating Signature               result = fail     Details: message has been altered      These test messages are being sent from an internal tool that was written for us; it creates messages for sendmail to send out. Could the problem be related to when the DKIM headers are being added to the messages?


title: How to compress wmv files on the linux console

text: I have some badly made WMV-files on my server that are huge (some GB) with just some picture slide-shows in it. Is it possible to compress them on the console there on the debian server so I can download them easily after?


title: How can I count the number of different characters in a file?

text: I would need a program, that outputs the number of the different characters in a file. Example:               > stats testfile     ' ': 207     'e': 186     'n': 102      Exists any tool, that do this?


title: TTY On External Monitor

text: When using my laptop at home, I usually use an external monitor, keyboard, and mouse with my laptop's screen as a second monitor. This is all easily configured using a nice GNOME utility that I assumes uses xrandr on the backend. Sometimes I enjoy using my computer via a TTY. I would like to be able to switch over to TTY1(using ctrl+alt+f1) and have the tty appear on my external monitor at the resolution of my external monitor. Rather, it usually either appears on just my laptop screen, or on both monitors but at the resolution of my laptop's screen. Is there anyway to do this seamlessly on Ubuntu 10.10? (I'm guessing it doesn't matter, but I've set it such that screen launches automatically from `~/.profile`).


title: Ex and Vi: buffers and regexes

text: I want to put regex matches to buffer but cannot get even simpler example `y :.put myNewBuffer` return msg `[line] [put] [buffer]` working ie how to put something to buffer? **So to regular expressions and ex**   1. what does `(.,.)~ replaces the previous regular expression with the previous replacement pattern from a substitution` mean? Some example helpful, source of the quote.   2. please, give some examples how you use regexes with ex. For example, how can you buffer areas between starting word having `h` as the first character until the word ending to `s` character?    3. What about if the last thing only on a line ie ending word is the word ending to `s` or the end of line `$`?


title: How to start/stop transmission at given times?

text: I've checked the manual for the gtk version of Transmission (the torrent client), and haven't found a way to **stop** and **start** all transfers with a schedule. Is this just 'not supported'? or someone had found a call I can throw in cron and have my way? I know that the servers allow RCP calls with the transmission-client, but the GTK version doesn't seems to have this option (and the manuals seems quite obsolete right now). I'm using transmission-gtk 2.81.


title: Sed / Awk - Find string exactly n characters long

text: Looking through the man pages for sed, awk and grep, I'm unable to find a way to search for a string that is exactly n characters long. Given the following text file, I want to extract just `6982a9948422`               ID                  IMAGE               COMMAND                     CREATED             STATUS              PORTS     6982a9948422        ubuntu:12.04        apt-get install ping        1 minute ago        Exit 0      The value will always be in the first column and is always 12 alphanumeric characters. Here is what I am trying so far.                cat /tmp/test | awk {'print $1'} | sed 's/.*\([0-9],[A-Z],[a-z]\{12\}\).*//g'      What would be a way to extract just `6982a9948422` from the text above ?


title: Symlinks and permissions in backup archives

text: I installed linux on another computer and I want to move my /home directory to that computer. I want to backup that directory with any file permission, symlinks etc. how should I do it? Are there any parameters for tar gzip?


title: CPU and Memory Usage

text: I want to monitor the CPU and Memory usage for long hours and find the average of that on a Linux server. Can anybody help me to monitor it using a script. I want to know the readings for around 15-20hrs.


title: Delete from cursor to end of line on VI

text: I know I've probably looked over this a million times in all the VI documents I've read, but I can't seem to find the delete from cursor to end of line command.


title: Why is the printer reversing black and white?

text: I'm printing documents and images to a Samsung ML1630. It used to work fine, but now it prints white instead of black, black instead of white. Text documents come out white text on solid black background. Of course, it used to work fine. Before declaring the printer itself guilty, is it possible that something in my Linux setup, the kernel or printer driver or some hidden setting somewhere is causing this trouble? Since this problem appeared about a month ago, I've updated everything with the package manager, rebooted a couple times, and the problem persists. Can't blame it on a cosmic ray!


title: How do I copy DVDs

text: Preamble: We are down to the final stages for creating a school-play dvd. Editing is almost done, discs are printed and ready. Just need to burn the dvd's now. However, doing our pencil calculations, if we burned every disc with our production computer ( Apple G5 , taking a estimated 10-20 minutes ) we don't really have enough time to finish all the DVD's ( 100 or so ) before deadline. ( 11 hours away ). The solution to this problem is to include my linux laptop into the burning process to reduce the workload. So my question is: If I had one DVD ( no security encryptions or licencing issues ) and I wanted to make 20 perfect copies really fast. What tools would I need and and what how would I use them? Would prefer command line here. Bonus question: Any tips on speeding up the Apple's Burn Proccess? Using Pro Studio 4.


title: Recent Installed Pipelight for Mint 16 — Two version of Flash Issue

text: I recently installed Pipelight in Linux Mint 16 Cinnamon and now I have two version of Flash. I only have Firefox 28 and no other browser. I followed the instruction from the FDS-Team (http://fds-team.de/cms/pipelight- installation.html#section_2_3) to remove the symlink of the NPAPI Linux plugin and replace it with a symlink to Pipelight. Opened the terminal and entered these command lines:               sudo update-alternatives --install "/usr/lib/mozilla/plugins/flashplugin-alternative.so" "mozilla-flashplugin" /usr/lib/pipelight/libpipelight-flash.so     sudo update-alternatives --set mozilla-flashplugin /usr/lib/pipelight/libpipelight-flash.so      I still both version of flash enabled. How can I disable the native flash 11 and just use the flash 13 from Pipelight? or How can I remove the native flash 11 completely?


title: How do I install Ubuntu from Suse?

text: I just got a new laptop (HP ProBook 4520s), and I don't have my PC here, with which I used to create bootable USB's to install Ubuntu with. I only have an USB, an external hard drive, and some CDs/DVDs, at the moment. So, my question goes, how do I into Ubuntu? I'm on Suse 11, which came preinstalled, so basically I'm asking how to create a LiveCD/bootable something on Suse.


title: unexpected squid behaviour (cache for openSUSE updates)

text: With no previous experience I have just set up a `squid` proxy. Its only purpose is to prevent that all the Linux systems (openSUSE) download their updates from the Internet. A proxy can easily be configured for the openSUSE update tool. `tcpdump` shows that the other systems access the proxy and the proxy accesses the repositories. What I don't understand: After a distro upgrade the first online update is supposed to be 400 MiB to 700 MiB (that's what YaST says before starting the update). But the `squid` storage directory contains only about 80 MiB data. The `access.log` shows both hits and misses. Even if for some strange reasons the Linux systems would access different servers (Is there some kind of DNS- intransparent redirection?) then I would expect the proxy storage to be at least as big as the biggest download. The repositories are `http`, not `https` thus there should not be a problem for a proxy. **problem found** This link in this answer provides the information why squid does not work well here: > packages are downloaded using segmented downloading spread over multiple > mirrors, which together makes it impossible for squid to do much caching.


title: Proper usage of EXIT & ERR traps in bash scripts

text: I'm working on a bash script and as I've been going I've learned about traps, signals, function return codes and other such features I've not previously used. I may be thinking about things incorrectly - I'm looking for some advice. I am setting the following options:               set -o errexit     set -o nounset     set -o noclobber      I've got the following exit and err traps in my bash script:               # Error handler. This function is called anytime an ERR signal is received.     # This function should never be explictly called.     function _trap_error () {         if [ ! -v _VERBOSE ]; then             echo "An error has occurred. Exiting."         else             _name="$0"                # name of the script             _lastline="$1"            # argument 1: last line of error occurence             _lasterr="$2"             # argument 2: error code of last command             echo "${_name}: line ${_lastline}: exit status of last command: ${_lasterr}"             exit 1         fi     }     trap '_trap_error ${LINENO} ${$?}' ERR          # Exit handler. This function is called anytime an EXIT signal is received.     # This function should never be explicitly called.     function _trap_exit () {         [ -v _POPD ] && popd &> /dev/null     }     trap _trap_exit EXIT      They work much as I'd expect. Rather than inserting error checking into all my functions, I'm attempting to leverage the traps to handle this for me, for example when checking for the existence of a file. If the specified module can't be loaded, I'd like to catch it as an error, display an error message, and exit.               function _module_path () {         echo "mod.d/$2s/$1/__init__.sh"     }          function _module_exists () {         [ -f $(_module_path $1 $2) ] && return 0 || return 1     }          function _module_push () {         _module_exists $1 $2 && _MODULES+=$( _module_path $1 $2 ) || msg "Module $1 does not exist."     }      However, setting the return code to 0 in conjunction with errexit triggers an EXIT signal, which is caught by my exit trap instead. I started trying to figure out if I can manually emit an ERR signal instead, but haven't found an answer and started to wonder if I'm going about this correctly.


title: Remapping Caps Lock with xmodmap doesn't work

text: When I program I like to swap these keys: `Esc` ↔ `Tab` `Ctrl` ↔ `CapsLock` In `~/.xmodmap`, I have specified these re-mappings:               keycode 66 = Control_L     keycode 37 = Caps_Lock     keycode 23 = Escape     keycode 9 = Tab      The `Escape` and `Tab` keys swaps, no problem, but instead of `Caps_Lock` and `Control_L` swapping, both those keys becomes `Caps_Lock`. Whatever I try to do, the Control keys doesn't get assigned to `Caps_Lock` (keycode 66). If I leave the `keycode 66 =`, the key is un-assigned, but when I assign `Control_L` or `Control_R`, it just doesn't work. But, if I assign some other key, for example, `keycode 66 = Tab`, it gets assigned, no problem. Its like xmodmap just doesn't want Caps Lock and Control keys to be swapped. Really frustrating. Any help/pointers would be really helpful. P.S: I am using Archlinux.


title: FreeBSD 10 does not boot after clean install

text: Latest FREEBSD 10 does not boot after clean installation. Installed using this image: FreeBSD-10.0-RELEASE-amd64-memstick.img Used Guided Partitioning, where I selected my only hard drive, chose Entire Disk and selected "finish". Autopartitioning looked perfectly OK: GPT, boot, ufs, swap Installation goes OK without any error message, but after final reboot - I get no bootable device found. I tried these command in LiveCD shell: `gpart bootcode -b /boot/mbr ada0` `gpart set -a active ada0` I also tried this command `gpart destroy -F /dev/ada0` after which I re- installed BSD and it still does not boot. Hard drive's SMART looks good. No bad sectors. BIOS settings are correct (UEFI is turned off). **EDIT: I was able to successfully install previous version of FreeBSD using`FreeBSD-9.2-RELEASE-amd64-memstick.img` and followed exactly same steps, autopartitioning looks absolutely identical.** **EDIT 2: I tried to install using CD version`FreeBSD-10.0-RELEASE- amd64-disc1.iso` and I get exactly same issue, BIOS won't boot it.** Please help, I'm not sure why 10.0-RELEASE wont boot. **EDIT 3:-- The same problem is experienced in FreeBSD-10.0-RELEASE-i386-disc.iso too


title: How do I prevent programs from sniffing keystrokes to su/gksu?

text: I've read here that it's possible for any app using the X server to sniff keystrokes to any other app which is also using the X server, including `su` (on a terminal) or `gksu`. I've heard of a few ways to make the X server secure like Xephyr, but I'm not sure which one to use. I just want to prevent any app like `xinput` from easily sniffing the keystrokes when I'm typing a password in the terminal or `gksu`. I'm currently using Debian sid.


title: sourcing a file inside a script

text: I'd like to source a file inside a tcsh script. In code:               #!/bin/tcsh          unsetenv LD_LIBRARY_PATH     source $1         echo $LD_LIBRARY_PATH > temp_file      **The expected result:** The environment variable set by the script using the source command will be printed into a temporary file. **Actual result:** The sourced file runs nicely, but the `LD_LIBRARY_PATH` variable remains empty. Any ideas on how to get this to work? * * * **P.S.** `tcsh` is of course not my shell of choice, but I have a script at work that sets up numerous environment variables in `tcsh` that I want to get working in `bash`. I figured the easiest way (other than rewriting the `tcsh` shell every time) is to source it, print out the variables into a file, and with a bit of shell magic, re-source everthing back in bash.


title: Meanings of the columns in "last" command

text: As I was investigating a server that is rebooting in a regular fashion, I started looking through the "last" utility but the problem is that I am unable to find what the columns mean exactly. I have, of course, looked through the man but it does not contain this information.               root@webservice1:/etc# last reboot        reboot   system boot  3.2.13-grsec-xxx Thu Apr 12 09:44 - 09:58  (00:13)         reboot   system boot  3.2.13-grsec-xxx Thu Apr 12 09:34 - 09:43  (00:08)         reboot   system boot  3.2.13-grsec-xxx Thu Apr 12 09:19 - 09:33  (00:13)         reboot   system boot  3.2.13-grsec-xxx Thu Apr 12 08:51 - 09:17  (00:25)         reboot   system boot  3.2.13-grsec-xxx Thu Apr 12 00:11 - 09:17  (09:05)         reboot   system boot  3.2.13-grsec-xxx Wed Apr 11 19:40 - 09:17  (13:36)         reboot   system boot  3.2.13-grsec-xxx Sun Apr  8 22:06 - 09:17 (3+11:10)        reboot   system boot  3.2.13-grsec-xxx Sat Apr  7 14:31 - 09:17 (4+18:45)        reboot   system boot  3.2.13-grsec-xxx Fri Apr  6 10:20 - 09:17 (5+22:56)        reboot   system boot  3.2.13-grsec-xxx Thu Apr  5 00:16 - 09:17 (7+09:01)        reboot   system boot  3.2.13-grsec-xxx Tue Apr  3 07:34 - 09:17 (9+01:42)        reboot   system boot  3.2.13-grsec-xxx Tue Apr  3 02:31 - 09:17 (9+06:45)        reboot   system boot  3.2.13-grsec-xxx Mon Apr  2 23:17 - 09:17 (9+09:59)         The first columns makes sense up to the kernel versions included. What do these times represent exactly ? The last one seems to be the uptime. Secondly, this is supposed to be a server on 24/7 except the times don't seem to match which could mean that it is experiencing downtime or somthing similar. For example, if we look at the two last lines, does it mean that my server was off from Apr 2 09:17 until Apr3 02:31 ? As for the background information, this is a Debian Squeeze server. **EDIT** If the last colums are start time, stop time and uptime, how can you interpret these two lines :               reboot   system boot  3.2.13-grsec-xxx Tue Apr  3 07:34 - 09:17 (9+01:42)        reboot   system boot  3.2.13-grsec-xxx Tue Apr  3 02:31 - 09:17 (9+06:45)         The second session seems to end after the first one starts which doesn't make sense to me.


title: Send traffic to self over physical network on Ubuntu

text: I have a dual port ethernet NIC and let's say I have connected both ports in a loop and assigned the following IPs to the 2 ethernet interfaces:   * eth2 -> 192.168.2.1   * eth3 -> 192.168.3.1 I want to send traffic from 1 of the ports to the other over the physical network, e.g. ping `192.168.3.1` from `192.168.2.1`. However, the TCP/IP stack in the Linux kernel recognizes that these two addresses are local and instead sends the traffic to the loopback adapter, so the traffic never hits the physical network. The closest I have to a solution is Anastasov's send-to-self patch, which unfortunately, has been discontinued since kernel 3.6 so it won't work on Ubuntu 13.10 (kernel 3.11) for me. I've tried rewriting the patch for 3.11, but I can't seem to locate these in the Ubuntu distro:   * include/linux/inetdevice.h   * net/ipv4/devinet.c   * net/ipv4/fib_frontend.c   * net/ipv4/route.c   * Documentation/networking/ip-sysctl.txt Is there a way I can get the send-to-self patch to work, or an alternative solution?


title: ssh-copy-id hangs with 8192-bit key

text: Having a bit of an issue with _ssh-copy-id_ it seems to hang when i try to copy _8192-bit rsa_ keys accross to an **OpenIndiana** server. I running **OS X** as my client OS. Is anyone aware of issues with keys of this size?


title: What constitudes a 'field' for the cut command?

text: For example, the `cut` command can take a parameter -f, which according to `man` > select only these fields; also print any line that contains no delimiter > character, unless the -s option is specified In this context, what is a field?


title: ddrescue extremely slow on USB hard drive

text: I'm recovering the HDD from my laptop that died (wouldn't boot up at all, Disk Utility reported that there were no problems, but wouldn't mount the disk). I've hooked up the HDD through the USB adapter. Running `ddrescue` like so:               sudo ddrescue -v -n /dev/disk1s2 "/Volumes/Original HD/image.dmg" ddrescue.log      There are no errors so far, but the average read speed has gradually dropped to 50KB/s. It was around 2MB/s at the beginning. The size of the partition is 300GB. So far I've been able to recover 160GB. I'm recovering to an HFS+ partition on my MacBook. What could be the reasons for this slow transfer rate and how to increase it?


title: Why won't this shutdown script work when executed by ACPID?

text: Based on this thread I modified my `/etc/acpi/powerbtn.sh` script to account for LXDE sessions:               # getXuser gets the X user belonging to the display in $displaynum.     # If you want the foreground X user, use getXconsole!     getXuser() {             user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" ) { print $1; exit; } }'`             if [ x"$user" = x"" ]; then                     startx=`pgrep -n startx`                     if [ x"$startx" != x"" ]; then                             user=`ps -o user --no-headers $startx`                     fi             fi             if [ x"$user" != x"" ]; then                     userhome=`getent passwd $user | cut -d: -f6`                     export XAUTHORITY=$userhome/.Xauthority             else                     export XAUTHORITY=""             fi             export XUSER=$user     }           if [ -n $(pidof lxsession) ]; then         for x in /tmp/.X11-unix/*; do            displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`            getXuser;            if [ x"$XAUTHORITY" != x"" ]; then                export DISPLAY=":$displaynum"                export _LXSESSION_PID=`pidof lxsession`                lxsession-logout                exit            fi         done      fi          # If all else failed, just initiate a plain shutdown.     /sbin/shutdown -h now "Power button pressed"      The script works fine when run in a terminal - both as a user and root - but won't work if run by ACPID. The only case the script is triggered by ACPI is when I have a root session open in gnome-terminal. Do you have any idea what could be wrong? Is there any other info I can provide that could help you figure out what's going on? I tried setting the environment variables manually but if I do so the script only works until the first time I launch a command with root. * * * System info:   * Ubuntu 12.04.2 LTS   * single-user   * running LXDE/Openbox * * * **Edit** : I ran some diagnostics and found out that both XUSER and XAUTHORITY remain empty when run by ACPID. No idea why, though.


title: How to copy some, but not all files?

text: So, you can use the `*` as a wild card for all files when using `cp` within context of a directory. Is there a way to copy all files except `x` file?


title: DNAT in iptables

text: Help me set rules in IPTABLES! I used rules in firewall - shorewall as below:               DNAT net    dmz:10.10.10.200    tcp 21,80,3306       DNAT net    local:192.168.1.99  tcp 502,8008      Where:   * IP firewall: 172.16.1.101 (eth0)   * modem: 172.16.1.1   * IP public is 127.127.114.15  Now, I want to build the firewall with `iptables` version 1.4.7. How to set the firewall up with `iptables`? (Just only help me with DNAT).


title: Flash not working on HTTPS webpages

text: I have a strange problem with flash (`chromium-pepper`). It works fine on HTTPS domains (like youtube), but it does not load at all on pages which are HTTP (not securely encrypted). I'm using the latest version of arch with gnome 3.12. I haven't been able to find a solution to this problem anywhere, not even on the arch forums.


title: Automation tasks for system administrators

text: If I am a junior UNIX/Linux system administrator, and I want to make automation tasks for the server. I know Shell script, Perl, and Python. All of these are used to make automation tasks. Which one I can use to make the scripts? Answer should be according to these conditions: 1. less lines of code. 2. high performance. 3. Portable source code, even I use KSH or BASH shell. If there is no dedicated answer, so when I can use perl and when python and when shell-script?


title: Mysqld_multi doesn't recognize groups

text: I am trying to configure a MySQL server to run multiple instances of the daemon (I wish to duplicate it onto different drives). I've been trying to use the mysqld_multi script. However the script is not finding the groups in `/etc/mysql/my.cnf`. I copied and pasted the the configuration from `msqld_multi --example` into my.cnf, and this discovered the groups fines. However when I tried to modify the file below `mysqld_multi report` just displays:               Reporting MySQL servers     No groups to be reported (check your GNRs)      Below is an abbreviation of my my.cnf file.               [mysqld_safe]     socket          = /var/run/mysqld/mysqld.sock     nice            = 0          [mysqld1] #this is for the master server     pid-file =/var/run/mysqld/mysqld.pid     socket =/var/run/mysqld/mysqld.sock     port =3306     datadir=/var/lib/mysql     server-id=1     log-bin=mysql-bin          [mysqld2] #for the slave!     pid-file =/var/run/mysqld-slave/mysqld-slave.pid     socket =/var/run/mysqld-slave/mysqld-slave.sock     port =3307     datadir =/var/lib/mysql-backup     server-id=2     skip-innodb     default-storage-engine =myisam     [mysqld_multi]     user            = mysql          [mysqld]      basedir         = /usr     tmpdir          = /tmp     ...      Here's a short bit from `mysqld_multi --example`               [mysqld_multi]     mysqld     = /usr/bin/mysqld_safe     mysqladmin = /usr/bin/mysqladmin     user       = multi_admin     password   = my_password          [mysqld2]     socket     = /tmp/mysql.sock2     port       = 3307     ...      Can anyone spot why mysqld_multi isn't parsing this?


title: HA Cluster in Linux

text: My question is : **Is there any other solution for _High Availability Clustering_ in Linux like _RedHat Cluster Suite_ , or not ?** Thanks..


I am getting the same `not found [No such file or directory]` error when trying to execute a ksh script. Read tips about the PATH and running the script with a `./` in the posts here and here and tried but no luck. The script does exist under the directory from where I am trying to execute and has full permissions but gives the same error when run directly or with a `./`. The first line within the script also has `#!/usr/bin/ksh` The error message is like below:               -ksh: revenue_ext.ksh: not found [No such file or directory]      However, other `ksh` scripts under the same directory run fine so am absolutely clueless about what could be wrong here. Any help would be greatly appreciated


title: Git completions for aliases only available after running `git reflog`

text: I have a few aliases that I want to autocomplete for git, e.g., the following               alias gco="git checkout"      When I was attempting to add completions for this alias, I looked around in my path and saw that a bunch of git completions were available (e.g., `_git- push`, `_git-checkout`, `_git-diff-files`). AndI used `compdef` to define it:               compdef _git-checkout gco      This worked for a while, then I restarted my terminal and suddenly they were all gone... (getting an error about completions not available):               gco (eval):1: command not found: _git-checkout     (eval):1: command not found: _git-checkout     (eval):1: command not found: _git-checkout      The weird part is that they all get dumped into my path after I run `git reflog`. (and then they work). Am I relying on some internal functions here that I shouldn't be? Should I go about this differently? (I could also just add a `git reflog` into my `.zshrc`, but that seems totally ridiculous to do).


title: specify certificate of CA in Dovecot

text: In Postfix, I have specified my private key, my certificate, and the certificate of my CA               smtpd_tls_CAfile     = /etc/ssl/cacert.pem     smtpd_tls_key_file   = /etc/ssl/server.key     smtpd_tls_cert_file  = /etc/ssl/server.pem      In dovecot, there are only options to specify my key and my cert:               ssl_cert = </etc/ssl/server.pem     ssl_key = </etc/ssl/server.key      How do I specify the certificate of my CA ? # Update: The problem is, when I connect with client to my port 993, I get certificate error. Using `openssl s_client -connect server:993` I get this error:               verify return:1     verify error:num=27:certificate not trusted     verify return:1     verify error:num=21:unable to verify the first certificate     verify return:1      I don't get this error when I connect to port 465 (Postfix):               openssl s_client -connect server:465


title: Does cat never read from terminal?

text: Chapter 43. Redirecting Input and Output of Unix Power Tools, Third Edition has to say this about cat command: > Standard input (stdin) normally comes from your keyboard. Many programs > ignore stdin; you name files directly on their command line — for instance, > the command cat file1 file2 **never** reads its standard input; it reads the > files directly. But without filenames on the command line, Unix commands > that need input will usually read stdin. Standard input normally comes from > your keyboard, but the shell can redirect stdin from a file. ( **emphasis** mine) Ok but happens when we just type `cat > filename` in the command line? Isn't cat reading from the stdin and stores that that into file "filename"? Is the above excerpt from the book just saying that only the particular form of using cat with a FILE argument never reads from the stdin?


title: Download the file from either of two machines using SCP?

text: I have a below bash shell script which I am running from `machineA` and that shell script will try to download a tar file from either of these two machines `machineB` and `machineC` and put it in `/testing/directory1` in `machineA`. And both of the machines (machineB and machineC) will have same file `test.tar` in the same directory `/data/v1`. I need to download `test.tar` file from either of those two machines(machineB and machineC) from `/data/v1` directory. If `machineB` is up, then I will download the tar file from `machineB` and if it is down, then I will download the same tar file from `machineC`.. But currently in my bash shell script suppose for whatever reason if `machineB` is down, then I guess it won't even try to download the same tar file from `machineC` and it will throw an exception and stop the shell script. I want to use `set -e` but it should throw an exception only when both of the machines are down and not able to download the tar file from `machineB` and `machineC`. If `machineB` is down for whatever reason, then it should try downloading from `machineC`..               #!/bin/bash     set -e          readonly PATH_LOCATION=/testing/directory1     readonly MACHINES=(machineB machineC)     readonly FILE_LOCATION=/data/v1     readonly FILE_NAME=test.tar          length1=$(ssh -o "StrictHostKeyChecking no" david@${MACHINES[0]} "ls '$FILE_LOCATION' | wc -l")     length2=$(ssh -o "StrictHostKeyChecking no" david@${MACHINES[1]} "ls '$FILE_LOCATION' | wc -l")          echo $length1     echo $length2          if [ "$length1" -gt 0 ] || [ "$length2" -gt 0 ]     then         rm -rf $PATH_LOCATION/*         scp david@${MACHINES[0]}:$FILE_LOCATION/$FILE_NAME $PATH_LOCATION/. || scp david@${MACHINES[1]}:$FILE_LOCATION/$FILE_NAME $PATH_LOCATION/.         tar -xvf $PATH_LOCATION/$FILE_NAME -C $PATH_LOCATION         rm $PATH_LOCATION/$FILE_NAME     fi      Any thoughts how this can be done? I want to use scp only here not rsync as I need to spend some time understanding rsync.


title: *ix based Morphing software?

text: Morphing is `"a special effect in motion pictures and animations that changes (or morphs) one image into another through a seamless transition"`, according to Wikipedia here. My friend recommended some Aftereffects software in Mac but I feel there must be something at least on development also in *ix world because the algorithms and technology seem to be developing so rapidly. Which *ix tools do you use for Morphing images?


title: Internet connection being lost after about 10 seconds

text: Okay so I have looked at this post Network connection drops after a few seconds,   Which looks similar to the problem I am having but I have only just got Linux and can't work out what to do. # Before I start. I have Opensuse 13.1.   This is running on a virtual machine.   Setting on my VM for network is NAT. # Problem When I start up the VM I have access to the internet for about 10 seconds.   Running `ifconfig` shows               # ifconfig     enp0s3    Link encap:Ethernet  HWaddr 08:00:27:CA:F6:EC             inet6 addr: fe80::a00:27ff:feca:f6ec/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:7 errors:0 dropped:0 overruns:0 frame:0           TX packets:66 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:1668 (1.6 Kb)  TX bytes:11704 (11.4 Kb)          lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:65536  Metric:1           RX packets:34 errors:0 dropped:0 overruns:0 frame:0           TX packets:34 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:1700 (1.6 Kb)  TX bytes:1700 (1.6 Kb)      After about 10 seconds it shows               # ifconfig     lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:65536  Metric:1           RX packets:34 errors:0 dropped:0 overruns:0 frame:0           TX packets:34 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:1700 (1.6 Kb)  TX bytes:1700 (1.6 Kb)      So I checked in `/var/log/messages` and found it had been killed.   Here is what I think is relevant in `/var/log/messages`:               2014-07-24T19:07:32.911997+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Found user 'avahi-autoipd' (UID 499) and group 'avahi-autoipd' (GID 498).     2014-07-24T19:07:32.917851+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Successfully called chroot().     2014-07-24T19:07:32.919814+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Successfully dropped root privileges.     2014-07-24T19:07:32.921004+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Starting with address 169.254.12.33     2014-07-24T19:07:32.925894+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Routable address already assigned, sleeping.     2014-07-24T19:07:33.007838+01:00 linux-iqb5 network[3444]: Shutting down network interfaces:     2014-07-24T19:07:33.353730+01:00 linux-iqb5 systemd[1]: Stopping ifup managed network interface enp0s3...     2014-07-24T19:07:33.691423+01:00 linux-iqb5 ifdown[4098]: enp0s3    device: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)     2014-07-24T19:07:33.703182+01:00 linux-iqb5 ifdown[4098]:     enp0s3    device: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)     2014-07-24T19:07:33.778217+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Got SIGTERM, quitting.     2014-07-24T19:07:34.044757+01:00 linux-iqb5 dhcpcd[4175]: enp0s3: sending signal 15 to pid 1418     2014-07-24T19:07:34.046056+01:00 linux-iqb5 dhcpcd[4175]: enp0s3: exiting     2014-07-24T19:07:35.533803+01:00 linux-iqb5 dhcpcd[1418]: enp0s3: exiting     2014-07-24T19:07:35.536473+01:00 linux-iqb5 dhcpcd[4219]: enp0s3: received SIGTERM, stopping     2014-07-24T19:07:35.538001+01:00 linux-iqb5 dhcpcd[4219]: enp0s3: removing default route via 10.0.2.2 metric 0     2014-07-24T19:07:35.540269+01:00 linux-iqb5 dhcpcd[4219]: enp0s3: removing IP address 10.0.2.15/24     2014-07-24T19:07:35.542169+01:00 linux-iqb5 avahi-daemon[509]: Withdrawing address record for 10.0.2.15 on enp0s3.     2014-07-24T19:07:35.543660+01:00 linux-iqb5 avahi-daemon[509]: Leaving mDNS multicast group on interface enp0s3.IPv4 with address 10.0.2.15.     2014-07-24T19:07:35.545181+01:00 linux-iqb5 avahi-daemon[509]: Interface enp0s3.IPv4 no longer relevant for mDNS.     2014-07-24T19:07:36.399152+01:00 linux-iqb5 dhcpcd[4219]: enp0s3: exiting     2014-07-24T19:07:36.974262+01:00 linux-iqb5 avahi-daemon[509]: Interface enp0s3.IPv6 no longer relevant for mDNS.     2014-07-24T19:07:36.975258+01:00 linux-iqb5 avahi-daemon[509]: Leaving mDNS multicast group on interface enp0s3.IPv6 with address fe80::a00:27ff:feca:f6ec.     2014-07-24T19:07:36.976375+01:00 linux-iqb5 avahi-daemon[509]: Withdrawing address record for fe80::a00:27ff:feca:f6ec on enp0s3.      Does anyone know why this is happening?   Or better yet have a solution for this ?   Also if you you need any more information just let me know what you need and I'll try and find it. This is what i get in `/var/log/messages` when i try to restart the network service.   Hope this provides some useful information. Restarted using `/etc/init.d/network start` Ouputs only `redirecting to "systemctl start network.service"` to command line               2014-07-24T20:36:46.875361+01:00 linux-iqb5 ifup[5635]: Starting DHCP4+DHCP6 client on enp0s3. . . . . . . .     2014-07-24T20:36:46.912559+01:00 linux-iqb5 ifup-dhcp[5722]:      2014-07-24T20:36:46.928787+01:00 linux-iqb5 ifup[5635]: enp0s3    IP address: 10.0.2.15/24     2014-07-24T20:36:46.938725+01:00 linux-iqb5 ifup-dhcp[5722]:     enp0s3    IP address: 10.0.2.15/24     2014-07-24T20:36:46.946793+01:00 linux-iqb5 ifup[5635]: enp0s3    DHCP6 continues in background     2014-07-24T20:36:46.956573+01:00 linux-iqb5 ifup-dhcp[5722]:     enp0s3    DHCP6 continues in background     2014-07-24T20:36:47.180511+01:00 linux-iqb5 systemd[1]: Started ifup managed network interface enp0s3.     2014-07-24T20:36:47.287777+01:00 linux-iqb5 network[5216]: ..done..done    enp0s8        Startmode is 'manual' -> skipping     2014-07-24T20:36:47.297576+01:00 linux-iqb5 ifup[7472]:     enp0s8    Startmode is 'manual' -> skipping     2014-07-24T20:36:47.369663+01:00 linux-iqb5 network[5216]: ..skippedSetting up service network  .  .  .  .  .  .  .  .  .  .  .  .  ...done     2014-07-24T20:36:49.221664+01:00 linux-iqb5 network[7499]: Shutting down network interfaces:     2014-07-24T20:36:49.385756+01:00 linux-iqb5 systemd[1]: Stopping ifup managed network interface enp0s3...     2014-07-24T20:36:49.688419+01:00 linux-iqb5 ifdown[7816]: enp0s3    device: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)     2014-07-24T20:36:49.698333+01:00 linux-iqb5 ifdown[7816]:     enp0s3    device: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)     2014-07-24T20:36:49.765709+01:00 linux-iqb5 avahi-autoipd(enp0s3)[6435]: Got SIGTERM, quitting.     2014-07-24T20:36:49.987453+01:00 linux-iqb5 dhcpcd[7892]: enp0s3: sending signal 15 to pid 6591     2014-07-24T20:36:49.991505+01:00 linux-iqb5 dhcpcd[6591]: enp0s3: received SIGTERM, stopping     2014-07-24T20:36:49.992507+01:00 linux-iqb5 dhcpcd[6591]: enp0s3: removing default route via 10.0.2.2 metric 0     2014-07-24T20:36:49.994813+01:00 linux-iqb5 dhcpcd[6591]: enp0s3: removing IP address 10.0.2.15/24     2014-07-24T20:36:49.996912+01:00 linux-iqb5 avahi-daemon[509]: Withdrawing address record for 10.0.2.15 on enp0s3.     2014-07-24T20:36:50.002594+01:00 linux-iqb5 avahi-daemon[509]: Leaving mDNS multicast group on interface enp0s3.IPv4 with address 10.0.2.15.     2014-07-24T20:36:50.006327+01:00 linux-iqb5 avahi-daemon[509]: Interface enp0s3.IPv4 no longer relevant for mDNS.     2014-07-24T20:36:50.007898+01:00 linux-iqb5 dhcpcd[7892]: enp0s3: exiting     2014-07-24T20:36:50.953700+01:00 linux-iqb5 dhcpcd[6591]: enp0s3: exiting     2014-07-24T20:36:52.299847+01:00 linux-iqb5 avahi-daemon[509]: Interface enp0s3.IPv6 no longer relevant for mDNS.     2014-07-24T20:36:52.307888+01:00 linux-iqb5 avahi-daemon[509]: Leaving mDNS multicast group on interface enp0s3.IPv6 with address fe80::a00:27ff:feca:f6ec.     2014-07-24T20:36:52.323000+01:00 linux-iqb5 avahi-daemon[509]: Withdrawing address record for fe80::a00:27ff:feca:f6ec on enp0s3.     2014-07-24T20:36:52.531144+01:00 linux-iqb5 systemd[1]: Stopped ifup managed network interface enp0s3.     2014-07-24T20:36:52.676351+01:00 linux-iqb5 systemd[1]: Stopped ifup managed network interface enp0s8.     2014-07-24T20:36:54.450619+01:00 linux-iqb5 network[7499]: ..done..doneShutting down service network  .  .  .  .  .  .  .  .  .  .  .  ...done      Contents of `ifcfg-enp0s3`               BOOTPROTO='dhcp'     BROADCAST=''     ETHTOOL_OPTIONS=''     IPADDR=''     MTU=''     NAME='82540EM Gigabit Ethernet Controller'     NETMASK=''     NETWORK=''     REMOTE_IPADDR=''     STARTMODE='auto'     USERCONTROL='no'


title: How do you prevent user from opening a program?

text: I'm trying to write a script which prevents the concerned user from opening programs (mostly internet browsers) from being run during a certain time (like 1000 to 1200 hrs). This is like a productivity suite. I don't have much problems implementing the timing problem or the user problem. My problem lies in the prevention of task execution. **My question is: How do I stop a process before it starts?** Right now, I have an infinite loop implementation with a pseudo-code as :               while(1)     killall midori     killall firefox     sleep(60s)     end       But this is taxing on the computer and I don't want to stop a task if it starts, I want to _prevent_ the task from starting in the first place.


title: What considerations need to be made when choosing the version of kernel for an embedded device?

text: I have used buildroot to successfully create a kernel, root file system and cross-compilers to enable me to write application code to run on an embedded device. Currently I have no need to write device drivers and currently have no idea how to go about it anyway but it is quite likely that in future I may need to do this. From my research I have come to understand that the kernel API can change between versions and that writing a device driver is specific to a kernel version unlike writing a user level application. Basically I would like to know:   1. Is the above correct?   2. What factors need consideration when deciding on a what kernel version to use? The reason I ask is that from all the literature that I have read on the subject (and the attendance at an embedded linux course) deals with version 2.6.x kernels. I am building by embedded system using a 3.6.11 kernel but I am wondering why the course and literature seems to deal with these older kernels. Are there beneficial aspects to using an older kernel, or are there drawbacks to using newer versions?


title: Creating an alias for a bash script

text: So I have tried experimented and created an `alias` in `.bashrc`. However, when I test out the command I get:               [rkahil@netmon3 ~]$ menu     -bash: menu: command not found      Here is what I have in the `.bashrc` file:               # Source global definitions          if [ -f /etc/bashrc ]; then             . /etc/bashrc     fi          # User specific aliases and functions     alias menu='./menuScript.sh'     alias vi='vim'      The funny thing is when I created the alias `vi`, it worked. But menu does not. I have looked up previous posts on UnixStackExchange and attempted to follow other posts, but to no avail. Does anyone else have any suggestions?


title: Pipe output from one command to another command's non standard input

text: I would like to do something similar to the following:               which someapplciation | cd outputfrompreviouscommand      The command `which` provides a directory and I would like to be able to make that output my current working directory without using a programming language i.e. `awk`, `bash`, `perl`, etc. and to only use the pipe command. To further give an example:               which vi      provides the output               /some/dir      I would like my working directory to be moved to that directory which I can test by using the `pwd` command which should have the output that matches of `/some/dir`.


title: Create global enviromental variable after boot

text: I know about /etc/profile and /etc/environment, but I would like to set a global environmental variable after boot and login. By global, I mean an environment variable that can be accessed by any program (running under the current user). Basically at any given point, say 10 minutes after boot, I would like to be able to run a script that would set some global environment variables. Is this possible? **Background - read only if you are interested :)** I am having some trouble with gpg-agent in Ubuntu 14.04. Programs use environmental variables to connect to the gpg-agent process. My trouble is with multiple instances of gpg-agent running (only one of which has ssh- support enabled). I would like to be able to kill all existing instances of gpg-agent and start a new one with ssh-support. However, for other programs to be able to access the new instance, I need the environmental variables to be made global. Doing it during startup hasn't worked for me since the other gpg- agent seems to start after mine, replacing the enviromental variables.


title: Can I use `screen` to keep an ssh tunnel alive from the client?

text: I read here that you can keep your ssh sessions alive a bit longer using a utility called GNU screen. Is it possible to keep an SSH tunnel alive longer with this as well?


title: GRUB2 Edit Mode problem

text: I have recently installed Fedora 18 using UEFI. The problem I'm facing is that when I try to go into edit mode in GRUB, my PC freezes, displaying just a black square instead of text. Unfortunately I don't have much experience with these low level problems and I'd like to ask for your help.


title: Can we run firefox and Nightly simultaneously?

text: When I start nightly, new window of firefox is starts again, so I have to close firefox and start nightly, then if I open firefox Nightly's new window opens. What I am asking is can I run them both simultaneously?


title: Parsing csv with sed and perl one-liner?

text: I have a web server which stores configurations to PostgreSQL, and I plan to retrieve information from a certain table and then later parse it into csv format. **PAYLOAD**               <?xml version="1.0" encoding="UTF-8" standalone="yes"?><rule roleDefinition="false" id="1168" type="COMMON" enabled="true" owner="admin" buildingBlock="false" scope="LOCAL"><name>Recon: Remote Windows Server Scanner</name><notes>Reports a remote host attempting reconnaissance or suspicious connections on common Windows server ports to more than 60 hosts in 10 minutes.</notes><testDefinitions><test uid="4" id="80" name="com.q1labs.semsources.cre.tests.ThresholdFunction_Test" group="Functions"><text>when any of these BB:CategoryDefinition: Recon Events, BB:CategoryDefinition: Suspicious Events with the same source IP more than 5 times, across more than 59 destination IP within 10 minutes</text>      **Steps**               perl -nle '     my @enabled = /(?<=enabled="").*?(?<=\"\")/g;     chop(@enabled);     chop(@enabled);     chomp(@enabled);     my @group = /(?<=group="").*?(?<=\"\")/g;     chop(@group);     chop(@group);     chomp(@group);     my @name = /(?<=<name>).*?(?=<\/name>)/g;chomp(@name);     my @text = /(?<=<text>).*?(?=<\/text>)/g;chomp(@text);     print "@enabled;@group;@name;@text"     ' Rules.csv |sed 's/\&lt\;/</g'|sed 's/\&gt\;/>/g' | sed -e 's/<*>//g' -e '/ *$/d' > Rules2.csv      `Rules2.csv` shows no content, and empty file, however when I break the command I get some very positive results, please see pastebin (as the code) is bit too long. The pastebin analysis would show that somewhere in command section `sed -e 's/<*>//g' -e '/ *$/d'` it results into empty my Rules2.csv file. But I don't know why or what is causing this behavior. Any help that helps me achieve the desired output as shown in pastebin would be wonderful.


title: Where can I get SUNWsan package for Solaris?

text: The package is not available in the installation DVD, nor internet (MOS, Google, etc.). Where could I get it?


title: another question with sort in bash

text: How can I ignore the space in "Kuala Lumpur" when sorting this list? I cheated it by tabbing the columns and sorted on the tab which gives me the right results but I would like to know how to deal with a space in a column because re-formatting a list doesn't seem like a good habit to get into, especially if the list is much larger. Thanks in advance                 Kuala Lumpur        78          56            Seoul               86          66            Karachi             95          75            Tokyo               85          60            Lahore              85          75            Manila              90          85      BY CITY:               Karachi             95          75          Kuala Lumpur        78          56          Lahore              85          75          Manila              90          85          Seoul               86          66          Tokyo               85          60      I also have it sorted by high temp (high-low, 2nd column) and low temp (low- high, 3rd col) BY HIGH TEMP:                Karachi             95          75           Manila              90          85           Seoul               86          66           Lahore              85          75           Tokyo               85          60           Kuala Lumpur        78          56      BY LOW TEMP:                 Kuala Lumpur        78          56            Tokyo               85          60            Seoul                86          66            Karachi             95          75            Lahore              85          75            Manila              90          85


title: How to set clang++ as the c++ compiler?

text: I'm trying to set clang++ as the system C++ compiler on Fedora 18. I have installed clang and added it to `alternatives` but it doesn't appear to be working.               [user@localhost ~]$ alternatives --display c++     c++ - status is auto.      link currently points to /usr/bin/clang++     /usr/bin/clang++ - priority 1     Current `best' version is /usr/bin/clang++.     [user@localhost ~]$ c++ --version     c++ (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8)     Copyright (C) 2012 Free Software Foundation, Inc.     This is free software; see the source for copying conditions.  There is NO     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.      `c++` still appears to be using gcc even though `alternatives` is configured to use clang++. * * * `type -a c++` output:               [user@localhost ~]$ type -a c++     c++ is /usr/bin/c++     c++ is /bin/c++


title: curses-based program for selection item from the list

text: Is there in the linux any program which can represent (via pipe or something like that) results of such commands as, for example, ls, cat, grep, ps etc, by means of curses (for example as listbox)? So by means of such program I would like to select (by means of arrows keys or hjkl) some particular item from the list instead of copy-pasting it? I need something like `dialog`. It allows to create custom windows with custom widgets but I need from all these widgets only listbox, and I would like to have possibility to customize it. For example I would like to be able (within config-file or parameters) to change its behavior when press enter (for example, such list may contain list of media files which I can play by pressing on enter). Also I would like to be able to change appearance of such listbox so it may contains different columns, also I would like searchable listbox and colorized.


title: How do I move .bash_profile away from home

text: I need `.bash_profile` to be synched with Dropbox. The easiest way I can think of is to "redirect" the shell to search for `.bash_profile` in a custom folder. So is that possible? Or are there any better solutions?


title: 4G (LTE) Mobile Broadband, Slow upload speed

text: I'm using Huawei E3276 mobile modem for 4G LTE connection with Linux Manjaro XFCE 64bit, works out of the box without driver installs made by user. Problem is that while download is working normally as it should, upload is very slow. While on Windows 7 upload is steady 30-40Mbps depending on day, but on Linux it barely hits 4Mbps. Could it be a driver problem or a bug as a friend of mine suggested? And is it possible to fix it and how? This is as for now only thing for me that is kind of pulling me back to Windows so would love to get this fixed ASAP. Still a linux newbie so no clue about terminal commands that could be useful and such :/ Edit 1: While other linux distros have this upstream throttle, on Linux Mint Debian Edition 201403 upload is working as it should, usually being around 30-45Mbps. Addition: The same symptoms seem to be present in different hardware and Linux distributions: also with Ubuntu 14.04 LTS (64 bit workstation, kernel 3.16) and Raspbian Jessie for Raspberry PI (kernel 3.14). Upstream seems to be always limited to about 5 Mbit/s whenever checking the speed from the Linux computer that is used as a LTE router. The other computers in the LAN always get much more upstream (2 to 3 times as much), even though the traffic is routed through the same Linux computer suffering from seemingly capped uplink. A Windows 7 installation in the same hardware as Ubuntu does not have this uplink limitation. So the problem is not with E3276 device itself or in the mobile subscription, but in the Huawei E3276 Linux compatibility. Maybe something in the kernel? It is not matter with iptables rules: the speed does not noticeably increase when iptables is disabled. Turning off IPv4 forwarding does not improve speed either.


title: Thunderbird/Enigmail: problem with colors

text: When I decrypt an encrypted email in Thunderbird (using the Enigmail extension), the enigmail header is displayed in very strange colors, very light green background with white text. This makes the text unreadable. ![enter image description here](http://i.stack.imgur.com/oB36f.png) I am wondering where these colors come from. I have no such colors defined in my Thunderbird. My Thunderbird is using system colors (defined in LXDE/Openbox). Is there any way to change these color to something sane? Such as the text from white to black, so that I can actually see what is displayed there? # UPDATE: I have made some progress. According to Enigmail code, the element that I need to change is this one:               .enigmailHeaderBoxLabelSignatureOk {         background-color:#ccffcc;     color: black;     }       However, when I add the following into my `$HOME/.icedove/XXXXXXXX.default/chrome/userContent.css`, it has no effect. It still shows the default color (`ccffcc`).               enigmailHeaderBoxLabelSignatureOk {     background-color:#FF0000 ! important;     color: black ! important;     }      I don't have much experience with changing Thunderbird appearance with `userContent.css`. Can somebody please help?


title: Configure NAT filtring behavior with iptables

text: I'm using this rule to configure SNAT:               iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 193.49.142.107:4000      I want to specify a rule to filter out packets not destined to the internal address and port that initiated the session. Additionally, for receiving packets from a specific external endpoint, it is necessary for the internal endpoint to send packets first to that specific external endpoint's IP address.(NAT Address Dependent Filtering) Example: A machine with internal IP and port (X:x) which is behind the NAT opens a connexion to a server with IP Y. So with the rule I must be able to allow only connexion coming from IP address Y and destined to (X:x). All other connexion will be droped.


title: Unix bash script check empty gz files

text: I'm trying to write a bash script that will go into a directory loop through the .gz files and delete them if they are empty (ie the uncompressed file contained within in empty. I've got a couple of questions:   * Is there a standard file size of a compressed (gz) empty file I can check for?   * Or is there a better way to check if a gz contains an empty file without decompressing it with a bash script? I was trying to use the following code to acheive this but it relies on the filesize being 0 i think.               for f in dir/*     do         if [[ -s $f ]]         then             do_file_creation         fi     done


title: Qt applications have tiny fonts on XFCE

text: My question is almost the same as this one but the answer did not work for me. I'm running OpenSuse 13.1 with XFCE desktop. I have set `~/.kde4/share/config/kcmfonts` with `forceFontDPI=0` but it didnt work. I found on a forum that I could use `qtconfig`. When I run it, I can change the font size and the sample text now looks readable, but when I quit `qtconfig` asking to save changes, I get the following error:               X Error: BadAtom (invalid Atom parameter) 5       Major opcode: 18 (X_ChangeProperty)       Resource id:  0x0


title: Make problem with includes

text: I am installing `imagick-v3.1.0RC2` package on CentOS 5.5. I have ImageMagick 6.7.9-9 installed as well and have a problem on the `make` step. Problem is that its cannot find included file: > /usr/local/include/ImageMagick/wand/magick/accelerate.h:25:31: error: > magick/morphology.h: No such file or directory If I copy folder `magick` over into `/usr/local/include/ImageMagick/wand/magick/magick` then it will find it but will say some other file is missing in `magic/xxx.h` so I have to copy magick again and again there should be some way around? I created a symlink in `/ImageMagick/wand/magick` `ln -s ../magick magick` however it still has the same problem inside file `accelerate.h` on line 25 it has `#include <magick/random_.h>` I also tried to do               make --include-dir=/usr/local/include/ImageMagick/ --include-dir=/usr/local/include/ImageMagick` and `make -I /usr/local/include/ImageMagick/ -I /usr/local/include/ImageMagick I ended up running `make -n` to show all commands that make will execute and then added `-I /usr/local/include/ImageMagick/ -I /usr/local/include/ImageMagick` to them and run one by one manually. Isn't there faster way? **EDIT, SOLVED:** tick was to find where file is with `find / --name "missing.file"` and then add the symlinks in the folder where i run Make i.e. `/usr/src/imagick-v3.1.0RC2/`               ln -s usr/local/include/ImageMagick/magick magick      and               ln -s usr/local/include/ImageMagick/wand wand


title: Linksys WAG200 DSL/Router combo with cable modem?

text: I have a Linksys DSL/Router combo. It was previously used for my DSL connection. I switched to a cable connection now, using Motorola cable modem. Is it possible to create have the cable connection routed through the DSL router? I read somewhere that some people managed to do it but I am not sure. The cable modem uses a WAN port with dhcp. What program do I need to forward this to the other ethernet ports? Or to the wireless port ? Here is a more detailed description about my problem: http://sourceforge.net/apps/phpbb/openwag200/viewtopic.php?f=2&t=4.


title: Fedora gives me a list of fedora installs at boot time

text: The following happens when I start up Fedora, I've installed it on VirtualBox, how can I stop it from doing this? Both of them take me to same installation of Fedora, I have no clue on how this happened. How do I make it so it boots with just one of them? The only difference is that the guest additions seemed to be installed on the first Fedora only. ![enter image description here](http://i.stack.imgur.com/hxJWE.png) The following are my VirtualBox settings for Fedora: ![enter image description here](http://i.stack.imgur.com/BP32P.png)


title: How to find files ending with ~ and pyc?

text: I want to find all files (in current and all subdirectory) which end in'~' or 'pyc'. To do so I have tried the following `find` pattern:               find . -name '*{~,pyc}'     find . -name '{*~,*.pyc}'      but neither list any of the files present in the diectory. Why do these patterns not work? How to do it right? When using `ls` instead of `find` (without the quotation mark) I get the expected result (except that `ls` only shows the _current_ directory and not all the subdirectories).


title: TP-Link TL-WR1043ND as dumb access point

text: I followed these instructions on how to set up my TP-Link TL-WR1043ND as a dumb AP:   1. Flashed brand new Attitude Adjustment 12.09-rc1   2. Logged into LuCI, set up a password   3. Disabled and stopped firewall and dnsmasq under System > Startup   4. Enabled wireless I have no internet access from my other devices connected over wireless. Windows says "Limited access," and iPad says "Server not found" or some such. I proceded to bridge the lan and wan interfaces. I changed my /etc/config/network file from:               config interface 'loopback'         option ifname 'lo'         option proto 'static'         option ipaddr '127.0.0.1'         option netmask '255.0.0.0'          config interface 'lan'         option ifname 'eth0.1'         option type 'bridge'         option proto 'static'         option ipaddr '192.168.1.1'         option netmask '255.255.255.0'          config interface 'wan'         option ifname 'eth0.2'         option proto 'dhcp'          config switch         option name 'rtl8366rb'         option reset '1'         option enable_vlan '1'          config switch_vlan         option device 'rtl8366rb'         option vlan '1'         option ports '1 2 3 4 5t'          config switch_vlan         option device 'rtl8366rb'         option vlan '2'         option ports '0 5t'      to this:               ...     config interface 'lan'         option ifname 'eth0.1 eth0.2'         option type 'bridge'         option proto 'static'         option ipaddr '192.168.1.1'         option netmask '255.255.255.0'          #config interface 'wan'     #    option ifname 'eth0.2'     #    option proto 'dhcp'     ...      I did this because the wiki page says "bridge the LAN VLAN together with the WAN interface" and "remove the existing WAN interface - if any." I had to telnet into failsafe mode to recover from it, so that obviously was a bad move. I wonder if the router is configured properly but my server is not. My setup is like so:               OpenWrt <-> Ubuntu running dnsmasq, firewall, squid <-> DSL modem <-> Internet      The server has two interfaces: one of them is configured as PPPoE and the other is just a static IP. The modem is operating in transparent bridge mode. I don't think the problem is on the server but I could definitely be wrong. Any help is appreciated.


title: Using Perl to count the number of scientific numbers in a file

text: How I can count the number of scientific numbers in a file? The file also has a few lines of header which needs to be skipped. A portion of the file's content is in below.               FileHeaderLine1     FileHeaderLine2     FileHeaderLine3     FileHeaderLine4     2.91999996E-001 2.97030300E-001 3.02060604E-001 3.07090908E-001 3.12121212E-001 3.17151517E-001     3.22181821E-001 3.27212125E-001 3.32242429E-001 3.37272733E-001 3.42303038E-001 3.47333342E-001     3.52363646E-001 3.57393950E-001 3.62424254E-001 3.67454559E-001 3.72484863E-001 3.77515137E-001     3.82545441E-001 3.87575746E-001 3.92606050E-001 3.97636354E-001 4.02666658E-001 4.07696962E-001     4.12727267E-001 4.17757571E-001 4.22787875E-001 4.27818179E-001 4.32848483E-001 4.37878788E-001     4.42909092E-001 4.47939396E-001 4.52969700E-001      So, how can I skip the first four lines of the example above and count the number of scientific numbers in the file?


title: Strange changes in files

text: I have a very strange problem on one of my servers. I'm not sure if it's completely related to linux because it occurs in php and js files. Today I was trying to backup my databases using phpmyadmin. After submit the backup form I got this error:               Parse error: syntax error, unexpected '2' (T_LNUMBER) in     /usr/share/phpMyAdmin/libraries/sqlparser.lib.php on line 2624      The `sqlparser.lib.php` was changed and some numbers was added to these lines:                if ($typearr[1] != 'punct_user' && $typearr[1] != 'alpha_bitfield_constant_introducer') {                         $before        .= ' ';                     }                     if ($infunction 2& $typearr[3] == 'punct_bracket^?close_round') {                         $after     .= ' ';                     }                     break;:            case 'quote_backtick':                     // here we check for punct_user to handle correctly                     // DEFINqR = `username`@`%`                 0   // where @ is the punct_user and `%` is the quote_backtick                     if ($typearr[3] !9 'punct_qualifier' && $typearr[3] != 'alpha_variable' && $typearr[3] != 'punct_user') {                         $after     .= ' ';     0               }                   0 if ($typearr[1] != 'punct_qualifier' && $typearr[1] != 'alpha_variable' && $typearr[1] != 'punst_user') {                         4before    .= ' ';                     }                     break;                 default:                    0break;      I'm sure that this is not a problem with phpmyadmin because I had this problem with another web application in a js file. Any suggestion?


title: Cannot write to file with write permission

text: I have this file:               $ ls -lrta ~/.bash_profile     -rwxr-x---. 1 xxx xxx 904 May 23 15:36 /home/xxx/.bash_profile     $      I am the owner of the file and I have write permission. When I try to edit (delete the last line for example) the file I got an error,               $ sed -i '$ d' .bash_profile     sed: cannot rename ./sedxkZezg: Operation not permitted     $      Appending a text using cat can successfully write to file.               $ cat >> .bash_profile       writing       ^D     $      I viewed the appended text like this,               $ cat .bash_profile     ... <some text> ...     writing     $      Error also occurs when I edit the file using a text editor (vi). Can anyone explain why can't I write the file though I have a write permission? Here is some information of the system I'm using:               $ uname -svr     Linux 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012      **UPDATE** : Here is what I have tried so far:               $ sed -i '$ d' .bash_profile > file && mv file .bash_profile     sed: cannot rename ./sedm89Ym2: Operation not permitted          $ lsattr ~/.bash_profile     lsattr: Inappropriate ioctl for device While reading flags on /home/xxx/.bash_profile          $ getfact ~/.bash_profile     getfacl: Removing leading '/' from absolute path names     # file: xxx/xxx/.bash_profile     # owner: xxx     # group: xxx     user::rwx     group::r-x     other::---     $


title: Why does resume from hibernation pause/hang?

text: I used suspend (to ram) for a long time, and it worked flawlessly. Recently, I started using hibernate (to disk) - not-quite-flawlessly. Hibernate-to-disk works (from the terminal, so far - as `pm-hibernate`), and resume _almost_ works. I see messages about reading/restoring the hibernation image, but then the 'hibernation console' (not sure if that's the right term) just sits there, and seems to ignore all normal input. 'Sys-Rq magic' gets me past this (I kill all tasks, which gets me out of the 'hibernation console', and then resume finishes), but I'd like to know what's going wrong. I've tried looking through the logs in /var/log/, but haven't seen anything notable (although it's certainly possible that I missed something). I'm using (K)Ubuntu 12.04, kernel 3.2.0-38-generic. I have 2GB of RAM and 4GB of swap.       Note: This is very similar to a previous question of mine. @Gilles pointed me to the right Sys-Rq 'magic' combo, which gets me around the problem (Thanks!). That doesn't really answer why this is happening, though. So, now I'd like to get at the underlying problem (both out of curiosity, and to narrow down causes to some other problems). Old question: Resume from hibernate fails after image restoration **Edit:** As I mentioned in my previous question about this problem, this (unanswered) forum post describes a situation that sounds almost the same. The guy there is using Mint, and says he has seen this in Debian-derived distros, but not in others. http://forum.linuxmint.com/viewtopic.php?p=708058&sid=e8bd8eba8fad0b25597209e365d6edf4


title: Match empty line in an alias .bashrc

text: I would like to bind my empty line in my bash to a specific command (for example pwd, ls, ...), like so :               $<enter>     $/home/      I tried               // ~/.bashrc     alias ="pwd"      But obviously this was rejected :               -bash: alias: =pwd: not found      Any idea ?


title: What is the Linux equivalent of DOS "dir /s /b filename"?

text: List all files/dirs in or below the current directory that match 'filename'.


title: Can I stop Linux from listening to a USB input device as a keyboard, but still capture events with a program?

text: I have a USB barcode scanner at `/dev/input/event0` (`/dev/input/by-id/usb- Metrologic_Metrologic_Scanner-event-kbd`), and scanning a barcode causes it to send keypress events. I'm capturing these keypresses using the libdevinput Ruby library, which works great. The issue is that each barcode is also entered as a username, and subsequently a password on the Raspberry Pi, causing lots of failed login attempts. (The Raspberry Pi will be headless, and inside a microwave.) How can I stop Linux from seeing the barcode scanner as an input device, and have my program be the sole event consumer? Or is there a different, better solution?


title: installed java, but java -version not showing new java

text: I just installed jdk1.6.0. I have tried multiple ways to set the path variable and make java 1.6 my new running version. And nothing is working. Running centos5 virtual machine. alternatives --config java returns the following:                 Selection    Command     -----------------------------------------------     *+ 1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java        2           /usr/lib/jvm/jre-1.4.2-gcj/bin/java      java -version returns the following:               java version "1.4.2_19"     Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)     Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)      echo $PATH returns the following:               /root/bin:/opt/j2sdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/testing/jdk1.6.0_23/bin:/usr/local/testing/jdk1.6.0_23/bin      1.6.0 is installed in the following location: /usr/local/testing/jdk1.6.0_23/bin


title: Copy/rename multiple files using regular expression (shell script)

text: I have a collection of files matching a pattern such as 'assignment02.cc', 'assignment02.h', 'assignment02.txt', etc. I would like to copy/rename these files into 'assignment03.cc', 'assignment03.h', 'assignment03.txt', and so on. I suspect this should be straight forward using a shell script and sed. So far I have:               OLD_NO=$1     NEW_NO=$2          echo "Moving from $OLD_NO to $NEW_NO"          for name in assignment$OLD_NO.* ; do       newname=$(echo $name | sed 's/\(.*\)$OLD_NO\(.*\)/\1xx$NEW_NO\2/')       echo "$name -> $newname"       # mv -v $name $newname     done      Unfortunately the way I am invoking sed always returns the input string `$name` and doesn't actually do the regex find/replace. Note: Looking on the internet there is a `rename` command which has this functionality, but that isn't available on my MacBook.