How do I install syslinux/extlinux to a disk image file without requiring root privileges

I have built a home-grown Linux distribution, and I can make the complete disk image file as a non-root user with one exception -- installing the boot loader. I'm using syslinux (actually extlinux), and to install it I have to loop-back mount the boot partition, which requires root/sudo privileges. The commands are run from a makefile, and the variable names should clearly indicate what to replace them with.               sudo losetup -o $(BOOT_FS_PARTITION_OFFSET) $(LOOP_DEVICE) $(IMAGE_FILE_NAME)     sudo mount $(LOOP_DEVICE) $(LOOP_MOUNT_POINT)     sudo $(EXTLINUX) -S $(DISK_SECTORS) -H $(DISK_HEADS) -i $(LOOP_MOUNT_POINT)     sudo umount $(LOOP_MOUNT_POINT)     sudo losetup -d $(LOOP_DEVICE)      Is there a way to write syslinux or extlinux to the disk image file without requiring root privileges?


How to generate menu.lua for Awesome WM from GNOME menu?

Following up on a question about the Awesome WM menu contents, I'd like to figure out _how to import the GNOME menu in its entirety_ into the menu.lua file for Awesome.


Openbox root autostart?

I want to run a script as root when the computer starts. This was earlier done in rc.local but not anymore. What i've tried:   putting the script in `/etc/profile.d`   adding the `/pathto/script.sh` in `/etc/profile`   added `/pathto/shript.sh &` in `/etc/xdg/openbox/autostart` The script is for setting things powertop recommends, the scrips works just find when i run `sudo /pathto/script.sh`


/home partition recovery

Unhappy with Gnome 3 in Ubuntu I tried Mint 14. Had a backup of my home partition. During the Mint installation I designated my old home partition, and when it booted everything was fine. There were a couple of loose ends in Mint 14 that required fixes to make my cloud server work and VariCAD 3D modeling program would not install. This install was on an old 40GB hard disk that I put aside by disconnecting it. VariCAD indicated they supported Fedora and Debian, both which I had been wanting to try for a long time. However Fedora had, like Ubuntu gone with Gnome 3, and Mate was not yet available as a standard alternative, so I've put aside Fedora for now. I had a /boot in an extended partion, as I had read that there should be no issues with that location, and as boot files are not accessed often, it seemed like a reasonable thing to do. However it did not work until I moved the boot to the beginning of the disk. I surmize it's because of an old BIOS. My partitions initially included a primary partion for the swap, one for my OS (Debian), and an extended partion for my data partitions, and the 4th primary partition was my home backup (just the way things evolved). To make room for a boot as a primary partition I killed my backup, assuming that Debian would simply take my existing home partition like Mint had. When I installed Debian and gave it my home partition location to mount on /home, with instructions NOT to format, I expected Debian to behave like Mint, having the reputation of being more conservative, not to say safer. Not so. It squashed my home. What tools and methods are there so I can recover what I can from my home partition please?


Assigning IP to a bridged interfaces

Is there a way to assign an IP to bridged interfaces? For example, under normal circumstances:               ifconfig eth0 0.0.0.0     ifconfig eth1 0.0.0.0     brctl addbr mybridge     brctl addif mybridge eth0     brctl addif mybridge eth1      So is there a way to either:   * (a) assign IPs to eth0/eth1?   * (b) if not, then is there any other way around this problem? I want to some how bridge interfaces having IPs.


How does gcc know where boost is installed

I installed boost using `sudo apt-get install` on Ubuntu. Later I did not have to give gcc the `I` flag alongwith the path to the boost libraries to use boost ! Nor did I do any `pkg-config --cflags --libs` of any sort. What is the mystery here ? How is gcc able to know where boost is and how is it linking to it automatically ?


Corruption-proof SD card filesystem for embedded Linux?

Recently we had a rather unpleasant situation with our customer - Raspberry Pi based "kiosk" used to display remote sensing data (nothing more fancy than a kiosk mode browser displaying a self-updating webpage from the data-collection server) failed to boot due to filesystem corruption. Ext4, Manual fsck required, the system will be a part of tomorrow's important presentation, service required immediately. Of course we can't require the customer to shut down the system nicely when switching it off for the night; the system must simply withstand such mistreatment. I'd like to avoid such situations in the future, and I'd like to move the OS to a filesystem that would prevent this. There's a bunch of filesystems intended for MTD devices, where getting them to run on SD card (a standard block device) requires some serious hoop-jumping. There are also some other filesystems (journalling etc) that boast good resistance against corruption. I still need to see some reasonable comparison of their pros and cons. Which filesystem available in Linux would provide best resistance against corruption on unexpected power failures and not require jumping through impossible hoops like yaffs2 in order to install to SD. Wear-balancing is a plus, but not a requirement - SD cards usually have their own mechanisms, if less than perfect, though the system should be "gentle for flash" (systems like NTFS can murder an SD card within a month).


Debian VM Can see other computers on the network but can't connect to the WWW

Similar to this SU question: http://superuser.com/questions/667631/network-is- unreachable-when-attempting-to-ping-google-but-internal-addresses Actually, it's pretty much the same base issue. I went through that thread trying to find a solution, I changed my resolv.conf:               before:     domain [my work domain]     search [my work domain]     nameserver [my network DHCP]     nameserver [my network DHCP2]      I changed it to:               after:     domain [my work domain]     search [my work domain]     nameserver 8.8.8.8     nameserver 8.8.4.4      However, any time I reboot the computer the resolv.conf gets overwritten to the previous version (the 'before' above). (it also didn't solve the issue) The issues began after I installed virtualbox additions (AKA on a fresh install and after installation of Samba it worked on the internet and my internal network perfectly), X server and (specifically) LXDE: Cat of apt history.log:               Start-Date: 2014-08-21  10:03:42     Commandline: apt-get install virtualbox-guest-utils virtualbox-guest-dkms     Install: x11-xkb-utils:amd64 (7.7+1, automatic), libxaw7:amd64 (1.0.12-2, automatic), xfonts-utils:$     End-Date: 2014-08-21  10:03:56          Start-Date: 2014-08-21  10:18:39     Commandline: apt-get install lxde     Install: desktop-base:amd64 (7.0.3, automatic), libgoa-1.0-0b:amd64 (3.12.4-1, automatic), lxmenu-d$     End-Date: 2014-08-21  10:21:52          Start-Date: 2014-08-21  10:26:40     Commandline: apt-get upgrade     Upgrade: libio-socket-ssl-perl:am      ifconfig on the guest:               root@Peridot:~# ifconfig     eth0      Link encap:Ethernet  HWaddr 08:00:27:89:c9:20  og               inet addr:172.31.2.102  Bcast:172.31.2.255  Mask:255.255.255.0               inet6 addr: fe80::a00:27ff:fe89:c920/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:2281 errors:0 dropped:1 overruns:0 frame:0               TX packets:463 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:266507 (260.2 KiB)  TX bytes:120554 (117.7 KiB)          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:4 errors:0 dropped:0 overruns:0 frame:0               TX packets:4 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0               RX bytes:240 (240.0 B)  TX bytes:240 (240.0 B)      The adapter in VBox is a bridged adapter directly onto my ethernet connection; as are my other 2 VMs (which work) Other questions I've tried:   * http://superuser.com/questions/573884/connect-network-is-unreachable-in-virtualbox-vm Edit: netstat:               root@Peridot:~# netstat -r     Kernel IP routing table     Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface     10.13.36.0      172.31.2.254    255.255.255.0   UG        0 0          0 eth0     172.31.2.0      *               255.255.255.0   U         0 0          0 eth0      /etc/network/interfaces:               root@Peridot:~# cat /etc/network/interfaces     # This file describes the network interfaces available on your system     # and how to activate them. For more information, see interfaces(5).          # The loopback network interface     auto lo     iface lo inet loopback          # The primary network interface     auto eth0     allow-hotplug eth0     iface eth0 inet dhcp      Per this question I've done the following with no success (`thapphireth` is my local machine hosting the VM. Also works if I ping other computers on the network):               root@Peridot:~# ps aux | grep dhclient     root      1849  0.0  1.3  14848  6984 ?        Ss   14:28   0:00 dhclient -v -pf                                                                                /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0     root      1960  0.0  0.1  12680   940 pts/0    S+   14:30   0:00 grep dhclient     root@Peridot:~# ps aux | grep dhclient     root      1849  0.0  1.3  14848  6984 ?        Ss   14:28   0:00 dhclient -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0     root      1963  0.0  0.1  12680   940 pts/0    S+   14:30   0:00 grep dhclient     root@Peridot:~# kill 1849     root@Peridot:~# ps aux | grep dhclient     root      1965  0.0  0.1  12680   940 pts/0    S+   14:30   0:00 grep dhclient     root@Peridot:~# dhclient eth0     RTNETLINK answers: File exists     root@Peridot:~# ping google.com     connect: Network is unreachable     root@Peridot:~# ping thapphireth     PING thapphireth.SID (172.31.2.67) 56(84) bytes of data.     64 bytes from 172.31.2.67: icmp_seq=1 ttl=128 time=0.269 ms     64 bytes from 172.31.2.67: icmp_seq=2 ttl=128 time=0.428 ms     ^C     --- thapphireth.SID ping statistics ---     2 packets transmitted, 2 received, 0% packet loss, time 1001ms     rtt min/avg/max/mdev = 0.269/0.348/0.428/0.081 ms     root@Peridot:~# ps aux | grep dhclient     root      2009  0.0  1.3  14848  6984 ?        Ss   14:30   0:00 dhclient eth0     root      2013  0.0  0.1  12680   944 pts/0    S+   14:30   0:00 grep dhclient     root@Peridot:~# kill 2009     root@Peridot:~# dhclient -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0     Internet Systems Consortium DHCP Client 4.3.1     Copyright 2004-2014 Internet Systems Consortium.     All rights reserved.     For info, please visit https://www.isc.org/software/dhcp/          Listening on LPF/eth0/08:00:27:89:c9:20     Sending on   LPF/eth0/08:00:27:89:c9:20     Sending on   Socket/fallback     DHCPREQUEST on eth0 to 255.255.255.255 port 67     DHCPACK from 172.31.2.42     RTNETLINK answers: File exists     bound to 172.31.2.102 -- renewal in 277205 seconds.     root@Peridot:~# ping google.com     connect: Network is unreachable     root@Peridot:~# ping thapphireth     PING thapphireth.SID (172.31.2.67) 56(84) bytes of data.     64 bytes from 172.31.2.67: icmp_seq=1 ttl=128 time=0.251 ms     64 bytes from 172.31.2.67: icmp_seq=2 ttl=128 time=0.798 ms     ^C     --- thapphireth.SID ping statistics ---     2 packets transmitted, 2 received, 0% packet loss, time 1001ms     rtt min/avg/max/mdev = 0.251/0.524/0.798/0.274 ms     root@Peridot:~#      results of ipconfig on windows (host machine):               Windows IP Configuration     Ethernet adapter vEthernet (Broadcom NetLink (TM) Gigabit Ethernet Virtual Switch):             Connection-specific DNS Suffix  . : SID        Link-local IPv6 Address . . . . . : fe80::5d00:6fe1:98d2:ac06%9        IPv4 Address. . . . . . . . . . . : 172.31.2.67        Subnet Mask . . . . . . . . . . . : 255.255.255.0        Default Gateway . . . . . . . . . : 172.31.2.1


Creating Windows self-extracting executables that can auto-run a script

Does a tool exist (preferably packaged in Debian) to create Windows self- extracting executables that can auto-run a script in the archive once the extracting is done? I've been toying with NSIS but I am not sure it can do what I'm asking and is rather heavyweight for this purpose.


Boot up problem with RHEL 6

I restarted my RHEL 6 box and now I can't get past the logo screen. I tried booting without the splash screen so I could see what's going on, and I'm getting an error message saying something along the lines of: > make * * * /lib/modules/[kernel]/build No such file or directory. Stop.   >  make * * * [all] Error 2 Then it starts a few other things without any problems (sshd, ntpd, ..., up to Windows binary loader), but then it hangs up after that. To me it appears that the modules folder might be missing (or incorrect), but I'm not sure if that's what's causing it from not booting at all. Would I be able to use a Live CD and fix this somehow?


What command I should execute to accomplish this:

Open connections:      COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME      php 3075 lemorpa 3u IPv4 1111738938 0t0 TCP 174.120.62.130:60602->98.139.169.19:80 (ESTABLISHED)           Recent Site Requests:               1.202.218.68 *.mortgagenewshomeloans.com /a/a/Investment/p/p/Loans/Mortgage/News/Home/Loans/szh/home          1.202.218.73 onlinemortgagemoiywi.lendersmor /tag/county/          1.202.219.3 *.mortgagenewshomeloans.com /Investments/Mortgage/News/Home/Loans/szh/Business-English-          1.202.219.3 *.mortgagenewshomeloans.com /o/w/w/Mortgage/News/Home/Loans/Forex/szh/1          1.202.219.5 *.morgagemortgagebanker.com /Loan/szh/selectcity/yellowpages/          1.202.219.5 *.morgagemortgagebanker.com /Loan/szh/selectcity/yellowpages/          1.202.219.6 ratesmortgagemoroito.lendersmor /Contract/Contract_List.asp          1.202.219.6 ratesmortgagemoroito.lendersmor /s/a/Rates/Rates/Mortgage/Mortgage/1st/szh/1       Hostgator often send me this when they're mad of my CPU usage. I wonder what command they use to display this


Get diff changes between original files installed with apt and current files

I installed `php5-fpm` package using `apt`; then I made some changes to the PHP configuration files. Now I would get the diffs between the original files versions (the ones of the package installed) and the current versions (modified by me). How to do it?


Gnome keyring issue

I am attempting to restore some files to an OpenSUSE 12.3 machine that was backed up with deja-dup (duplicity). When prompted for the password to decrypt the backup, I enter the correct password and I am prompted repeatedly with no progress. The error given in `/var/log/messages` is:               The gnome keyring socket is not owned with the same credentials as the          user login: <username removed>     gkr-pam: couldn't unlock the login keyring      In deja-dup's debugging log I have:               DUPLICITY: ERROR 31 GPGError     DUPLICITY: . GPGError: GPG Failed, see log below:     DUPLICITY: . ===== Begin GnuPG log =====     DUPLICITY: . gpg: WARNING: "--no-use-agent" is an obsolete option - it has no effect     DUPLICITY: . gpg: CAST5 encrypted data     DUPLICITY: . gpg: encrypted with 1 passphrase     DUPLICITY: . gpg: decryption failed: Bad session key     DUPLICITY: . gpg: block_filter 0x7f969a828e60: read error (size=15648,a->size=15648)     DUPLICITY: . gpg: block_filter: pending bytes!     DUPLICITY: . ===== End GnuPG log =====


GParted doesn't recognize the unallocated space after my current partition

I'm using GParted to resize my partitions on Linux. There is about 5GB of unallocated space following the partition sda5. However, when I right click on sda5 and select 'resize/move', it doesn't show the 5GB of unallocated space. So I can't increase the size of sda5 (can't drag to the right, or increase the number for file size. It shows the 'free space following' the sda5 partition as 0, even though there actually is 5GB of unallocated space. Why can't I expand my partition?


How to close ports in Linux?

I have some question in closing port, I think I got some strange things. When I use execute               nmap --top-ports 10 192.168.1.1      it shows that 23/TCP port is open. But when I execute               nmap --top-ports 10 localhost      it show that 23/tcp port is closed. Which of them is true? I want to close this port on my whole system, how can I do it?


why ss(8) understands listening UDP ports differently than netstat(8)?

If I execute `ss -lu` in order to view all the listening UDP sockets, then none of the sockets are displayed. If I execute `ss -au`, which lists all(both listening and non-listening) UDP sockets, then "listening" sockets are displayed as UNCONN:               T60:~ # lsof -n | sed -n '1p;/UDP/p'     COMMAND     PID   TID       USER   FD      TYPE     DEVICE SIZE/OFF       NODE NAME     avahi-dae   963            avahi   11u     IPv4       9088      0t0        UDP *:mdns      avahi-dae   963            avahi   12u     IPv4       9089      0t0        UDP *:44639      cupsd      1238             root   10u     IPv4       8160      0t0        UDP *:ipp      dhcpcd     2072             root    7u     IPv4     532052      0t0        UDP *:bootpc      dhclient6 13131             root    5u     IPv6      38031      0t0        UDP *:dhcpv6-client      dhclient6 13131             root   20u     IPv4      37954      0t0        UDP *:20152      dhclient6 13131             root   21u     IPv6      37955      0t0        UDP *:36745      atftpd    20639             tftp    0u     IPv4     344977      0t0        UDP *:tftp      T60:~ # netstat -lu     Active Internet connections (only servers)     Proto Recv-Q Send-Q Local Address           Foreign Address         State           udp        0      0 *:bootpc                *:*                                      udp        0      0 *:tftp                  *:*                                      udp        0      0 *:44639                 *:*                                      udp        0      0 *:ipp                   *:*                                      udp        0      0 *:20152                 *:*                                      udp        0      0 *:mdns                  *:*                                      udp        0      0 *:36745                 *:*                                      udp        0      0 *:dhcpv6-client         *:*                                      T60:~ # ss -lu     Recv-Q Send-Q                                                                                Local Address:Port                                                                                Peer Address:Port        T60:~ # ss -ua     State       Recv-Q Send-Q                                                                                Local Address:Port                                                                                Peer Address:Port        UNCONN      0      0                                                                                *:bootpc                                                                                *:*            UNCONN      0      0                                                                                *:tftp                                                                                *:*            UNCONN      0      0                                                                                *:44639                                                                                *:*            UNCONN      0      0                                                                                *:ipp                                                                                *:*            UNCONN      0      0                                                                                *:20152                                                                                *:*            UNCONN      0      0                                                                                *:mdns                                                                                *:*            UNCONN      0      0                                                                                :::36745                                                                                :::*            UNCONN      0      0                                                                                :::dhcpv6-client                                                                                :::*            T60:~ # ss -v     ss utility, iproute2-ss110629     T60:~ #       What is the logic behind this? For example running **atftpd** listening for connections, should have state LISTEN not UNCONN, shouldn't it?


Video tools for creating presentation

I have captured video (with audio) from presentation, slides (just images), and array of times (when slides was listed). Goal is to create presentation video: big slide with small video frame at the corner. What is suitable tools/software for this? From command line, from domain- specific language, from scripts... I see ffmpeg, but I'm not sure about ffmpeg abilities.


How to execute a builtin shell command using find?

I'm constrained to doing this in tcsh on CentOS due to the environment at work. When executing `find . -type f -executable -exec source '{}' \;` the only result is `find: 'source': No such file or directory` for each appropriate file. Not sure why this isn't working in tcsh as it's pretty straightforward. What am I doing wrong? Any help greatly appreciated.


CTRL-ALT-DEL for init 0?

On On my Debian 7 system the `Ctrl`-`Alt`-`Del` is this line below and is by default init 6               ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now      But I want to turn for init 0 and not init 6 when I press `Ctrl`-`Alt`-`Del`. How can I change this?


Parsing string token with bash

I have this output (from a previous command):               aaa         something     bbb         someother     ccc         blabla      For each line, I would like to create a file whose name is the first token, and whose content is the second token (for example for the first line I would like a file named 'aaa' that contains the text 'something') How should I do this?


Gphoto2 does not output anything

I'm running ArchLinux and I want to download all the pics from my EOS1100D. However when I plug the camera and run               gphoto2 --list-ports      Nothing happens at all and the program get stuck. Here's the output of               gphoto2 --list-ports --debug          0.000035 main(2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST:     0.000101 main(2): gphoto2 2.5.2     0.000121 main(2): gphoto2 has been compiled with the following options:     0.000138 main(2):  + gcc (C compiler used)     0.000152 main(2):  + popt (mandatory, for handling command-line parameters)     0.000166 main(2):  + exif (for displaying EXIF information)     0.000181 main(2):  + no cdk (for accessing configuration options)     0.000196 main(2):  + no aa (for displaying live previews)     0.000210 main(2):  + jpeg (for displaying live previews in JPEG format)     0.000225 main(2):  + readline (for easy navigation in the shell)     0.000246 main(2): libgphoto2 2.5.2     0.000263 main(2): libgphoto2 has been compiled with the following options:     0.000281 main(2):  + all camlibs     0.000296 main(2):  + gcc (C compiler used)     0.000311 main(2):  + ltdl (for portable loading of camlibs)     0.000326 main(2):  + EXIF (for special handling of EXIF files)     0.000342 main(2): libgphoto2_port 0.10.0     0.000359 main(2): libgphoto2_port has been compiled with the following options:     0.000374 main(2):  + gcc (C compiler used)     0.000389 main(2):  + ltdl (for portable loading of camlibs)     0.000403 main(2):  + USB (libusb1, for USB cameras)     0.000417 main(2):  + serial (for serial cameras)     0.000431 main(2):  + no resmgr (serial port access and locking)     0.000445 main(2):  + no ttylock (serial port locking)     0.000492 main(2):  + no lockdev (serial port locking)     0.000506 main(2): CAMLIBS env var not set, using compile-time default instead     0.000521 main(2): IOLIBS env var not set, using compile-time default instead     0.000557 setting/gphoto2-setting.c(2): Creating $HOME/.gphoto     0.000651 setting/gphoto2-setting.c(2): Loading settings from file "/home/ben/.gphoto/settings"     0.000900 gphoto2-port-info-list(2): Using ltdl to load io-drivers from '/usr/lib/libgphoto2_port/0.10.0'...     0.001013 gphoto2-port-info-list(2): Called for filename '/usr/lib/libgphoto2_port/0.10.0/disk'.     0.001235 gphoto2-port/disk(2): found fstab fsname /dev/sda3     0.001269 gphoto2-port/disk(2): found fstab fsname /dev/sda4     0.001291 gphoto2-port/disk(2): found fstab fsname /dev/sda1     0.001313 gphoto2-port/disk(2): found fstab fsname /dev/sda2     0.001334 gphoto2-port/disk(2): found fstab fsname //192.168.0.2/MyBook     0.005221 gphoto2-port/disk(2): found fstab fsname //192.168.0.2/Wall-E     0.007825 gphoto2-port/disk(2): found fstab fsname UUID=1d35b80b-e466-4c92-af21-01c663f9dae1      I tried to run gphoto2 --sumary but I get the same result.


Grep for single and double digit

i have path name as below,   1. abc4/2012   2. abc4/2013   3. abc45/2014   4. abc45/2014 When i grep for 45 it is showing one instance of 4 and for 4 its showing all 45. i need to grep both single digit and double digit separately. please help


How to add SSL with cURL URL using Ubuntu Terminal

While running a Twitter API from cURL in Ubuntu Terminal it asked me to use SSL. After searching for it, I tried:               sudo curl -s https://localhost:8080/tweets/HLaddha          sudo curl -k https://localhost:8080/tweets/HLaddha          sudo curl --cert-type SSL https://localhost:8080/tweets/HLaddha          openssl s_client -connect facebook.com:443 |tee logfile     sudo curl --cacert logfile https://localhost:8080/tweets/HLaddha      But I could not find the correct usage. How do I do it? The error message I get is: > curl: (35) Unknown SSL protocol error in connection to localhost:8080


How does my partition (ext4) know its size of used/free space?

I ran `df`, and the output appears almost instantly:               (FS        Size  Used   Avail  Use%)     /dev/sda1  145G  8.4G   130G   7%      sda1 is an ext4 partition. Without summing the size of all files, how can `df` give me the space information almost instantly?


xampp fail to start, apache running, but apache is not installed!

I am having a strange problem. When I try to start xampp it fails with message:               XAMPP: Another web server daemon is already running.      When I tried to find out which server is running using following command:               netstat -tunap | grep LISTEN      result:               tcp        0      0 127.0.1.1:53        0.0.0.0:*        LISTEN  1955/dnsmasq             tcp        0      0 127.0.0.1:631       0.0.0.0:*        LISTEN  1262/cupsd             tcp        0      0 0.0.0.0:17500       0.0.0.0:*        LISTEN  2353/dropbox            tcp        0      0 0.0.0.0:20414       0.0.0.0:*        LISTEN  2297/skype               tcp6       0      0 :::80                    :::*        LISTEN  1366/apache2         tcp6       0      0 ::1:631                  :::*        LISTEN  1262/cupsd      Here I see apache is running with, to verify it is installed or not I excuted following command:               dpkg -s apache2      Result:               dpkg-query: package 'apache2' is not installed and no information is available      Every Time I have to kill apache2 before starting xampp, which is very irritating. I am on Ubuntu 12.04,


How to install virtualbox guest addition in a guest machine with the latest Archlinux?

I want to install the virtualbox guest addition in a guest Archlinux machine. The vbox version is **4.2.10 r84104** , and the Arch install media is the latest release **2013.04.01** with `systemd` as the default program to boot the system. I mounted the iso file and `cd` to the mount point, run `./VBoxLinuxAdditions.run`, but it reports `Unable to determine your linux distribution`. I checked that install script, and finding that in the function `check_system_type()`, there's no branch dealing with Archlinux. I tried to `touch` a file like `/etc/gentoo-release` but failed. How can I install the additions? Any help or advice will be appreciated.


How to configure Sendmail in a jail to get correct FQDN?

I am building a mail server using FreeBSD 9.1-RELEASE with a jail. On the direct OS, all what I have to do was only adding my domain name to `/etc/mail/local-host-names` file. Anyway I wanted to run Sendmail in a jail. So I add a jail, and added a NAT rule (using `pf`) to redirect TCP 25 traffic into the jail. In a Jail, Sendmail is working well, but there's one problem. When I am sending a mail in the jail, sender domain address is printed as the jail's hostname. This is expected an normal operation on direct OS, but in a jail, I want to change this default sender domain name to proper one. _How can I change default sender domain name of Sendmail?_ Also, I am planning to install an IMAP server in the same jail.(maybe `dovecot`) Can this affect to there too? If I want to make any future services work well, what should I do?


Edit a file on CentOS 6.3 Minimal

I installed CentOS 6.3 Minimal on VMWare Player, and I realized how 'minimal' the setup is... Don't have network connectivity. From what I searched on google, I need to edit the file > /etc/sysconfig/network-scripts/ifcfg-eth0 but since I don't have any editor installed (as far as I know), I don't know how to edit the file. How do I edit the file????


How to make log-rotate change take effect

I followed this link to change log-rotate configuration. https://access.redhat.com/site/documentation/en- US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-logfiles-locating.html After I made the change to config file, what should I do to let this take effect?


How to disable nvidia ion on Asus eeepc 1201NL?

It seems that my netbook consumes battery too aggressively. I've been told that Nvidia ION videocard embedded into it has 2 cores and one of them is consuming battery all the time in Linux, since it has been designed for Windows usage only, and there's no driver capable to manage it in Linux. Is there any way to turn it off completely and use only one video core? My distro is Debian based CrunchBang.


how to solve "authentication failed" error in kde

I have KDE installed in my archLinux with kdm to login. But it always shows a notification dialog with "authentication failed" about every 2 minutes. I use a kdm to login and I have enter the user name and password. Why does it show "authentication failed"? Anyone who encountered this problem can help me? **Finally this problem disppear because I reinstall kde.Thanks for all of you!**


What's the diference between comparison inside if using two or a single equal (=)

Read that for comparing string inside `if` we need to use double square brackets. Some books says that comparison can be done by `=`. But it works withe `==` also.               #!/bin/bash     a="hello"     b="world"     if [[ $a == $b ]];then         echo "equal"     fi      Why is that?


How to run part of a script with reduced privileges?

I have the following problem: On every machine running Postgresql there is a special user _postgres_. This user has administrative access to the database server. Now I want to write a Bash script that executes a database command with psql as user _postgres_ (psql shall execute as user _postgres_ , not the script). So far, that wouldn't be a problem: I could just run the script as user _postgres_. However, I want to write the output of psql to a file in a directory where _postgres_ has no write access. How can I do that?      I thought about changing EUIDs in the script itself, however:   1. I couldn't find a way to change the EUID in a Bash script   2. How can I change the EUID when using something like   `psql -U postgres -c "<command>" > file`?


change tty login timeout - ArchLinux

By default when I login to my Arch linux box in a tty, there is a timeout after I type my username but before I type my password. So it goes like this               Login:  mylogin <enter>     Password:     (+ 60 seconds)     Login:      As you can see, if I don't type the password it recycles the prompt -- I want it to wait indefinitely for my password instead of recycling the login prompt. Is this possible? It seems like the `--timeout` option to `agetty` would be what I want. However, I tried adding this flag in the getty files in `/usr/lib/systemd/system/` (the option is not used by default), and rebooting -- it seemed to have no effect.


Can I do a "test run" with rsnapshot?

I occasionally make changes to my `rsnapshot.conf` and I'm wondering if there's any way I can do a test run that is sync-ed to a location other than the normal flow... something that's not an `interval`. Is this possible? how?


X has blank screen but clearly runs

At my last reboot X started but blacked the screen. When logging into the system remotely all processes seem to be running just fine (e.g. Firefox is automatically started), so X is clearly running, but it is likely just a small switch that tells the screen to go black instead of showing the display. I have tried removing xorg.conf and get the same result. The system has an nVidia card and an Intel card. I have so far been using the Intel card, but as long as the drivers for the cards are free software I don't really care which card to use. How can I get the display working again? Xorg.0.log: https://gist.github.com/anonymous/94de1dab2894f183afbc               # lshw -C display     *-display UNCLAIMED             description: VGA compatible controller        product: GK107M [GeForce GT 740M]        vendor: NVIDIA Corporation        physical id: 0        bus info: pci@0000:01:00.0        version: a1        width: 64 bits        clock: 33MHz        capabilities: pm msi pciexpress vga_controller bus_master cap_list        configuration: latency=0        resources: memory:d2000000-d2ffffff memory:a0000000-afffffff memory:b0000000-b1ffffff ioport:4000(size=128) memory:b2000000-b207ffff     *-display        description: VGA compatible controller        product: 3rd Gen Core processor Graphics Controller        vendor: Intel Corporation        physical id: 2        bus info: pci@0000:00:02.0        version: 09        width: 64 bits        clock: 33MHz        capabilities: msi pm vga_controller bus_master cap_list rom        configuration: driver=i915 latency=0        resources: irq:47 memory:d4000000-d43fffff memory:c0000000-cfffffff ioport:5000(size=64)


How to visualize time-series data?

I have some time-series data I want to visualize as 2d plot. The input is ISO-date-format and value separated by space, one record per line:               2010-10-21 23     2010-10-22 32     etc.      The output should be a nice looking 2d plot. Basic requirements:   * output to a X11 window (as preview) and to a png file   * x-axis has to _understand_ the dates and naturally scale the data, e.g. a gap between 3 days should be three times as long as a gap between 1 day   * should be callable from a script   * nice output and convenient to use Bonus:   * svg output I tried `gnuplot` and it works - it has some date support:               gnuplot> set xdata time     gnuplot> set timefmt "%Y-%m-%d"     gnuplot> plot "test.dat" using 1:2      But I have some problems with gnuplot:   * with default settings plots look very ugly   * it is difficult to find stuff in the manual - e.g. when plotting points how do I use small filled circles instead of the default '+' sign?   * the gnuplot shell is a pain in the neck - it does not use readline, it is broken, command completion is a joke, I don't know how to enable vi shortcuts - or if they are supported, what about reverse search etc. Thus my question: What are the alternatives for visualizing time-series data? Or am I overstating the gnuplot issues?


Inconsistency in behavior of 'rm' when a mounted volume is involved?

If I run the following sequence of commands:               mkdir dir     ln -s dir link     rm -r link/      I get this output:               rm: cannot remove `link': Not a directory      I get the warning because I could simply have issued `rm -r link` or, better still, `rm link`. Regardless, that command did get the job done (i.e. removed the file named " **link** "). Things are a bit different when doing such a thing on a mounted volume, where " **dir** " is replaced with some like " **/media/my_movies** ". In such a case, the entire volume will be wiped, not just the symlink as in the previous example. Why is it like that? Is this some bug in `rm`, or is this expected? Why the inconsistency? **UPDATE** : Maybe I was dizzy when I was experiencing this because when I try now, " **dir** " is not getting deleted while its contents are, and in both cases (mounted and local directory). I'm using Linux **2.6.32** , and I think I was using **2.6.37** then.


Port forwarding only works for first packet sent

I'm trying to configure port forwarding (80 and 443) on my new router. The router is a Xiaomi Mi Wi-fi, that establishes a PPPOE session with a VDSL2 modem/router (BBox2). The Xiaomi router runs a version of OpenWRT, which makes it possible to examine iptables etc. The problem is that a connection can get started with the right system, but fails to deliver any more than the first packet. I expect there to be something wrong with the ESTABLISHED rules from iptables. The weird thing is that I can't seem to find anyone with the same problem on the Xiaomi support forums. I've flashed different firmwares and reverted to factory settings multiple times, but nothing fixes the forwarding problems. Does anybody know a possible cause for these problems? I can post the contents of `/etc/config/firewall` or iptables, but don't know how that's usually done here. Output of `iptables-save -c`:               # Generated by iptables-save v1.4.12.2 on Mon Jun  9 03:01:51 2014     *raw     :PREROUTING ACCEPT [1946406:2827242333]     :OUTPUT ACCEPT [332543:85794398]     :notrack - [0:0]     [1946406:2827242333] -A PREROUTING -j notrack     COMMIT     # Completed on Mon Jun  9 03:01:51 2014     # Generated by iptables-save v1.4.12.2 on Mon Jun  9 03:01:51 2014     *nat     :PREROUTING ACCEPT [3867:297334]     :INPUT ACCEPT [1116:76226]     :OUTPUT ACCEPT [3096:204986]     :POSTROUTING ACCEPT [340:25144]     :MINIUPNPD - [0:0]     :delegate_postrouting - [0:0]     :delegate_prerouting - [0:0]     :postrouting_lan_rule - [0:0]     :postrouting_rule - [0:0]     :postrouting_wan_rule - [0:0]     :prerouting_lan_rule - [0:0]     :prerouting_rule - [0:0]     :prerouting_wan_rule - [0:0]     :zone_lan_postrouting - [0:0]     :zone_lan_prerouting - [0:0]     :zone_wan_postrouting - [0:0]     :zone_wan_prerouting - [0:0]     [5299:458068] -A PREROUTING -j delegate_prerouting     [9134:611886] -A POSTROUTING -j delegate_postrouting     [0:0] -A MINIUPNPD -p udp -m udp --dport 63645 -j DNAT --to-destination 192.168.31.130:63645     [9134:611886] -A delegate_postrouting -m comment --comment "user chain for postrouting" -j postrouting_rule     [73:14404] -A delegate_postrouting -o br-lan -j zone_lan_postrouting     [8123:538671] -A delegate_postrouting -o pppoe-wan -j zone_wan_postrouting     [5299:458068] -A delegate_prerouting -m comment --comment "user chain for prerouting" -j prerouting_rule     [4161:288905] -A delegate_prerouting -i br-lan -j zone_lan_prerouting     [1060:137321] -A delegate_prerouting -i pppoe-wan -j zone_wan_prerouting     [0:0] -A prerouting_lan_rule -p udp -m udp --dport 53 -m u32 --u32 "0x0>>0x16&0x3c@0x14&0xffdfdfdf=0x3575757&&0x0>>0x16&0x3c@0x18&0xffdfdfdf=0x64d4957&&0x0>>0x16&0x3c@0x1c&0xdfdfdfff=0x49464903&&0x0>>0x16&0x3c@0x20&0xdfdfdf00=0x434f4d00" -j REDIRECT --to-ports 53     [2:112] -A prerouting_lan_rule -p udp -m udp --dport 53 -m u32 --u32 "0x0>>0x16&0x3c@0x14&0xffdfdfdf=0x64d4957&&0x0>>0x16&0x3c@0x18&0xdfdfdfff=0x49464903&&0x0>>0x16&0x3c@0x1c&0xdfdfdf00=0x434f4d00" -j REDIRECT --to-ports 53     [73:14404] -A zone_lan_postrouting -m comment --comment "user chain for postrouting" -j postrouting_lan_rule     [0:0] -A zone_lan_postrouting -s 192.168.31.0/24 -d 192.168.31.230/32 -p tcp -m tcp --dport 443 -m comment --comment "webssl (reflection)" -j SNAT --to-source 192.168.31.1     [0:0] -A zone_lan_postrouting -s 192.168.31.0/24 -d 192.168.31.230/32 -p tcp -m tcp --dport 80 -m comment --comment "web (reflection)" -j SNAT --to-source 192.168.31.1     [0:0] -A zone_lan_postrouting -s 192.168.31.0/24 -d 192.168.31.230/32 -p udp -m udp --dport 7000 -m comment --comment "7000 (reflection)" -j SNAT --to-source 192.168.31.1     [4161:288905] -A zone_lan_prerouting -m comment --comment "user chain for prerouting" -j prerouting_lan_rule     [0:0] -A zone_lan_prerouting -s 192.168.31.0/24 -d 80.236.194.133/32 -p tcp -m tcp --dport 443 -m comment --comment "webssl (reflection)" -j DNAT --to-destination 192.168.31.230:443     [0:0] -A zone_lan_prerouting -s 192.168.31.0/24 -d 80.236.194.133/32 -p tcp -m tcp --dport 80 -m comment --comment "web (reflection)" -j DNAT --to-destination 192.168.31.230:80     [0:0] -A zone_lan_prerouting -s 192.168.31.0/24 -d 80.236.194.133/32 -p udp -m udp --dport 7000 -m comment --comment "7000 (reflection)" -j DNAT --to-destination 192.168.31.230:7000     [8123:538671] -A zone_wan_postrouting -m comment --comment "user chain for postrouting" -j postrouting_wan_rule     [8123:538671] -A zone_wan_postrouting -j MASQUERADE     [1060:137321] -A zone_wan_prerouting -j MINIUPNPD     [1060:137321] -A zone_wan_prerouting -m comment --comment "user chain for prerouting" -j prerouting_wan_rule     [0:0] -A zone_wan_prerouting -p tcp -m tcp --dport 443 -m comment --comment webssl -j DNAT --to-destination 192.168.31.230:443     [3:120] -A zone_wan_prerouting -p tcp -m tcp --dport 80 -m comment --comment web -j DNAT --to-destination 192.168.31.230:80     [0:0] -A zone_wan_prerouting -p udp -m udp --dport 7000 -m comment --comment 7000 -j DNAT --to-destination 192.168.31.230:7000     COMMIT     # Completed on Mon Jun  9 03:01:51 2014     # Generated by iptables-save v1.4.12.2 on Mon Jun  9 03:01:51 2014     *mangle     :PREROUTING ACCEPT [1942255:2821096845]     :INPUT ACCEPT [1927165:2820010041]     :FORWARD ACCEPT [14788:994537]     :OUTPUT ACCEPT [332393:85784888]     :POSTROUTING ACCEPT [349136:86943570]     :fwmark - [0:0]     :miqos0 - [0:0]     :miqosc - [0:0]     :mssfix - [0:0]     [1946406:2827242333] -A PREROUTING -j fwmark     [14788:994537] -A FORWARD -j mssfix     [14788:994537] -A FORWARD -j miqos0     [6660:498810] -A miqos0 -m connmark ! --mark 0x0/0xfff00000 -j CONNMARK --restore-mark --nfmask 0xfffff --ctmask 0xfff00000     [0:0] -A miqos0 -m connmark ! --mark 0x0/0xf00000 -j RETURN     [8839:470087] -A miqos0 ! -d 192.168.31.0/24 -j IPMARK --copyfrom 0      [5949:524450] -A miqos0 -d 192.168.31.0/24 -j IPMARK --copyfrom 1      [14788:994537] -A miqos0 -j miqosc     [14788:994537] -A miqos0 -j CONNMARK --save-mark --nfmask 0xfff00000 --ctmask 0xfffff     [2000:112040] -A mssfix -o pppoe-wan -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "wan (mtu_fix)" -j TCPMSS --clamp-mss-to-pmtu     COMMIT     # Completed on Mon Jun  9 03:01:51 2014     # Generated by iptables-save v1.4.12.2 on Mon Jun  9 03:01:51 2014     *filter     :INPUT ACCEPT [0:0]     :FORWARD DROP [0:0]     :OUTPUT ACCEPT [0:0]     :MINIUPNPD - [0:0]     :delegate_forward - [0:0]     :delegate_input - [0:0]     :delegate_output - [0:0]     :forwarding_lan_rule - [0:0]     :forwarding_rule - [0:0]     :forwarding_wan_rule - [0:0]     :input_lan_rule - [0:0]     :input_rule - [0:0]     :input_wan_rule - [0:0]     :macfilter_admin - [0:0]     :macfilter_lan - [0:0]     :macfilter_wan - [0:0]     :output_lan_rule - [0:0]     :output_rule - [0:0]     :output_wan_rule - [0:0]     :reject - [0:0]     :zone_lan_dest_ACCEPT - [0:0]     :zone_lan_forward - [0:0]     :zone_lan_input - [0:0]     :zone_lan_output - [0:0]     :zone_lan_src_ACCEPT - [0:0]     :zone_lan_src_REJECT - [0:0]     :zone_wan_dest_ACCEPT - [0:0]     :zone_wan_forward - [0:0]     :zone_wan_input - [0:0]     :zone_wan_output - [0:0]     :zone_wan_src_REJECT - [0:0]     [1931316:2826155529] -A INPUT -j delegate_input     [14788:994537] -A FORWARD -j delegate_forward     [332543:85794398] -A OUTPUT -j delegate_output     [0:0] -A MINIUPNPD -d 192.168.31.130/32 -p udp -m udp --dport 63645 -j ACCEPT     [14788:994537] -A delegate_forward -m comment --comment "user chain for forwarding" -j forwarding_rule     [5946:524330] -A delegate_forward -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT     [0:0] -A delegate_forward -i br-lan -j zone_lan_forward     [3:120] -A delegate_forward -i pppoe-wan -j zone_wan_forward     [0:0] -A delegate_forward -j reject     [3681:558603] -A delegate_input -i lo -j ACCEPT     [1927635:2825596926] -A delegate_input -m comment --comment "user chain for input" -j input_rule     [1922722:2825107237] -A delegate_input -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT     [3525:328051] -A delegate_input -i br-lan -j zone_lan_input     [1313:152449] -A delegate_input -i pppoe-wan -j zone_wan_input     [3681:558603] -A delegate_output -o lo -j ACCEPT     [328862:85235795] -A delegate_output -m comment --comment "user chain for output" -j output_rule     [319326:83880272] -A delegate_output -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT     [3822:987647] -A delegate_output -o br-lan -j zone_lan_output     [5714:367876] -A delegate_output -o pppoe-wan -j zone_wan_output     [14788:994537] -A forwarding_rule -j macfilter_wan     [75:9189] -A input_rule -d 192.168.31.1/32 -i br-lan -p tcp -m multiport --dports 80,443,23,22 -j macfilter_admin     [75:9189] -A macfilter_admin -m mac --mac-source 70:18:8B:82:16:15 -j ACCEPT     [0:0] -A macfilter_admin -m mac --mac-source 58:94:6B:AC:A6:3C -j ACCEPT     [0:0] -A macfilter_admin -m mac --mac-source F6:D0:10:12:E6:44 -j ACCEPT     [0:0] -A macfilter_admin -m mac --mac-source 00:1D:09:BD:E5:C2 -j ACCEPT     [3075:161793] -A macfilter_wan -m mac --mac-source 70:18:8B:82:16:15 -j ACCEPT     [4067:181372] -A macfilter_wan -m mac --mac-source 58:94:6B:AC:A6:3C -j ACCEPT     [100:5222] -A macfilter_wan -m mac --mac-source F6:D0:10:12:E6:44 -j ACCEPT     [1597:121700] -A macfilter_wan -m mac --mac-source 00:1D:09:BD:E5:C2 -j ACCEPT     [116:5156] -A reject -p tcp -j REJECT --reject-with tcp-reset     [1196:147265] -A reject -j REJECT --reject-with icmp-port-unreachable     [3822:987647] -A zone_lan_dest_ACCEPT -o br-lan -j ACCEPT     [0:0] -A zone_lan_forward -m comment --comment "user chain for forwarding" -j forwarding_lan_rule     [0:0] -A zone_lan_forward -s 192.168.31.0/24 -d 192.168.31.230/32 -p tcp -m tcp --dport 443 -m comment --comment "webssl (reflection)" -j zone_lan_dest_ACCEPT     [0:0] -A zone_lan_forward -s 192.168.31.0/24 -d 192.168.31.230/32 -p tcp -m tcp --dport 80 -m comment --comment "web (reflection)" -j zone_lan_dest_ACCEPT     [0:0] -A zone_lan_forward -s 192.168.31.0/24 -d 192.168.31.230/32 -p udp -m udp --dport 7000 -m comment --comment "7000 (reflection)" -j zone_lan_dest_ACCEPT     [0:0] -A zone_lan_forward -m comment --comment "forwarding lan -> wan" -j zone_wan_dest_ACCEPT     [0:0] -A zone_lan_forward -j zone_lan_src_REJECT     [3525:328051] -A zone_lan_input -m comment --comment "user chain for input" -j input_lan_rule     [3525:328051] -A zone_lan_input -j zone_lan_src_ACCEPT     [3822:987647] -A zone_lan_output -m comment --comment "user chain for output" -j output_lan_rule     [3822:987647] -A zone_lan_output -j zone_lan_dest_ACCEPT     [3525:328051] -A zone_lan_src_ACCEPT -i br-lan -j ACCEPT     [0:0] -A zone_lan_src_REJECT -i br-lan -j reject     [5714:367876] -A zone_wan_dest_ACCEPT -o pppoe-wan -j ACCEPT     [3:120] -A zone_wan_forward -j MINIUPNPD     [3:120] -A zone_wan_forward -m comment --comment "user chain for forwarding" -j forwarding_wan_rule     [0:0] -A zone_wan_forward -d 192.168.31.230/32 -p tcp -m tcp --dport 443 -m comment --comment webssl -j ACCEPT     [3:120] -A zone_wan_forward -d 192.168.31.230/32 -p tcp -m tcp --dport 80 -m comment --comment web -j ACCEPT     [0:0] -A zone_wan_forward -d 192.168.31.230/32 -p udp -m udp --dport 7000 -m comment --comment 7000 -j ACCEPT     [0:0] -A zone_wan_forward -j zone_wan_src_REJECT     [1313:152449] -A zone_wan_input -m comment --comment "user chain for input" -j input_wan_rule     [0:0] -A zone_wan_input -p udp -m udp --dport 68 -m comment --comment Allow-DHCP-Renew -j ACCEPT     [1:28] -A zone_wan_input -p icmp -m icmp --icmp-type 8 -m comment --comment Allow-Ping -j ACCEPT     [0:0] -A zone_wan_input -p tcp -m tcp --dport 1080 -m comment --comment "\'xunlei wan accept tcp port 1080 4662 2080 2062\'" -j ACCEPT     [0:0] -A zone_wan_input -p tcp -m tcp --dport 4662 -m comment --comment "\'xunlei wan accept tcp port 1080 4662 2080 2062\'" -j ACCEPT     [0:0] -A zone_wan_input -p tcp -m tcp --dport 2080 -m comment --comment "\'xunlei wan accept tcp port 1080 4662 2080 2062\'" -j ACCEPT     [0:0] -A zone_wan_input -p tcp -m tcp --dport 2062 -m comment --comment "\'xunlei wan accept tcp port 1080 4662 2080 2062\'" -j ACCEPT     [0:0] -A zone_wan_input -p udp -m udp --dport 4661 -m comment --comment "xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066" -j ACCEPT     [0:0] -A zone_wan_input -p udp -m udp --dport 3027 -m comment --comment "xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066" -j ACCEPT     [0:0] -A zone_wan_input -p udp -m udp --dport 888 -m comment --comment "xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066" -j ACCEPT     [0:0] -A zone_wan_input -p udp -m udp --dport 666 -m comment --comment "xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066" -j ACCEPT     [0:0] -A zone_wan_input -p udp -m udp --dport 2037 -m comment --comment "xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066" -j ACCEPT     [0:0] -A zone_wan_input -p udp -m udp --dport 2061 -m comment --comment "xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066" -j ACCEPT     [0:0] -A zone_wan_input -p udp -m udp --dport 2048 -m comment --comment "xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066" -j ACCEPT     [0:0] -A zone_wan_input -p udp -m udp --dport 2066 -m comment --comment "xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066" -j ACCEPT     [1312:152421] -A zone_wan_input -j zone_wan_src_REJECT     [5714:367876] -A zone_wan_output -m comment --comment "user chain for output" -j output_wan_rule     [5714:367876] -A zone_wan_output -j zone_wan_dest_ACCEPT     [1312:152421] -A zone_wan_src_REJECT -i pppoe-wan -j reject     COMMIT     # Completed on Mon Jun  9 03:01:51 2014      The contents of iptables is generated from the default contents `/etc/config/firewall`. Only port forwarding from 80, 443 and 7000 has been added. If it makes things easier, I could disable some lines in `/etc/config/firewall`.


Counting numbers in Emacs

Say I have the following long line selected in Emacs. How can I cound how many numbers (or NaN) I have? I tried `M-x count-words` but it yields the wrong number. It says `1 line 1135 words and 3565 characters`, but it actually has `640` numbers > 0.967 1.043 1.313 1.598 1.879 2.151 2.421 2.918 3.209 3.478 3.736 3.975 > 0.917 1.012 1.317 1.607 1.900 2.173 2.437 2.929 3.203 3.473 3.714 3.954 > 1.081 1.297 1.570 1.753 1.964 2.209 2.456 2.699 2.947 3.196 3.566 3.822 > 4.050 4.268 4.423 0.950 1.080 1.212 1.343 1.617 1.911 2.219 2.487 2.750 > 3.213 3.489 3.732 3.957 4.180 0.965 1.074 1.176 1.280 1.381 1.636 1.871 > 2.108 2.357 2.614 3.080 3.374 3.666 3.943 4.205 0.992 1.151 1.294 1.422 > 1.527 1.653 1.894 2.094 2.311 2.557 2.820 3.263 3.559 3.849 4.115 4.349 > 0.895 0.997 1.119 1.215 1.313 1.401 1.649 1.898 2.152 2.411 2.667 3.143 > 3.446 3.723 3.969 4.207 0.947 1.155 1.369 1.599 1.838 2.094 2.597 2.941 > 3.265 3.570 3.852 1.120 1.396 1.680 1.970 2.297 2.781 3.075 3.344 3.596 > 3.835 1.020 1.181 1.335 1.514 1.675 1.868 2.124 2.401 2.719 2.995 3.255 > 3.617 3.896 4.131 4.309 4.461 0.893 1.003 1.094 1.202 1.464 1.732 2.022 > 2.289 2.562 3.030 3.338 3.609 3.852 4.095 1.026 1.219 1.403 1.585 1.759 > 2.041 2.285 2.535 2.796 3.058 3.486 3.754 4.009 4.210 4.394 0.900 1.005 > 1.127 1.255 1.415 1.715 2.015 2.322 2.622 2.924 3.346 3.624 3.842 4.034 > 4.212 0.926 1.045 1.143 1.392 1.648 1.905 2.155 2.423 2.912 3.227 3.509 > 3.767 4.017 0.968 1.154 1.335 1.511 1.655 1.813 1.968 2.188 2.428 2.659 > 2.932 3.204 3.591 3.878 4.122 4.334 4.506 1.027 1.194 1.315 1.433 1.536 > 1.699 1.826 2.063 2.352 2.653 2.960 3.187 3.575 3.842 4.058 4.247 4.427 > 0.963 1.147 1.351 1.539 1.679 1.883 2.070 2.279 2.551 2.828 3.234 3.564 > 3.886 4.150 4.315 0.966 1.141 1.294 1.446 1.596 1.857 2.156 2.413 2.669 > 2.879 3.307 3.592 3.828 4.064 4.300 0.924 1.163 1.428 1.712 1.992 2.291 > 2.778 3.103 3.397 3.659 3.893 0.896 1.008 1.109 1.196 1.296 1.532 1.781 > 2.038 2.301 2.574 3.059 3.354 3.630 3.893 4.144 0.930 1.063 1.330 1.580 > 1.865 2.160 2.439 2.912 3.221 3.520 3.784 3.988 0.954 1.079 1.205 1.282 > 1.465 1.676 1.908 2.160 2.411 2.881 3.246 3.554 3.831 4.081 0.905 0.972 > 1.040 1.287 1.541 1.802 2.080 2.384 2.876 3.183 3.471 3.730 3.969 1.045 > 1.235 1.398 1.583 1.758 2.048 2.294 2.522 2.763 3.009 3.417 3.689 3.941 > 4.184 4.411 0.964 1.075 1.186 1.291 1.525 1.782 2.063 2.347 2.606 3.079 > 3.394 3.661 3.899 4.131 0.957 1.118 1.276 1.404 1.611 1.848 2.118 2.406 > 2.680 3.129 3.465 3.764 3.997 4.192 0.982 1.114 1.263 1.527 1.800 2.084 > 2.382 2.680 3.137 3.429 3.688 3.917 4.127 0.982 1.054 1.133 1.189 1.243 > 1.327 1.568 1.822 2.075 2.351 2.629 3.086 3.386 3.667 3.922 4.153 0.965 > 1.098 1.238 1.399 1.503 1.591 1.670 1.895 2.128 2.371 2.622 2.886 3.341 > 3.634 3.897 4.126 4.338 0.915 1.050 1.183 1.300 1.443 1.558 1.825 2.069 > 2.348 2.641 2.916 3.360 3.634 3.893 4.109 4.308 1.025 1.187 1.363 1.512 > 1.657 1.806 2.085 2.346 2.595 2.846 3.091 3.500 3.755 3.999 4.232 4.454 > 1.065 1.231 1.400 1.560 1.717 1.870 1.984 2.198 2.427 2.655 2.896 3.110 > 3.524 3.813 4.060 4.287 4.501 0.895 0.991 1.089 1.183 1.302 1.409 1.666 > 1.926 2.168 2.434 2.700 3.148 3.438 3.718 3.988 4.230 1.027 1.169 1.348 > 1.439 1.581 1.788 1.992 2.272 2.564 2.977 3.327 3.601 3.871 4.052 4.181 > 4.181 4.181 6235366411468800.000 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN > NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN > NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN > NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN > NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN > NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN > NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN > NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN > NaN


How to copy or read the return value (exit status) from AWK script into the shell script (bash) to be used in if statement to compare

I want to read the error codes or the exit status of awk script into shell to use in if condition to compare for error handling my shell script looks something like: **My script:**               #!/bin/sh          awk -v CONFIG_SOURCE=Testfile1.txt -f test.awk          echo $?  # prints the error code '2' in this case, if the file is actually not available     recval =  $?          if ($recval == '$2') **//this condition statement doesn't seems to work.**     then      echo "Some error"     fi      **test.awk file:**               BEGIN {        ignore_line = 0;        if ( CONFIG_SOURCE == "" )        {           print "Error: Invalid embed source file.";           exit 1        }        if ( 0 != system( "[ -f " CONFIG_SOURCE " ] " ) )        {           print "Error: Embed source file '" CONFIG_SOURCE "' does not exist."           exit 2        }     }      **So, if the file is not available, it will return exit status '2',which i can echo but,how to copy the value '2' or the exit status to some variable(recval) in shell)**


using SFTP: Permission denied, please try again,

system info               uzair@zaidi:~/Desktop/tftpboot$ uname -a     Linux zaidi 3.11.0-20-generic #35~precise1-Ubuntu SMP Fri May 2 21:35:48 UTC 2014 i686 i686 i386 GNU/Linux     uzair@zaidi:~/Desktop/tftpboot$      I get this error when using sftp:               #sftp zaidi@192.168.1.9      zaidi@192.168.1.9's password:      Permission denied, please try again.     zaidi@192.168.1.9's password:       even if enter correct password(of root) Please tell me, how to resolve this problem.


How to limit network bandwidth after some data transferred?

So the question is in the name of topic. How to limit bandwidth I know. Using `tc`. But how to do so after, for example, traffic had reached 500MB. And after some time reset the limits.


How do I set my samba share to allow guest users to view all folders and sub folders, including new and old

I currently have a samba share set up on RHEL, that allows any user to write to the root folder. I'm unable to write to the sub folders/files. I have run:               chcon -R -t samba_share_t /path/to/samba/share      This allowed me to write to the "share" folder, but to none of the sub folders (apparently the -R flag didn't work?). My desired outcome is this:   1. Anyone who accesses the samba share to be able to write to all folders/files.    2. If there are any new files/folders I create in my samba share directory, guests are by default able to right in/read from the new files/folders.  So if the answer involves me having to go in and change the permission to each new folder/file, then that doesn't work for me. Here is my `/etc/samba/smb.conf`               [global]          workgroup = MYGROUP     server string = Samba Server Version %v          log file = /var/log/samba/log.%m     max log size = 50          security = share     passdb backend = tdbsam     guest account = nobody          =====Share Definitions====      [homes]               comment = Home Directories              browseable = no              writable = yes          [folder1]          comment = My first folder          browseable = yes          writable = yes          guest ok = yes          path = /my/path/          wins support = yes


What's the best way to determine the working directory for UNIX process using 'ps'?

I am running a Ruby command line script (`rufus.sh`)which ultimately calls `Thread.new`, which spawns a UNIX process as shown below. I run this script for more than 1 directory as the output of the `ps` command shows below. The last (right most) column below is `COMMAND` (`COMD`) which is essentially the name of the process. The problem is that `COMMAND` doesn't include the working directory (the current directory when the process was launched). What is the best way to figure that out or include it in `COMMAND`? Thanks, Chirag               ps -ef | grep runner     web       7532     1  0 Oct08 ?        00:02:08 /usr/local/bin/ruby ./script/runner ./config/jobs/control.rb critical_alert start     web      21114     1  1 Oct09 ?        02:49:28 /usr/local/bin/ruby ./script/runner ./config/jobs/control.rb task start     web      19028     1  1 10:45 pts/0    00:00:34 /usr/local/bin/ruby ./script/runner ./config/jobs/control.rb task start     web      19029     1  0 10:45 pts/0    00:00:10 /usr/local/bin/ruby ./script/runner ./config/jobs/control.rb critical_alert start


bash not reading $TERMINFO on login (over SSH)

I have a OpenVZ Fedora 20 VPS that when I SSH into, my termcap file stored in `$XDG_DATA_HOME/terminfo/x/xterm-termite`, isn't being read, despite having `TERMINFO=$XDG_DATA_HOME/terminfo` set. If I execute a subshell bash it works fine. Or if I add `exec bash` to the end of my `.profile` it works fine. I saw this question and suspected it could be the same thing. But I'm logging in with the `/usr/bin` version bash already anyway               $ echo $BASH     /usr/bin/bash     $ which bash     /usr/bin/bash      I also tried Ubuntu 13.10 on the VPS and saw the same problem. Patrick's question did get me thinking though, I know the underlying OS of the VPS is REHL. Could that somehow be affecting it? * * * I source a file called `environment` in my `.profile`, which sets the `$TERMINFO` environment variable if the `terminfo` directory exists in `XDG_DATA_HOME`.               $ echo $TERMINFO     /home/evan/.local/share/terminfo     $ echo $XDG_DATA_HOME     /home/evan/.local/share     $ find $TERMINFO     /home/evan/.local/share/terminfo     /home/evan/.local/share/terminfo/x     /home/evan/.local/share/terminfo/x/xterm-termite     $ echo $TERM     xterm-termite      This works fine on my Linode VPS.


Restrict standard users to run a command with a specific argument

I know how to restrict standard users to run a command by removing execute permissions for that command. But it's possible restrict standard users to run a command with a specific option/argument? For example a standard user should be able to run the following command:               ls      but not:               ls -l      I think that this can be possible since there are some commands like `chsh` or `passwd` which a standard user can run them, but he get permission denied when he runs `chsh root` or `passwd -a -S`.


KVM Desktop Client cannot connect to www server

I have a KVM test set up on a workstation. All the instances are using macvtap and a bridge. I can access the web server running on the KVM from a physically separate machine by IP address or DNS but can't from either other instances or from the KVM host? I can ping the server, it pings out. The IP's are assigned via the dhcp server on a 3rd machine, all machines physical and virtual are on same subnet. I've have a `tcpdump` but having trouble making sense of it. workstation is the KVM host www and desktop2 are KVM guests. Details on pastebin


how to return to underlying script from tail -f

I have a `ksh` script, in which I use `tail -f` to view a log file. How can I terminate the `tail` process, and continue executing the underlying script? I am running it on AIX 7.1.   \---------------------------------------------edit-----------------------------------   according to Gilles's answer, I tried this in my script:               trap 'echo "tail process terminated!"' 2     tail -f mylog.log     trap - 2      Now after tail command get executed, then I press CTRL+C, the tail process was killed, and my script continue to run. But the new problem is , when I press CTRL+C again, my script will not exit. Any one can help ?


SSH remote backup script

I am trying to backup a remote server to my machine. I am trying something like               ssh user@ip "dd if=/dev/sda" | dd of=~/backup.img      But that obviously doesn't work. Other variants that don't work.   * `ssh user@ip "sudo dd if=/dev/sda" | dd of=~/backup.img`   * `ssh user@ip -t "sudo dd if=/dev/sda" | dd of=~/backup.img` I have public key authentication set up. Note that even after compression, the remote machine can not hold its own backup. What do I do? (Note in the long run I want to try and put this in an automatic script, but I just want a backup for now.) Note: I should mention that I don't want to just back up the files (like with rsync) but to have a complete image that I can just drop on a new hard-drive should this one go belly up with little hassle.


Requesting user input while reading file line by line

For class I need to write a Bash script that will take the output from `ispell` and when I try and request user input inside the while loop it just saves the next line of the file as the user input. How could I go about requesting user input in the while loop?               #!/bin/bash     #Returns the misspelled words     #ispell -l < file          #define vars     ISPELL_OUTPUT_FILE="output.tmp";     INPUT_FILE=$1               ispell -l < $INPUT_FILE > $ISPELL_OUTPUT_FILE;          #echo a new line for give space between command     #and the output generated     echo "";          while read line;     do        echo "'$line' is misspelled. Press "Enter" to keep";        read -p "this spelling, or type a correction here: " USER_INPUT;             if [ $USER_INPUT != "" ]        then           echo "INPUT: $USER_INPUT";        fi                  echo ""; #echo a new line     done < $ISPELL_OUTPUT_FILE;          rm $ISPELL_OUTPUT_FILE;


Problems with booting with Kubuntu 13.04 / Windows 7 Dual boot

So I've had Kubuntu running on my Lenovo laptop as the only operating system for most of the summer. Earlier this week, I decided to shrink the home partition in order to add a Windows 7 partition. After installing Windows 7, I was then stuck where I could boot into Windows 7, but could not boot into Kubuntu. I ended up using a Kubuntu live USB in order to use the boot-repair tool, which let me regain access to GRUB, which now correctly lists Kubuntu and Windows 7 as the bootable operating systems, but it crashes any time I try to boot into windows. It is able to successfully boot into Kubuntu. I ran the windows startup repair tool several times without success, as well as re-running the boot repair tool. Below is a link to the boot repair summary from the most recent attempt at boot-repair. http://paste.ubuntu.com/6146103/ Any suggestions as to how I could fix this without just wiping the drives and starting over?


QEMU for ARM programs with GDB

I want to emulate an ARM processor for running the assembly programs using QEMU in RHEL. I have installed QEMU but I still have problems in running the assembly program. I got the assembly program, memory map and the makefile from this link. However, if I run the below command,               qemu-system-arm -S -s -M versatilepb -daemonize -m 128M -d in_asm,cpu,exec -kernel hello_world.bin ; gdb-multiarch --batch --command=hello_world.gdb      I get an error as "hello_world.bin - No such file or directory". I am not sure what is to be done to run the above command. So, I got an ARM image from this link. Instead of hello_world.bin, if I specify the kernel name as " **zImage.Integrator** ", I am getting a QEMU console window. However, I am not able to type or do anything in that window. Can someone please let me know how to run an assembly program using QEMU for ARM?


httpd cant write to folder/file because of selinux

Does anyone know which sebool it is to allow httpd write access to /home/user/html? When I disable selinux `echo 0 > /selinux/enforce` I can write, so definitely selinux. Just don't know which one is the right one without opening a big hole and Google isn't being much help.               #[/home]ls -Z     drwxr-x---. user       apache     unconfined_u:object_r:user_home_dir_t:s0 user          #sestatus -b     Policy booleans:     abrt_anon_write                             off     abrt_handle_event                           off     allow_console_login                         on     allow_cvs_read_shadow                       off     allow_daemons_dump_core                     on     allow_daemons_use_tcp_wrapper               off     allow_daemons_use_tty                       on     allow_domain_fd_use                         on     allow_execheap                              off     allow_execmem                               on     allow_execmod                               on     allow_execstack                             on     allow_ftpd_anon_write                       off     allow_ftpd_full_access                      off     allow_ftpd_use_cifs                         off     allow_ftpd_use_nfs                          off     allow_gssd_read_tmp                         on     allow_guest_exec_content                    off     allow_httpd_anon_write                      off     allow_httpd_mod_auth_ntlm_winbind           off     allow_httpd_mod_auth_pam                    off     allow_httpd_sys_script_anon_write           off     allow_java_execstack                        off     allow_kerberos                              on     allow_mount_anyfile                         on     allow_mplayer_execstack                     off     allow_nsplugin_execmem                      on     allow_polyinstantiation                     off     allow_postfix_local_write_mail_spool        on     allow_ptrace                                off     allow_rsync_anon_write                      off     allow_saslauthd_read_shadow                 off     allow_smbd_anon_write                       off     allow_ssh_keysign                           off     allow_staff_exec_content                    on     allow_sysadm_exec_content                   on     allow_unconfined_nsplugin_transition        off     allow_user_exec_content                     on     allow_user_mysql_connect                    off     allow_user_postgresql_connect               off     allow_write_xshm                            off     allow_xguest_exec_content                   off     allow_xserver_execmem                       off     allow_ypbind                                off     allow_zebra_write_config                    on     authlogin_radius                            off     cdrecord_read_content                       off     clamd_use_jit                               off     cobbler_anon_write                          off     cobbler_can_network_connect                 off     cobbler_use_cifs                            off     cobbler_use_nfs                             off     condor_domain_can_network_connect           off     cron_can_relabel                            off     dhcpc_exec_iptables                         off     domain_kernel_load_modules                  off     exim_can_connect_db                         off     exim_manage_user_files                      off     exim_read_user_files                        off     fcron_crond                                 off     fenced_can_network_connect                  off     fenced_can_ssh                              off     ftp_home_dir                                on     ftpd_connect_db                             off     ftpd_use_passive_mode                       off     git_cgit_read_gitosis_content               off     git_session_bind_all_unreserved_ports       off     git_system_enable_homedirs                  off     git_system_use_cifs                         off     git_system_use_nfs                          off     global_ssp                                  off     gpg_agent_env_file                          off     gpg_web_anon_write                          off     httpd_builtin_scripting                     on     httpd_can_check_spam                        off     httpd_can_network_connect                   off     httpd_can_network_connect_cobbler           off     httpd_can_network_connect_db                on     httpd_can_network_memcache                  off     httpd_can_network_relay                     off     httpd_can_sendmail                          on     httpd_dbus_avahi                            on     httpd_enable_cgi                            on     httpd_enable_ftp_server                     off     httpd_enable_homedirs                       on     httpd_execmem                               off     httpd_manage_ipa                            off     httpd_read_user_content                     off     httpd_setrlimit                             off     httpd_ssi_exec                              off     httpd_tmp_exec                              off     httpd_tty_comm                              on     httpd_unified                               on     httpd_use_cifs                              off     httpd_use_gpg                               off     httpd_use_nfs                               off     httpd_use_openstack                         off     icecast_connect_any                         off     init_upstart                                on     irssi_use_full_network                      off     logging_syslogd_can_sendmail                off     mmap_low_allowed                            off     mozilla_read_content                        off     mysql_connect_any                           off     named_write_master_zones                    off     ncftool_read_user_content                   off     nscd_use_shm                                on     nsplugin_can_network                        on     openvpn_enable_homedirs                     on     piranha_lvs_can_network_connect             off     pppd_can_insmod                             off     pppd_for_user                               off     privoxy_connect_any                         on     puppet_manage_all_files                     off     puppetmaster_use_db                         off     qemu_full_network                           on     qemu_use_cifs                               on     qemu_use_comm                               off     qemu_use_nfs                                on     qemu_use_usb                                on     racoon_read_shadow                          off     rgmanager_can_network_connect               off     rsync_client                                off     rsync_export_all_ro                         off     rsync_use_cifs                              off     rsync_use_nfs                               off     samba_create_home_dirs                      off     samba_domain_controller                     off     samba_enable_home_dirs                      off     samba_export_all_ro                         off     samba_export_all_rw                         off     samba_run_unconfined                        off     samba_share_fusefs                          off     samba_share_nfs                             off     sanlock_use_nfs                             off     sanlock_use_samba                           off     secure_mode                                 off     secure_mode_insmod                          off     secure_mode_policyload                      off     sepgsql_enable_users_ddl                    on     sepgsql_unconfined_dbadm                    on     sge_domain_can_network_connect              off     sge_use_nfs                                 off     smartmon_3ware                              off     spamassassin_can_network                    off     spamd_enable_home_dirs                      on     squid_connect_any                           on     squid_use_tproxy                            off     ssh_chroot_rw_homedirs                      off     ssh_sysadm_login                            off     telepathy_tcp_connect_generic_network_ports off     tftp_anon_write                             off     tor_bind_all_unreserved_ports               off     unconfined_login                            on     unconfined_mmap_zero_ignore                 off     unconfined_mozilla_plugin_transition        off     use_fusefs_home_dirs                        off     use_lpd_server                              off     use_nfs_home_dirs                           on     use_samba_home_dirs                         off     user_direct_dri                             on     user_direct_mouse                           off     user_ping                                   on     user_rw_noexattrfile                        on     user_setrlimit                              on     user_tcp_server                             off     user_ttyfile_stat                           off     varnishd_connect_any                        off     vbetool_mmap_zero_ignore                    off     virt_use_comm                               off     virt_use_fusefs                             off     virt_use_nfs                                off     virt_use_samba                              off     virt_use_sanlock                            off     virt_use_sysfs                              on     virt_use_usb                                on     virt_use_xserver                            off     webadm_manage_user_files                    off     webadm_read_user_files                      off     wine_mmap_zero_ignore                       off     xdm_exec_bootloader                         off     xdm_sysadm_login                            off     xen_use_nfs                                 off     xguest_connect_network                      on     xguest_mount_media                          on     xguest_use_bluetooth                        on     xserver_object_manager                      off


What is linux peth* and virbr* network interface?

Usually when execute `ifconfig` I got the "usual" network interfaces: **wlan0** , **eth0** and **lo**. Those, I suppose to be my PC's wireless adaptor, ethernet adaptor and localhost. I'm using a remote server that has the following interfaces:   * eth0   * eth1   * lo   * peth0   * peth1   * virbr0 What those peth* and virbr mean?


Which of HIDS can do this?

I'm currently in choosing of HIDS ( Host-based intrusion detection system ). I'm discovery etckeeper on my ubuntu. My question is: Which of HIDS can trace each file on the filesystem? E.g. keep some database of all files on every partition /dev/sda1 (root), etc... with:   1. file path from root   2. modify timestamp   3. file size   4. crc32   5. md5sum   6. sha256sum If file was deleted, keep record until defined period is end. e.g. 30 days. Pretty web interface like e.g. **gitweb**. And monitor disk in background with super low priority, but forever. e.g.               $ iostat -x -d sda sdb 1     Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util     sda               4.54    69.66   28.62   57.08   408.09  1105.88    35.33     5.33   62.24   27.50   79.66   3.07  26.34     sdb               2.56     3.01  120.08    9.62  8776.63  1711.23   161.73     5.21   40.16   32.23  139.01   3.63  47.14      Show **%util** \- 26.34% and 47.14% for sda and sdb. Until disk util more than defined user limit, e.g. 10%, **Host-IDS** will sleep. To prevent what tiger and tripwire does with **_disk load average_**. My request is about not a system files integrity checking, but all of files. Every todays HIDS looks only to specific part of filesystem, /bin/ /sbin/ /usr/bin/. It doesn't look at temporary directory, doesn't try to trace user's home directory. But it is easy to develop Host-IDS, that would monitor every bit on the disk, silently from user, in deep background. Is there something already?


RHEL server Booting problem: "fsck.ext3: unable to resolve 'LABEL=/u01'

We had an old Linux server in the workplace for last few years, so I decided to turn it on and it's showing this problem during boot up:               No devices found     Setting up Logical Volume Management.                      [  OK  ]     Checking filesystems     /:         clean,  60514 /  5124480 files, 1177926 /  5120710 blocks     /tmp:      clean,     57 /   524288 files,   25421 /   524112 blocks     /var:      clean,   1477 /   524288 files,   57606 /   524112 blocks     /usr:      clean, 184343 /  1312000 files, 1300834 /  1311297 blocks     /archive:  clean,     24 /  8960896 files,  415210 /  8960253 blocks0     /backup:   clean,     17 / 12812288 files,  478934 / 12799788 blocks     fsck.ext3: Unable to resolve `LABEL=/u01`     /boot1:    clean,     33 /   128520 files,   32789 /   514048 blocks                                                                [FAILED]          *** An error occurred during the file system check.     *** Dropping you to a shell; the system will reboot     *** when you leave the shell.     Give root password for maintenance     (or type Control-D to continue): EDAC MC0: UE row 0, channel-a= 0 channel-b= 1     labels "-" (Branch=0 DRAM-Bank=0 RDWR=Read RAS=4812 CAS=0 FATAL Err=0x4      (>Tmid) Thermal event with intelligent throttling disabled))      I tried to use `fsck` to check for errors, but I still cannot boot into the OS. Why is that? After using `fsck -a` it's showing `fsck.ext3:Unable to resolve 'LABLE=/u01'`. Output of `cat /etc/fstab`:               LABEL=/              /              ext3      defaults          1 1     LABEL=/tmp           /tmp           ext3      defaults          1 2     LABEL=/var           /var           ext3      defaults          1 2     LABEL=/usr           /usr           ext3      defaults          1 2     LABEL=/archive       /archive       ext3      defaults          1 2     LABEL=/backup        /backup        ext3      defaults          1 2     LABEL=/u01           /u01           ext3      defaults          1 2     LABEL=/boot1         /boot          ext3      defaults          1 2     tmpfs                /dev/shm       tmpfs     defaults          0 0     devpts               /dev/pts       devpts    gid=5,mode=620    0 0     sysfs                /sys           sysfs     defaults          0 0     proc                 /proc          proc      defaults          0 0     LABEL=SWAP-sda6      swap           swap      defaults          0 0


Check multiple files with string

i.e. for each .csv file, do the following:   * Check if the file contains the string “HEADER” in the first line. If its missing, do the following:     1. Display, “ERROR: Missing HEADER record for ”     2. Rename the file from .csv to .head     3. Proceed to process the next file


Bash tabcomplete file names for environmental variable values

After I upgraded my Ubuntu from 12.04 to 14.04, bash would no longer let me tabcomplete file names when setting the value of an environmental variable, e.g.               FILE=/home/_      `_` is where I would press `TAB`. How can I get tabcompleting of filenames in env variables back? My bash version is 4.3.11.


Email using shell script

Is there a possibility to add multiple e-mails to a single variable so that when the shell script is run, it sends a mail to all the specified emails?


Can the string "abcedf" be matched to string "bafcde" in a single line command?

I am planning to implement an indexing structure in my program. For example, if I have _100 rows_ in the table, I will number these rows from 1 to 100 in another column by appending an `_` to the end of the number.(`1_,2_,3_ etc` so that each number can be identified uniquely). After processing the rows, I am storing the output into a file. For example, I insert the line `1_,2_,4_,5_` into a file. if I get a value as `5_,2_,1_,4_` or `2_,5_,1_,4_`, I should not insert those values. An implementation that comes to my mind is, to sort the numbers and then compare them. However, if the total rows becomes 100,000 it won't be a good solution. Is it possible as a single line command in `perl` script or `awk` or `sed`? **EDIT** : To be more precise and short, for a set of unique and distinct values, how can I find all the combinations without repetitions? **Example** : If I have 3 unique keys `1,2 and 3`, how can I find all combinations without the same combination repeated twice? So for the above example, we can find a combination as,               123      Now, when I search for `213` or `321` it should give me a match as I already have the combination `123` obtained.


How do i run a process in a specific directory?

In an init.d file i wrote the below. Now i need to make the bin run in a specific directory. How do i tell it which directory to use?               mono --debug /path/bin &


bash: /dev/stderr: Permission denied

After upgrading to a new release version, my `bash` scripts start spitting errors:               bash: /dev/stderr: Permission denied      in previous versions Bash would _internally recognize_ those file names (which is why this question is not a duplicate of this one) and _do the right thing (tm)_ , however, this has stopped working now. What can I do to be able to run my scripts again successfully? I have tried adding the user running the script to the group `tty`, but this makes no difference (even after logging out and back in). I can reproduce this on the command line without problem:               $ echo test > /dev/stdout     bash: /dev/stdout: Permission denied     $ echo test > /dev/stderr     bash: /dev/stderr: Permission denied     $ ls -l /dev/stdout /dev/stderr     lrwxrwxrwx 1 root root 15 May 13 02:04 /dev/stderr -> /proc/self/fd/2     lrwxrwxrwx 1 root root 15 May 13 02:04 /dev/stdout -> /proc/self/fd/1     $ ls -lL /dev/stdout /dev/stderr     crw--w---- 1 username tty 136, 1 May 13 05:01 /dev/stderr     crw--w---- 1 username tty 136, 1 May 13 05:01 /dev/stdout     $ echo $BASH_VERSION     4.2.24(1)-release      On an older system (Ubuntu 10.04):               $ echo $BASH_VERSION     4.1.5(1)-release


Is there a way to tell logrotate to ignore open files?

I've searched a bit and can't find anything. I don't want `logrotate`to touch files that are currently open. I was thinking of doing something with `lsof` but I didn't see a way to get any of the scripts to abort an operation. Any ideas?


Install CUDA 6.0 on Debian 7 via package manager

I am following the official installation guide for Ubuntu. I first installed the cuda-repo package (`cuda-repo-ubuntu1304_6.0-37_amd64.deb`), which adds the NVIDIA repository to `apt`. Then it gives when installing that:               $ uname -a     Linux debian 3.14-1-amd64 #1 SMP Debian 3.14.10-1 (2014-07-07) x86_64 GNU/Linux          $ dpkg -i cuda-repo-ubuntu1304_6.0-37_amd64.deb     $ aptitude update     $ aptitude install cuda          The following packages have unmet dependencies:      nvidia-settings : Depends: screen-resolution-extra (>= 0.12) which is a virtual package.      nvidia-331 : Depends: xorg-video-abi-11 which is a virtual package. or                            xorg-video-abi-12 which is a virtual package. or                            xorg-video-abi-13 which is a virtual package. or                            xorg-video-abi-14 which is a virtual package.      I cannot find any package named `screen-resolution-extra` via `aptitude search`. And there is only a `xorg-video-abi-15` in the repository which cannot be installed. How can I solve this if I want to install CUDA via package manager?


Does the kernel have a main() function?

I am learning device drivers and Kernel programming. According to Jonathan Corbet's book, there is no `main()` function in device drivers. So I two questions:   * Why don't we need a `main()` function in device drivers?   * Does the kernel itself have a `main()` function? Can someone explain this to me?


Transfer a TCP connection from one Linux box to another behind NAT?

While experiencing an extremely slow download rate on one of my HTTP connections, I thought it'd be nice if I could just transfer the connection from my PC to an energy-saving home server that shares the same external IP address. The way I imagine it, I'd like to run a command that would take over the connection from a specific IP and a port, letting me pipe all incoming data that flows through it to a file without letting the original owner of the connection to close it. Are there already any tools for that?


Installation from USB fails

I have a pretty old **Ubuntu 8.04** machine. The machine doesn't have a **DVD reader/writer** in it. **Challenge** : Now, the challenge I am facing is to install RHEL6 in this machine. _Obstacle 1_ : I needed to make a boot image from **USB disk** so that I can use it to install the **RHEL6** in this machine. I was able to overcome the _obstacle 1_ successfully by following the below approach. I used the `iso2usb` software and used an existing image of **RHEL6** to have a **bootable USB disk** for installation. It worked perfectly fine in another machine when I tried booting from USB and installing. _Obstacle 2_ : Now, when I use this same **USB** in the server machine, it gives me the first screen where I can select to install the **RHEL6**. After selecting to install the **RHEL6** , it gives me an error as, > Unable to find any devices of the type needed for this installation type. > Would you like to manually select your driver or use a driver disk? I am stumped at this obstacle and tried various options to overcome this. I tried using an **USB** drive with lesser storage (4 GB) since I guessed using larger **USB** storage (earlier I used 16 GB ) sometimes might not work well with the ancient hardware. I also tried the option specified here. When the bootloader screen appears, I added,               linux all-generic-ide irqpoll pci=nommconf      I also tried using various **USB** ports. The **USB** is getting recognized but again gives the same error as above. Now the only option left to try is to hook up a **DVD** drive to this machine and try the installation. However, I just want to know if am missing out any other option. Also, is it possible that the installation is failing because of the hardware in the machine? I am not sure if the driver update for the **USB** drives might fix the problem.


Timeout does not work in expect script

I created the following expect script in order to automate logging into a VPN:                #!/usr/bin/expect           set PASS [lindex $argv 0]           set timeout 10      spawn  vpnc      expect    :            {send $PASS\r}      expect eof      However, when I give wrong password argument, the expected 10 second does not occur. Why does this 10 second timeout not occur?


Editing margins and sharpening of movies

I copied some cartoons from a VCD to my hard drive, to be able to manage the content more easily. However, probably because of the VCD outdated technology, there are two issues with these clips:   1. There are massive black margins at the top and bottom of the clips. It seems that these margins make a widescreen film fit an old style 4:3 screen, but it is not really relevant in my case. How can I get rid of these margins?   2. The quality is rather horrible. The image is a bit blurred and because this is a cartoon it looks more horrible than it would look for a normal film. Can I sharpen the image somehow? I am running Debian Testing.


Add another IP address to a Bonding Interface

I have a Linux network Bonding interface for two Ethernet interfaces (eth0 and eth1)               $ cat /etc/sysconfig/network-scripts/ifcfg-bond0        DEVICE=bond0       BOOTPROTO=static       ONBOOT=yes       IPADDR=XX.XX.XX.XX       NETMASK=255.255.255.0       GATEWAY=XX.XX.XX.XXX        How i can add another IPADDR to this bonding Interface ?


xfce4 loses title bars on all windows

I'm running `Debian Wheezy` using `gdm3` as window manager and `xfce4` as desktop environment. Every so often, when I login, the desktop environment starts OK, but all windows are missing the title bar and are positioned at location (0,0). Usually logging out and back in, or restarting `gdm3` and logging in, fixes it, but today it didn't. I switched to 'GNOME classic' which works fine, indicating it's probably a setting in `xfce4` that's got corrupted. Short of just zapping every file in `.config/` and `.cache/` which refers to `xfce`, is there a simple fix/edit?


Cannot enable network after CentOS 6.3 fresh install

I am trying to perform a fresh CentOS 6.3 installation then run various `yum` commands such as `yum install httpd`. The installation runs fine, however I cannot run any network based commands like `yum` I am aware the default installation has networking disabled. I have amended the `/etc/sysconfig/network-scripts/ifcfg-eth0` file in accordance with this guide, but keep receiving the error > Could not retrieve mirrorlist > http://mirrorlist.centos.org?release=6arch=i1386&repo=os error was > > 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'" > > Error: Cannot find a valid baseurl for repo: base I have since amended the `/etc/resolv.conf` file to include Google's nameserver 8.8.8.8 but this hasn't changed anything. I have amended `/etc/sysconfig/network` changing the `hostname` from `localhost.localdomain` to `local.igoo.net` (a made up but fully qualified domain?). I did have it working yesterday then tried to install WHM/cPanel which went fine. I then decided I didn't need WHM/cPanel so fresh insatlled CentOS and now cannot recreate the steps I took to get networking working. When I run `/etc/init.d/network restart` the error message: > Bringing up interface eth0: > > Determining IP information for eth0... failed; no link present. Check cable? (The cable is not unplugged) I'm not sure what to try next! Can anyone suggest what I've missed out?


SIOCSIFADDR: File exists after upgrading kernel

Since upgrading my (Gentoo) kernel from 2.6.38 to 3.3.8 (via oldconfig), I can't get the network on eth0 up anymore. It reports "SIOCSIFADDR: File exists" with a number of other SIOCSIF* errors that seem related. I have the CONFIG_BNX2=y configuration for the Broadcom NetXtreme II NIC that the machine has (which we have been using for years) enabled in the new kernel. Any hints?


Detailed Per-Process Profiling

I am looking for a way to profile a single process including time spent for CPU, I/O, memory usage over time and optionally system calls. I already know `callgrind` offering some basic profiling features but only with debugging information and lacking most of the other mentioned information. I know `strace -c` providing a summary about all system calls and their required CPU time. I know several IO-related tools like `(io)top`, `iostat`, `vmstat` but all of them are lacking detailed statistics about a single process. There is also `/proc/$PID/io` providing some IO statistics about a single process, but I would have to read it at fixed intervals in order to gather IO information over time. I know `pidstat` providing CPU load, IO statistics and memory utilization but no system calls, only at a high granularity and not over time. One could of course combine several of the described tools to gather those information over time, but lacking a high granularity and thus missing important information. What I am looking for is a single tool providing all (or at least most) of the mentioned information, ideally over time. Does such a tool exist?


Why do I need to escape regex characters in sed to be interpreted as regex characters?

It seems e.g.   `cat sed_data.txt | sed 's/\b[0-9]\{3\}\b/NUMBER/g'`   that I _must_ escape characters to form a regular expression. In this case I had to escape braces in order to be interpreted as a number of times.   Why? I was expecting that everything would be a regex character unless escaped. I.e. the opposite.


Arch Linux in Qemu : Failed to access perfctr msr error

I got the Arch Linux (march build) iso file through bittorrent lately. I tried to run it in VM, but it only gets up to the main screen (The screen where you select what you want to do) shown below: ![enter image description here](http://i.stack.imgur.com/dzhCi.png) But when I select first option, it shows a black screen which goes nowhere. The Hardware Information option seems to work, but it's out of my intellectual capacity so I ignored it. I then tried `qemu` with a simple `qemu-system-x86_64 ./location to file` command. It shows a slightly different image: ![enter image description here](http://i.stack.imgur.com/MSdaX.png) On selecting `x64-86` I get errors: ![enter image description here](http://i.stack.imgur.com/gR5iv.png) I am a Ubuntu user, so I don't get anything of this, but the first error seems to be:               failed to access perctr msr(msr coo1ooo4 is 0)


Listing and specifying packages in debootstrap

Is there a way to list the packages that debootstrap is going to download? Also, is there a way to tell debootstrap to download a user-specified list of packages?


Fedora Core yum update keeps hanging

When I run `yum update` it hangs at the end with no error message. If I run `sudo yum install httpd` it hangs with no error. I read that using `strace` should give more info, but when I try that it says `no such command strace`. I have `fedora` core running on VirtualBox, `Win 7` is the host computer, just trying to install `apache / php / mysql` on it.


Why ssh-agent group ownership is not root

Trying to understand why ssh-agent has sgid bit and found this post ssh-agent has sgid I have another question, why the group ownership of ssh-agent is nobody not root? What is the reason behind it? Will it still work if group ownership is root?


btrfs and the discard mount option on an ssd

I can't seem to find an answer to this so I thought I would ask here: In `/etc/fstab` and when using the mount command in ext4 you would add the option `discard` to activate TRIM on an SSD. Similarly the `discard` option activates TRIM on btrfs volumes as confirmed at btrfs.wiki.kernel.org. Btrfs is supposed to enable copy on write by nature and if this is the case does the discard option effectively disable copy on write? I'm imagining TRIM erasing all of the blocks that would have contained previous versions of files. If copy on write still functions doesn't that reduce the performance of an SSD long term, if eventually none of the blocks are zeroed out?


How can we compare two same directories in linux and list different files

Suppose I have same version of linux kernel but I changed some driver lines. Is there any way to compare these kernels and list the results. The result would be helpful to go back if I changed a lot in original drivers.


Ramdisks in OpenSuse 13.1

I've just installed OpenSuse 13.1, and noticed 5 **tmpfs** ramdisks in the partitioner, mapped to `/dev/shm`, `/run`, `/sys/fs/cgroup`, `/var/lock` and `/var/run`. I don't remember seeing these ramdisks in the past when I've used OpenSuse, though I did recently upgrade to a new SSD. I was wondering if anybody knew what they were for or whether it was good to get rid of them?