title: Redirect stderr of the double-parentheses construct

text: I'd like to be able to redirect the `stderr` of a double-parentheses construct. For example:               a=$(($var/$var2))      would output some error messages if `$var2 = 0`, I do not want the user to see this. I know I could simply check for zero before doing the division, but I'd like to know if there is a way to do this redirection, for curiosity and because it might turn out useful in other situations. I've already tried:               a=$(($var/$var2)) 2> /dev/null      Which does not work and               a=$(($var/$var2 2> /dev/null ))      Which gives a syntax error.


title: Which linux distro's package repositories are secure and which are not?

text: Most distro's I know have some kind of repository functionality where new packages could be downloaded after installation. Which distros do this in a secure way and which doesn't do this in a secure way. I'm especially thinking about attack vectors like man-in-middle and problems like breach of security on both the repository meta server and the repository file mirrors. I have heard that both Slackware and Arch linux are very vulnerable because they lack package signing. Is this true? Are there any other major linux distro's that are vulnerable for simple man-in-middle attacks?


title: How to disable trash can in Thunar/XFCE?

text: I found myself _always_ holding `Shift` when I delete a file with Thunar (the XFCE file manager). When I was using Windows I was always disabling "recycle bin" immediately after installation. I've looked for similar option in Thunar settings but had no luck finding it. Do you happen to know a way?


title: Change screen resolution of Xenserver Console for a CentOS VM

text: I need to increase screen resolution to 1024x800 for my XEN console. I tried to place               vga=791      at the end of kernel line the file `/boot/grub/grub.conf` but it seems that most of the boot arguments are ignored during startup. Probably inside XenSever /boot is not really used in order to launch CentOS. I even tried to add boot option in the boot option tab (VM -> Property -> Boot Option) but doesn't work.


Is it possible to pass kernel parameters in the LILO boot prompt? ![enter image description here](http://i.stack.imgur.com/IOLQ1.jpg)


title: How can I change what's displayed at a login shell?

text: I'm getting more familiar with tweaking the way things look in a shell via the prompt (`.bashrc`), but I'm now trying to change the initial stuff displayed when I first log in. On my EC2 instance, this is what I see when I log in:                        __|  __|_  )  Fedora 8              _|  (     /    32-bit             ___|\___|___|                 Welcome to:               Wowza Media Server 2 for Amazon EC2                Version: 2.0.0.08      On my home Mint computer, here's what I see when I log in:               Welcome to Linux Mint 11 Katya (GNU/Linux 2.6.38-8-generic x86_64)          Welcome to Linux Mint     * Documentation:  http://www.linuxmint.com          Last login: Tue Jun 21 17:44:05 2011      Where is this defined? How can I tweak it for some mad ASCII art **ACTION**?


title: Use testdisk and gpart information to mount ext4 partition

text: I am trying to recover the ext4 partition table of a 2TB disk, where I have 900.000 files. I have cloned the original HD and now I am working on the cloned HD. And I am running Parted Magic Live CD. With testdisk I got what it looks like the original deleted partition:               Disk /dev/sdd - 2000 GB / 1863 GiB - CHS 243201 255 63     Partition Start End Size in sectors     >P Linux 0 1 1 243200 254 61 3907024000 [Duo]      Anybody can help me to read this numbers? As far as I know, I can use this data with the mount command and, if everything goes right, have access to the files in order to start a file transfer, can't I? According to this man page, I can use data extracted from testdisk to help me fix the partition: > "Now using the value given by TestDisk, you can use fsck to repair your > ext2/ext3 filesystem. I.E. if TestDisk has found a superblock at block > number 24577 and a blocksize of 1024 bytes, run:" > > `# fsck.ext3 -b 24577 -B 1024 /dev/hda1` But I don't know how exactly. By the way, here it goes some more useful data from gpart:               # gpart -gv /dev/sdd          dev(/dev/sdd) mss(512)     Primary partition(1)        type: 131(0x83)(Linux ext2 filesystem)        size: 1907726mb #s(3907024000) s(63-3907024062)        chs:  (0/1/1)-(1023/254/63)d (0/0/0)-(0/0/0)r        hex:  00 01 01 00 83 FE FF FF 3F 00 00 00 80 74 E0 E8          Primary partition(2)        type: 000(0x00)(unused)        size: 0mb #s(0) s(0-0)        chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r        hex:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00          Primary partition(3)        type: 000(0x00)(unused)        size: 0mb #s(0) s(0-0)        chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r        hex:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00          Primary partition(4)        type: 000(0x00)(unused)        size: 0mb #s(0) s(0-0)        chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r        hex:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00          Begin scan...     Possible partition(Linux ext2), size(1734848mb), offset(2mb)        type: 131(0x83)(Linux ext2 filesystem)        size: 1734848mb #s(3552968704) s(4096-3552972799)        chs:  (1023/255/0)-(1023/255/0)d (0/0/0)-(0/0/0)r        hex:  00 FF C0 FF 83 FF C0 FF 00 10 00 00 00 00 C6 D3      According to this post I can use this information to help me: > "This time I got something useful. The s(63-117258434) part shows the > starting sector, which is 63. A sector is 512 bytes, so the exact starting > offset of the partition is 32256. So to mount this partition, just issue:" > > `mount -o loop,ro,offset=32256 /storage/image/diskofperson.dd /mnt/recovery` > > "And voilá, access to the filesystem has been obtained." > > `/storage/image/jdiskofperson.dd on /mnt/recovery type vfat > (ro,loop=/dev/loop0,offset=32256)` Any help would be great.


title: swappiness and RAM usage

text: Been going through this topic - http://askubuntu.com/questions/157793/why-is- swap-being-used-even-though-i-have-plenty-of-free-ram. Turned down swappiness to 10 and then to 0 but my installation is never able to reach out into 70%+ of RAM before turning to the swap area. So I am wrestling my lunix system with the help of that script from the link above, but still no joy. I am getting:               kellogs@kellogs-K52Jc ~/workspace/xgate_git/tigase-server $ sudo unswap.sh     Free memory:    1525024 kB (1489 MB)     Used swap:      938196 kB (916 MB)     Freeing swap...     swapoff: /dev/sda4: swapoff failed: Cannot allocate memory      and even:               kellogs-K52Jc tigase-server # unswap.sh     Free memory:    1212956 kB (1184 MB)     Used swap:      478516 kB (467 MB)     Freeing swap...     swapoff: /dev/sda4: swapoff failed: Cannot allocate memory      It must be something keeping the OS from using the 30% remainder of RAM. But what ? EDIT: Original: vm.overcommit_memory = 0 vm.overcommit_ratio = 50 Set to vm.overcommit_memory = 2 vm.overcommit_ratio = 100 And RAM usage would stall at about 50%; After this programs would not launch any longer and complain about memory shortage. Swap remained at 0% usage. Set to: vm.overcommit_memory = 1 vm.overcommit_ratio = 100 Managed to go to about 83% RAM and 22% swap usage. Then I have called that script for emptying swap-into-RAM and hell broke loose. libflash crashing, the rest of programs unresponsive and having gone into broken pipes and stuff like that.


title: efficient rc file syncing or replication

text: Recently I've been experimenting with KVM and virtual machines. I'm lazy and tired of manually copying/syncing my .rc files. Some Googling didn't immediately turn up any tools. Are there any CLI tools available for easily distributing or replicating them? My current solution is some scripted wgets.


title: per process private file system mount points

text: I was checking `unshare` command and according to it's man page,                  unshare - run program with some namespaces unshared from parent      I also see there is a type of namespace listed as,                mount namespace                   mounting and unmounting filesystems will not affect rest of the system.      What exactly is the purpose of this _mount namespace_? I am trying to understand this concept with the help of some example.


title: Mute sound from specific virtual display

text: I'm using Linux, precisely Mint 13 Maya, which is based on Ubuntu Precise. I was wondering if there was any way to mute sound coming from other virtual displays, or to only have sound playing from application launched in the current display, whichever works. Right now, I sometimes launch a VNC server that creates a new display on :1, while still using and displaying the "normal" virtual display on :0. If I launch an application that produces sound on :1, though, I can hear it, even though I can't see the application on my current display. For example, if I launch the command `DISPLAY=:1 vlc /path/to/sound.ogg`, I can hear VLC even while I'm using and displaying only the :0 display. Is there any way to stop that from happening, and mute all sound coming from an application launched on :1? Or, as an alternative, is there any way to instruct pulseaudio to _always_ mute a sound coming from a specific application, every time it is launched, and even if the application isn't producing sound for now, without any user intervention? For example, by launching the application through a script that will tell pulseaudio to mute the application right away? EDIT: I seem to have found a temporary solution, but it can probably be made better. By starting the application with the environment variable `PULSE_SERVER=/dev/null`, all calls to Pulseaudio fail and no audio from the application is played.


title: Running tcpdump, tee and scp

text: I'm trying to run the following:               $ tcpdump -l -X -i eth1 -n tcp port <port> | tee capture.txt | \            scp capture.txt  root@10.3.3.227:/home/checker/        1. `tcpdump -l -X -i eth1 -n tcp port <port>` In step #1 I'm capturing packets, using "-l" to to make standard out line- buffered, so that it will write each packet as it arrives.   2. `tee capture.txt` In step #2 `man tee`: "The tee utility copies standard input to standard output, making a copy in zero or more files." The output is unbuffered.   3. `scp capture.txt root@<remote-IP>:/home/` In step #3 I'm send the capture.txt file to a remote host. ### The problem If I simply perform steps #1 and #2, ALL packets are captured on the specified port. However, if I also use step #3 the `capture.tx`t does NOT contain all the packets (only a few)... This is killing me because I had this running OK just a few minutes ago! What is wrong here?


title: Auto restart ssh session after sleep

text: I have an active ssh session to a remote server that it would be nice to be able to restart upon waking from sleep/hibernate (ubuntu), and seamlessly restore tunnels. The Gnome Terminal window is still open upon restart, but it is frozen, and the programs that rely on these tunnels also hang. I have to close and reopen the ssh connection and then shut down and restart the dependent programs. Anyone got any nice methods of working around this?


title: Does configuring iscsi target and iscsi initiator in two linux nodes and using ethernet cable for communication make it SAN?

text: I'm using freeNAS to share an extent via iSCSI to my another Linux box using Ethernet cable. It work as a block storage. So SAN work as a block storage. Now, in my scenario is it working as a NAS or SAN?


title: /dev/console dynamic redirection

text: Is it possible to dynamically redirect all data sent to `/dev/console` into something else (for example - to `/dev/null`, `/dev/tty9` or even `/dev/null`)? Of course, it can be done _statically_ via `console=XXX` kernel boot parameter (or standard pipe redirection in case of a single program). The problem is that I need to do it dynamically (and for all programs that do output), based on data that comes from an external device. Any suggestions?


title: refresh changed content of file opened in vi(m)

text: I have a config-file that I keep open in vim, but that sometimes gets changed on disk, without these changes being reflected on the terminal. Can I refresh the content on the screen without closing and re-opening the file? If so, how?


title: Cooking EDID and finding values for .S file

text: It became really annoying and the resolution is bad so I decided to make my EDID and pass that to the Kernel. (I am creating EDID for S20A300B and samsung says in its page the best RES for this product is 1600*900)   I created a 1600*900.S file and tried to fill it with the info I got from `cvt 1600*900` and also `DPI calculator=91.79`.   but there are some values I can't find the answer to. > CLOCK XY_RATIO XY_RATIO_16_9 ESTABLISHED_TIMINGS_BITS 0x00 HSYNC_POL > VSYNC_POL CRC The `1600x900.S` file is:                       /*            1920x1080.S: EDID data set for standard 1920x1080 60 Hz monitor                 Copyright (C) 2012 Carsten Emde <C.Emde@osadl.org>              */              /* EDID */         define VERSION 1         define REVISION 3              /* Display */         /* EDID */     #define VERSION 1     #define REVISION 3          /* Display */     #define CLOCK 60000 /* kHz */     #define XPIX 1600     #define YPIX 900     #define XY_RATIO XY_RATIO_16_9     #define XBLANK 160     #define YBLANK 26     #define XOFFSET 48     #define XPULSE 32     #define YOFFSET (63+3)     #define YPULSE (63+5)     #define DPI 91.79     #define VFREQ 60 /* Hz */     #define TIMING_NAME "Linux FHD"     #define ESTABLISHED_TIMINGS_BITS 0x00 /* none */     #define HSYNC_POL 1     #define VSYNC_POL 1     #define CRC 0x05          #include "edid.S"


title: Cross-distribution/OS packaging

text: Fedora, FreeBSD, OS X (Homebrew, MacPorts), Ubuntu, Debian, and others all use different packaging systems for binary and source distribution. When I develop a new application I want to make it available to as many users as possible right out of the gate. But learning all the different packaging tools and conventions is a lot of work. I can manage, but there has to be an easier way. Is there a super-tool that I should be aware of that can be used to ease the overhead of maintaining and learning all these packaging systems?


title: Active Directory to OpenLDAP synchronisation

text: We have a domain controller with `Active Directory` with a number of basic users with custom attributes. We are looking for a way to synchronise the active directory users to `OpenLDAP` (currently running on Debian 6) and wondered if anyone has experience in doing this who could provide some pointers. There is this project, but it's guides are basic and is missing AD to `OpenLDAP` (it does have the vice-versa) The hope is that every time a change is made in `Active Directory` it's pushed to the `OpenLDAP server` so that the users can be queried there. We don't want to just forward the requests as sometimes the `Active Directory` server will not be available. I'd be greatful for any advice or suggestions in this area.


title: Datanode in slave isn't working : Hadoop in CentOS

text: We've created a Hadoop cluster of two machines following these instructions: http://tecadmin.net/set-up-hadoop-multi-node-cluster-on-centos-6/ with the machines set as follows:               hadoop1 = master & slave     hadoop2 = slave      When we start the services (`bin/start-all.sh`), all services (including `datanode` for _hadoop2_ ) initialize. Everything is well. But when we check the DFS size (`bin/hadoop dfsadmin -report`), only one system ( _hadoop1_ ) is detected. We've checked `jps` on both hosts. On _hadoop1_ , all services are displayed, whereas on _hadoop2_ only `jps` is running. This means the data node on the slave is not working even though the master shows that `datanode` is starting on _hadoop2_ as well. When we check the logs, there is no `datanode` log for the _hadoop2_ slave. I've tried all possibles explanations including the namespaceID which we get from namename current VERSION and assign it to data node current VERSION. What could be the solution for this? I use centOS 7, and apache hadoop 1.2.1


title: How is PATH set for users in puppet?

text: I'm having an interesting problem which I was able to work around by manually specifying `PATH`. The problem is that although my `root` user's `PATH` is:               /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin      When I run my Puppet Master in NGINX/Passenger as user `puppet`, `PATH` somehow gets set to:               /usr/sbin:/sbin      Where is the `PATH` environment variable set for users and how can I make sure that my `puppet` user has the right `PATH`? The user doesn't have a shell:               puppet:x:103:106::/var/lib/puppet:/bin/false      In my `config.ru` Rack file which is responsible for starting the Puppet Master, I've inserted the following statement to see what `PATH` the `puppet` user is running with:               puts "PATH: " + ENV.fetch('PATH', 'null')      The output is `PATH: null`, therefore the `PATH` environment variable is simply not set when Passenger is run. I'm working in a Docker container running Ubuntu 14.04 amd64.


title: overriding HOME location

text: I'd like to override the user's HOME location locally in a script in order to force an application to store/load its settings portably.               export HOME=$TMPDIR/Data     export XDG_CONFIG_HOME=$TMPDIR/Data      These works in most cases, but there are a few apps that still find the "real" home path. Why is my method of overriding the user's HOME location not working?


title: A problem with find and grep

text: I have defined the following alias in `~/.bashrc`:                alias fg='find . -name $1 | xargs grep --color $2'      in order to write               fg "*.txt" " my_text "      and find all file that have extension .txt and contain " my_text " but it does not work. Why?


title: Automatic login still doesn't work after editing custom.conf

text: As the title suggests, I've edited /etc/gdm/custom.conf to show the following:               [daemon]     AutomaticLoginEnable=true     AutomaticLogin=username      Where username is obviously the username I'd like to automatically log into. This has been a head scratcher for me. I've done a thorough amount of searching and all the information I see makes it as simple as doing the above, but it's not. I don't know if it matters or not, but I do have multiple users. In mind this should not matter, however, since we're specifying a username here in the settings. I'm using RHEL6.4. Any ideas?


title: Disable italics in emacs org-mode, Ubuntu

text: I am having some trouble disabling the italics in emacs. I already tried:                '(italic ((t nil)))      in `.emacs`. But there is still a problem. Although it will not italicize the text between `/` and `/`, these `/`s will disappear. So, when I want to write:               /home/Quora/      it actually shows:               home/Quora      How can I avoid emacs from trying to change a face, and using the mark-up, when I type `/something/`? I am using org mode in emacs 24 in Ubuntu.


title: How should one set up full-disk encryption on OpenBSD?

text: Is there a preferred method to set up full-disk encryption under OpenBSD, similar to `dm-crypt` under Linux? I'm looking for full-disk encryption, as if someone were to steal my notebook they could potentially access the data stored on it. Another reason is that I'm not always next to my notebook, so someone could potentially compromise the integrity of my netbook. These are the two major issues which make me believe that full-disk encryption is important for me.


title: How can I monitor disk I/O in a particular directory?

text: I've got a few processes with a known name that all write to files in a single directory. I'd like to log the number of **disk block reads and writes over a period** ( _not_ just file access) to test whether a parameter change reduces the amount of I/O significantly. I'm currently using `iostat -d -p`, but that is limited to the whole partition.


title: How to enable touchpad scrolling and tapping in Debian Wheezy KDE?

text: I'm trying to turn on scrolling and tapping with my laptop's touch-pad (the 2 left and right buttons are ok). I'm on Debian 7.3 (Wheezy) KDE-desktop and I have a Synaptic touch-pad. My laptop is an old HP model of 2007 therefore it doesn't support multi-touching. As _root_ I created a `/etc/X11/xorg.conf.d/synaptics.conf` file which I have copied below. Then in Konsole I gave `synclient -l` and got back the following code:               Parameter settings:     LeftEdge                = 1752     RightEdge               = 5192     TopEdge                 = 1620     BottomEdge              = 4236     FingerLow               = 25     FingerHigh              = 30     FingerPress             = 256     MaxTapTime              = 180     MaxTapMove              = 221     MaxDoubleTapTime        = 180     SingleTapTimeout        = 180     ClickTime               = 100     FastTaps                = 0     EmulateMidButtonTime    = 75     EmulateTwoFingerMinZ    = 282     EmulateTwoFingerMinW    = 7     VertScrollDelta         = 100     HorizScrollDelta        = 100     VertEdgeScroll          = 0     HorizEdgeScroll         = 0     CornerCoasting          = 0     VertTwoFingerScroll     = 1     HorizTwoFingerScroll    = 0     MinSpeed                = 1     MaxSpeed                = 1.75     AccelFactor             = 0.0398     TrackstickSpeed         = 40     EdgeMotionMinZ          = 30     EdgeMotionMaxZ          = 160     EdgeMotionMinSpeed      = 1     EdgeMotionMaxSpeed      = 401     EdgeMotionUseAlways     = 0     TouchpadOff             = 0     LockedDrags             = 1     LockedDragTimeout       = 5000     RTCornerButton          = 0     RBCornerButton          = 0     LTCornerButton          = 0     LBCornerButton          = 0     TapButton1              = 0     TapButton2              = 0     TapButton3              = 0     ClickFinger1            = 1     ClickFinger2            = 1     ClickFinger3            = 1     CircularScrolling       = 0     CircScrollDelta         = 0.100007     CircScrollTrigger       = 0     CircularPad             = 0     PalmDetect              = 0     PalmMinWidth            = 10     PalmMinZ                = 200     CoastingSpeed           = 20     CoastingFriction        = 50     PressureMotionMinZ      = 30     PressureMotionMaxZ      = 160     PressureMotionMinFactor = 1     PressureMotionMaxFactor = 1     GrabEventDevice         = 1     TapAndDragGesture       = 1     AreaLeftEdge            = 0     AreaRightEdge           = 0     AreaTopEdge             = 0     AreaBottomEdge          = 0     HorizHysteresis         = 25     VertHysteresis          = 25     ClickPad                = 0      This is the content of `/etc/X11/xorg.conf.d/synaptics.conf`               Section "InputClass"     Identifier "Touchpad"     MatchIsTouchpad "yes"     Driver "synaptics"     Option "MinSpeed" "0.4"     Option "MaxSpeed" "0.9"     Option "AccelFactor" "0"     Option "TapButton1" "1"     Option "TapButton2" "3"     Option "VertTwoFingerScroll" "0"     Option "HorizTwoFingerScroll" "0"     Option "VertEdgeScroll" "1"     Option "CoastingSpeed" "8"     Option "CornerCoasting" "1"     Option "TouchpadOff " "0"     EndSection      I've installed `apt-get install server-xorg-input-synaptics` and rebooted the system after the creation of the `synaptics.conf` file but nothing has changed. What should I do to get it working?


title: Allow file manipulation but block folder/subfolder manipulation?

text: I have an Ubuntu file server (samba) sharing a folder structure with a Windows 7 computer classroom. All users use the same user/pass to access the folders and have read/write permissions. I would like to prevent users from moving or deleting folders, but keep the file permissions. In other words, I would like to protect my folder structure, but allow users to add/delete/rename/move _files_ within that structure. How can I do that?


title: Command not found in zsh

text: In bash, whenever I try to run a command which is not installed, I get a message which tells that the package is not installed and how to install it. This functionality is provided by installing the Debian/Ubuntu package `command-not-found`. But in zsh, it only gives the message `command not found`. So how do I install this feature in zsh? ![error in zsh](http://i.stack.imgur.com/h7esd.png)


title: Grub menu not appearing

text: I have a windows 8.1 installed in my lenovo z570.I installed linux mint 17 from an USB created using YUMI software. After installation the grub menu doesn't appear and windows gets booted up automatically.I turned off fast startup in windows also.I read that i should turn of secure boot as well.But in msinfo32 it shows secure boot : unsupported.I also tried grub-repair from a live cd.Still i am not able to get the grub boot menu.What would be the problem??


title: Use setxkbmap to swap the Left Shift and Left Control

text: Is it possible to swap the Left `Shift` and the Left `CTRL` keys using `setxkbmap` instead of `xmodmap`? _EDIT_ I have switched to Fcitx, which works way much better with my keyboard layout and customized keymap than IBus in every respect. I highly recommend it.


title: Startup script with LSB headers not working correctly (dependency problem)?

text: I am creating a startup script for my Ubuntu 14.04.1 LTS server. The script need to be run after the Rabbit MQ server. The Rabbit MQ startup script says it provides "rabbitmq-server". So I put this string in the "Required-Start" list of my startup script headers (see below). However, after installing my script with update-rc, both the Rabbit MQ script and my script are at the "S20" level, i.e. I don't think the dependency has worked. My script is also not starting correctly, but does start if I run it manually after bootup. Any ideas as to what could be wrong?                        ### BEGIN INIT INFO         # Provides: amqp_receive         # Required-Start: $local_fs $network rabbitmq-server         # Required-Stop:         # Default-Start: 2 3 4 5         # Default-Stop: 0 1 6         # Short-Description: Script to provide start/stop/status of the amqp_receive program         ### END INIT INFO                                  lrwxrwxrwx 1 root root  22 Aug 17 00:29 S20amqp-receive -> ../init.d/amqp-receive         lrwxrwxrwx 1 root root  25 Aug 13 18:14 S20rabbitmq-server -> ../init.d/rabbitmq-server         lrwxrwxrwx 1 root root  15 Apr 16 18:26 S20rsync -> ../init.d/rsync         lrwxrwxrwx 1 root root  24 Apr 16 18:26 S20screen-cleanup -> ../init.d/screen-cleanup         lrwxrwxrwx 1 root root  23 Apr 16 18:26 S38open-vm-tools -> ../init.d/open-vm-tools         lrwxrwxrwx 1 root root  26 Apr 16 18:26 S45landscape-client -> ../init.d/landscape-client         lrwxrwxrwx 1 root root  19 Apr 16 18:26 S70dns-clean -> ../init.d/dns-clean         lrwxrwxrwx 1 root root  18 Apr 16 18:26 S70pppd-dns -> ../init.d/pppd-dns         lrwxrwxrwx 1 root root  21 Apr 16 18:26 S99grub-common -> ../init.d/grub-common         lrwxrwxrwx 1 root root  18 Apr 16 18:25 S99ondemand -> ../init.d/ondemand         lrwxrwxrwx 1 root root  18 Apr 16 18:25 S99rc.local -> ../init.d/rc.local


title: setuid programs don't seem to run setuid in TinyCore Linux

text: I want to demonstrate the vulnerability of `setuid` programs using the TinyCore Linux live cd. That is, I craft a special program, with special permissions, so that it runs as the owner of the file instead of the executing user. These are my steps:   1. Create a program (see below) with a security hole, compile it in my home system (Ubuntu)   2. Make the program setuid and setup the owner of the file, still in Ubuntu   3. Unpack the Tiny Core live cd, copy the vulnerable program inside and `chroot` into it The problem is the program does not seem to run as `setuid` neither in the `chroot` environment, nor in the completed remastered image. In Ubuntu it works, but I need it working in Tiny Core. The program does run in Tiny Core, but even though it has `setuid` permissions, it is not running as the owner of the file. The program source code:               #include <stdio.h>     #include <stdlib.h>          int main(int argc, char **argv)     {       printf("Current time: ");       fflush(stdout);       system("date");       return 0;     }      Build it:               gcc -o prog prog.c      Make it setuid:               sudo chown 1200.1200 prog     sudo chmod 4755 prog      Craft a `date` script to demonstrate the vulnerability:               #!/bin/sh          echo hello > /tmp/test.txt     ls -l /tmp/test.txt      Make the crafted `date` script executable and expose the vulnerability:               chmod +x date     PATH=.:$PATH ./prog      In Ubuntu, as expected this creates `/tmp/test.txt` with owner 1200. But when I `chroot` to the live cd environment, it does not work there, the executable runs but not as the file owner. If I finish the remastering and create the live cd and boot into it, it does not work there either, even though the file has the right owner and group and permission `4755`. What am I missing? If you want to create the `chroot` environment, download the 8MB live cd from http://distro.ibiblio.org/tinycorelinux/downloads.html and follow these steps:               sudo mount Core-current.iso /mnt     mkdir /tmp/extract     cd /tmp/extract     zcat /mnt/boot/core.gz | sudo cpio -i -H newc -d      Copy the vulnerable programs to the `chroot` environment with:               sudo cp -a /path/to/prog /tmp/extract/tmp     sudo cp /path/to/date /tmp/extract/tmp      `chroot` in there and test the vulnerability:               sudo chroot /tmp/extract /bin/sh     su - tc     cd /tmp     PATH=.:$PATH ./prog      My end goal of course is to make it work on the live cd itself. It doesn't matter if it doesn't work in `chroot`, it just seems a suitable first test, without having to repack the image and booting into it.


title: keyboard doesn't respond after suspend in Ubuntu 12

text: When I put my Ubuntu on suspend mode, the keyboard stops working, and I cannot get out of suspend. I need to shutdown my laptop manually and reboot. I have VAIO laptop. Ubuntu version 12. I edited `/etc/default/grub`:               GRUB_CMDLINE_LINUX_DEFAULT="quite splash intel_idle.max_cstate=0 nohpet"     GRUB_CMDLINE_LINUX="resume=/dev/sdq


title: Allowing access to NetBIOS port in Fedora 18?

text: I've recently installed Fedora 18 on one of the machines in my office, and I've installed Samba so I can browse the file system on my Windows machine. However, I'm having some trouble opening port 137 for the NetBIOS naming system. I'm using the command below to open the port but when I use `iptables -L` or `nmap -sT -O localhost` in an attempt to list the open ports, it doesn't appear anywhere.               [root@localhost ~]# iptables -A INPUT -p tcp --dport 137 -j ACCEPT     [root@localhost ~]# service iptables save      Note: I've checked that both the `smb` and `nmb` daemons are up and running, they are (although log.smbd lists a warning about the _standard input is not a socket_ and denied permissions for the _/root/.pkcs11/pksc11.conf_ file).


title: chromium cannot load nss libraries?

text: I'm using openSUSE 12.2 64-bit with a special kernel but with chromium it gives me               [0220/130849:ERROR:nss_util.cc(724)] Failed to load NSS libraries.     [1:1:0220/130850:ERROR:nss_util.cc(724)] Failed to load NSS libraries.     [0220/130850:ERROR:nss_util.cc(724)] Failed to load NSS libraries.     [1:1:0220/130850:ERROR:nss_util.cc(724)] Failed to load NSS libraries.      I have a symlink of nss folder in `/usr/lib/nss` and `/usr/lib/x86_64-linux- gnu/nss`. When I start strace chromium it doesn't give me the path to the nss librariers. The strange thing is chromium is stopped working after an update? Maybe this is cross repo error between beta (factory) and default repo librariers? Do I really need to fix it myself? Update: I was wrong and I don't have any factory repo enabled:               1 | openSUSE-12.2-12.2-1.14 | openSUSE-12.2-12.2-1.14      | Nein      | Nein              2 | repo-debug              | openSUSE-12.2-Debug          | Nein      | Ja                3 | repo-debug-update       | openSUSE-12.2-Update-Debug   | Nein      | Ja                4 | repo-non-oss            | openSUSE-12.2-Non-Oss        | Ja        | Ja                5 | repo-oss                | openSUSE-12.2-Oss            | Ja        | Ja                6 | repo-source             | openSUSE-12.2-Source         | Nein      | Ja                7 | repo-update             | openSUSE-12.2-Update         | Ja        | Ja                8 | repo-update-non-oss     | openSUSE-12.2-Update-Non-Oss | Ja        | Ja


title: How can I set a directory maximum size?

text: Is there an easy way to cap the size of a directory? I don't think there is but just wanted to make sure. I would like to set max directory sizes for some user home dirs as well as some other dirs, mostly under `/var` in an attempt to better manage the disk resources.


title: At login, take picture of user at Login window(loginGUI promt window)

text: I have code to take a picture in a script. I don't understand how to run this script at the time of login. I would like to modify the login process so that:   * The user gets 3 login attempts.   * After 3 failures, my script runs to take a picture with the webcam. Where can I configure what happens when a user tries to log in?


title: "lftp" login still possible for "/etc/pam.d/vsftpd" blocked users

text: I have a ftp server running on the machine 192.168.122.50 Below are the last three directives from /etc/vsftpd/vsftpd.conf file               pam_service_name=vsftpd     #userlist_enable=YES     #userlist_deny=YES      Below is the content of /etc/pam.d/vsftpd file               #%PAM-1.0     session    optional     pam_keyinit.so    force revoke     auth       required     pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed     auth       required     pam_shells.so     auth       include      password-auth     account    include      password-auth     session    required     pam_loginuid.so     session    include      password-auth      Below is the content of the /etc/vsftpd/ftpusers file               #This is the list of blocked users as per the following line /etc/pam.d/vsftpd     #auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed          root     bin     daemon     adm     lp     sync     shutdown     halt     mail     news     uucp     operator     games     nobody      So two users, for example, `root` should be blocked from accessing the ftp server at this machine and `ssam` should be allowed. Now from client machine 192.168.0.2, I tried this.               am@centos ~]$ ftp 192.168.122.50     Connected to 192.168.122.50 (192.168.122.50).     220 (vsFTPd 2.2.2)     Name (192.168.122.50:ssam): ssam         331 Please specify the password.     Password:     230 Login successful.     Remote system type is UNIX.     Using binary mode to transfer files.     ftp> exit     221 Goodbye.     [ssam@centos ~]$ ftp 192.168.122.50     Connected to 192.168.122.50 (192.168.122.50).     220 (vsFTPd 2.2.2)     Name (192.168.122.50:ssam): root     331 Please specify the password.     Password:     530 Login incorrect.     Login failed.     ftp> bye     221 Goodbye.      The output was inline with the **pam** settings as the user `ssam` was allowed and user `root` was blocked. Now I have tried the lftp command at the client to connect to the server for the user root.               [ssam@centos ~]$ lftp root@192.168.122.50     Password:      lftp root@192.168.122.50:~>      The login was indeed possible **blocked** user `root` as I got the lftp prompt. Now I tried to run a command.               lftp root@192.168.122.50:~>     ls: Login failed: 530 Login incorrect.      Now it seems like the server has come to good senses and it tells me I was not able to do anything else. But the pluggable authentication module should have blocked the user `root` from entering the server at the first instance. Could anybody explain this for me?


title: Changing keypad settings

text: When I setup my Ubuntu machine, I had the option to configure the keypad style in the gnome control panel. I used to check the setting that enables windows-like behavior (Shift+Keypad does not toggle NumLock. It helps me use Shift+Home\End) from the following window:![enter image description here](http://i.stack.imgur.com/z7xtb.png) Yesterday I installed openSuse 13.3 (Gnome 3), and I couldn't find a similar setting.


title: Untar Without Top-Level Directory

text: I have a tar (websites.tgz) that contain a bunch of Drupal websites that are tarred up starting with 'htdocs' I need to untar them into               /local/htdocs/web1     /local/htdocs/web2      and so on. But I cannot place the websites.tgz file in /local and extract downward due to permissions. It is currently in my home directory. How can I untar the contents under /local/htdocs, without including the top-level htdocs directory? I am trying to avoid having:               /local/htdocs/htdocs/web1     /local/htdocs/htdocs/web2.      Thanks for any help.


title: FC16: can't log in via LightDM or GDM (but 'startx' works fine)

text: I'm running Fedora Core 16 (with all patches applied as of 11 Feb 2013, AFAICT) on a dual-monitor Lenovo workstation, and can't seem to access my desktop via a graphical login manager. My system boots normally, I get the GDM greeter screen, I select my username and enter my password, and log in. I then get a black screen like Xorg is trying to switch modes before being sent back to the GDM login screen. The same problem happens when I removed GDM and attempted to use LightDM instead. However, if I boot into runlevel 3, log in via the console, and run 'startx', my GNOME desktop appears normally. Running `tail /var/log/Xorg.0.old` tells me that my previous Xorg session (the one launched from GDM) terminated normally:               [  1125.791] (II) NVIDIA(GPU-0): --- End of ModePool for Lenovo Group Limited LEN LT2452pwC (DFP-1): ---     [  1125.791] (II) NVIDIA(GPU-0):     [  1175.892] (II) evdev: Dell Dell USB Keyboard: Close     [  1175.892] (II) UnloadModule: "evdev"     [  1175.892] (II) Unloading evdev     [  1175.892] (II) evdev: Microsoft Microsoft 3-Button Mouse with IntelliEye(TM): Close     [  1175.892] (II) UnloadModule: "evdev"     [  1175.892] (II) Unloading evdev     [  1175.892] (II) evdev: Power Button: Close     [  1175.892] (II) UnloadModule: "evdev"     [  1175.892] (II) Unloading evdev     [  1175.892] (II) evdev: Power Button: Close     [  1175.892] (II) UnloadModule: "evdev"     [  1175.892] (II) Unloading evdev     [  1175.921] Server terminated successfully (0). Closing log file.      What's going on? What logs can I examine for more information?


title: snmp issue:Two similar sever returning different output

text: I am having issue with SNMP OID's . I have two similar servers (hardware and software ) Which is DEll server with RHEL 5.3 X86_64.Issue is when I run the `SNMPWALK` for one server it shows proper data while the other server returns > No Such Instance currently exists at this OID Both have net-snmp version as: 5.3.2.2 OID seems to be custom and only for DELL machines "`1.3.6.1.4.1.674`" (`SNMPv2-SMI::enterprises.674`) but both machines are dell based and follows same architecture and components. Can someone trace on cause of this issue ?


title: Can I trigger an alternate keyboard layout based on switching windows?

text: I'd like to use different keyboard layouts (that I set with setxkbmap) depending on the application window that has focus. So for example, I'd like to switch when I change the window from terminal emulator to web browser. I'm currently working in GNOME 3. If this is only possible in another window manager, than I'm open for suggestions, but a GNOME 3 solution is preferred.


title: Consequences of setting up POSIX locales

text: Small background of the situation: We are using several UBUNTU servers having English as working language; however having en_US locale set in machines we encounter problems with apt-cacher-ng downloading translation files. One solution is to change locale to POSIX. Considering all options we want to change locale in all the systems. My question then is: What are the consequences for the system of changing locales from en_US value to POSIX? Are there any implications on LC_* apart from change of the value?


title: How to run two virtual X11 screens on a single monitor?

text: I would like to be able to emulate a dual monitor set up using a single physical display. Ideally, X11 would be able to treat each left/right half of the monitor as a separate display. Is this possible with X11? _EDIT:_ I've cobbled together some crude images to attempt to better clarify what my intent is. Imagine the following dual monitor set up: ![enter image description here](http://i.stack.imgur.com/JyPhH.jpg) Since I only have a single, large, widescreen monitor, I would like X11 to believe that the single physical display is actually two displays; each taking up a horizontal half of the physical display space, as follows: ![enter image description here](http://i.stack.imgur.com/wQeZq.jpg)


title: UUID Of A drive that won't show up in /dev/disk/by-uuid or blkid

text: I have a USB drive that is not receiving a UUID. When I look at the contents of the /dev/disk/by-uuid it doesn't exist there. The dev point that the partition lives in is on /dev/sdb. I am able to see sdb under /dev/disk/by- path. Also, when using blkid, I get zero output. [I'm assuming that I got an error code that returned back. Is there a way to get a UUID for this partition? Result of `fdisk -l /dev/sdb:`               Disk /dev/sdb: 320.1 GB, 320072932352 bytes     255 heads, 63 sectors/track, 38913 cylinders, total 625142446 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00082145             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1            2048   625141759   312569856   83  Linux      The partition table and partition was created with gparted, so it was partitioned and ran the command mkfs.ext3. Output of fsck -n /dev/sdb1               fsck from util-linux 2.20.1     e2fsck 1.42 (29-Nov-2011)     fsck.ext2: Superblock invalid, trying backup blocks...     zwei was not cleanly unmounted, check forced.     Pass 1: Checking inodes, blocks, and sizes     Pass 2: Checking directory structure     Pass 3: Checking directory connectivity     Pass 4: Checking reference counts     Pass 5: Checking group summary information     zwei: 11/19537920 files (0.0% non-contiguous), 1275097/78142464 blocks      It was formated as an ext3 drive. Why is that showing up as ext2?


title: Create symbolic links to files using wildcards

text: I want to create symlinks to multiple files:               ln -s dev-*.php 's/dev-(.*\.php)/$1/'          Results hoped for:           site.php links to dev-site.php           file.php links to dev-file.php      What's the most concise way to achieve this?


title: How is the content of configuration files parsed on different Linux distributions?

text: Different Linux distributions store the same configuration parameters in different files. For example IPv4 address in _Debian Wheezy_ is stored in `/etc/network/interfaces` file while in _Fedora 20_ it is stored in `/etc/sysconfig/network-scripts/ifcfg-eth0` file. In addition, syntax of those configuration files is different. How do distributions parse those files? In addition, is the content of configuration files parsed in a way that userspace utilities like `ip` and `ifconfig` are called or are there some lower-level system calls which actually configure the kernel?


title: Would this LUKS LVM rsync restore method work?

text: I have an Ubuntu installation using LVM and LUKS encryption. LVM and encryption were chosen during the install process). While logged into it, I backup the full live system using rsync to another drive. If I ever have to restore the full system to a new hard drive, I would boot with the Ubuntu live CD and reverse the rsync command to restore everything to the new drive, and I'll fix grub and fstab. My newly restored system will work, however, this will not restore LVM or LUKS so the restored system is without these. I was thinking, in order to keep LUKS and LVM, can I first install a fresh install of Ubuntu onto the new drive with LUKS and LVM during it's setup process, and then restore using rsync over the fresh install after mounting it in the live CD environment?


title: Altermime and SELINUX

text: I've setup an application called altermime (http://www.pldaniels.com/altermime/) for postfix (SMTP server) which alters emails midstream. I'm injecting a "X-ListUnsubscribe" header into every email message sent from our server for spam reasons. Altermime needs to be able to write to /var/spool/filter (normally I think postfix writes to /var/spool/postfix). Anyway this all works fine with SELinux disabled but with it enabled it breaks. As tempting as it might be to simply turn off SELinux and be done with it, I'd rather not compromise the security of my box in that manner. So I'm trying to modify SELinux to so that writing to /var/spool/filter is allowed. I've tried:                cat /var/log/audit/audit.log | audit2why       Which shows me the exceptions (I'll include them below). And I've done this multiple times:                audit2allow -M altermime < /var/log/audit/audit.log      semodule -i altermime.pp      However that doesn't seem to work. I'm assuming it may be because the audit2allow is naming individual files (/var/spool/filter/xxxx) being blocked vs the entire directory (/var/spool/filter/*). I can't figure out how to create a policy or change SELinux to allow access. Can some SELinux Guru help me? :) Here is an excerpt of my audit2why:               type=AVC msg=audit(1409231063.712:263024): avc:  denied  { add_name } for  pid=21280 comm="disclaimer" name="in.21279" scontext=unconfined_u:system_r:postfix_pipe_t:s0 tcontext=unconfined_u:object_r:var_spool_t:s0 tclass=dir         Was caused by:                 Missing type enforcement (TE) allow rule.                 You can use audit2allow to generate a loadable module to allow this access.          type=AVC msg=audit(1409231065.905:263025): avc:  denied  { add_name } for  pid=21285 comm="disclaimer" name="in.21284" scontext=unconfined_u:system_r:postfix_pipe_t:s0 tcontext=unconfined_u:object_r:var_spool_t:s0 tclass=dir         Was caused by:                 Missing type enforcement (TE) allow rule.                 You can use audit2allow to generate a loadable module to allow this access.          type=AVC msg=audit(1409231067.380:263026): avc:  denied  { add_name } for  pid=21289 comm="disclaimer" name="in.21288" scontext=unconfined_u:system_r:postfix_pipe_t:s0 tcontext=unconfined_u:object_r:var_spool_t:s0 tclass=dir         Was caused by:                 Missing type enforcement (TE) allow rule.                 You can use audit2allow to generate a loadable module to allow this access.


title: Directory shortcuts in emacs buffer

text: So I asked this question about directory shortcuts in a shell. The idea is I'd like to be able to open a file in `/home/Documents/foo`, say, by typing `C-x` `C-f` `~foo/file`. So, is there a way to emulate zsh's "named directories" in the emacs buffer? Incidentally, the shortcut definitions I want to use are already in my .zshrc, if there's a solution that reads them directly, that gets bonus points.


title: What does bash -l do and why can't it find ssh?

text: I have GitBash installed in a windows 7 box and I'm trying to figure out why running:               bash -l ssh      results in               Welcome to Git (version 1.9.0-preview20140217)          Run 'git help git' to display the help index.     Run 'git help <command>' to display help for specific commands.     bash: /bin/ssh: No such file or directory**      If I do `bash -l` and after login ssh, it all works fine, so what does `bash -l` does exactly? PS: I'm asking this here because I want to know what `bash - l` does and I do not figure why I can't get it to work on GitBash.


title: Replacement for standard KDE monitor manager?

text: My Linux experience is roughly a 4/10. I'm running the latest Debian-Wheezy install, and I've been having some trouble with the stock KDE display/monitor manager (to clarify as these terms seem to converge - referring to the utility that manages the monitors, resolution, etc.; not KDE itself). From googling the issue, I'm not alone in having problems docking the laptop, trying to run on two external monitors, etc., and the display manager freezing up. I've found a workaround for the application locking up, but it's kind of annoying, and I'd like to see if there's another display manager out there I can use. I've never replaced a core function in a Linux distro before, so A) I'm looking for some feedback on the best alternative(s) out there to the stock display manager, and B) Need some help in removing the current utility from the environment. Any help is greatly appreciated.


title: How to move process from one namespace to other?

text: This question is similar to my question about how to list namespaces. So in addtition, I'd like to know some information about moving processes from one namespace to other? E.g. I have processes of current session in one namespace and some other processes of `lxc` container in different namespace, so I want to run (e.g. `links`) in cgroup of that container (it's easily do with `cgexec`) and then move it to container's namespace , because I have to run this process in container without executing it exact in it. Can it be done or it's impossible in Linux??


title: Install Debian in internal flash of IGEPv2

text: Does anyone know how to install Debian on the internal flash in a IGEP v2? This module has 512 MB of internal flash.


title: ERROR: unable to download video

text: I have been using `youtube-dl` to download videos from YouTube, but suddenly it stopped working:               youtube-dl "http://www.youtube.com/watch?v=wglrcytdE9Y&feature=related"          [youtube] Setting language     [youtube] wglrcytdE9Y: Downloading video webpage     [youtube] wglrcytdE9Y: Downloading video info webpage     [youtube] wglrcytdE9Y: Extracting video information          ERROR: unable to download video          youtube-dl --version     2012.02.27


title: Returning only the portion of a line after a matching pattern

text: I have a file (`file_name`) which contains exactly one occurance of the string `Result:`, at the start of a line. I want to print all the characters after the string `Result:` in that line until I encounter a space. Which shell command should I use?               grep "Result: " file_name | tail -c +9       is not working.


title: For a same unix or linux user, different sets of environment variables

text: I'm using `tcsh`, and for a specific project every member of my team connects to a server with the same user. (This is something we cannot change). The situation arises because I want to have some custom environment variables and aliases, and to do so I have my own .tcshrc file (namely `.tcshrc_cust`) which I load as the first action when connecting to that machine:               source .tcshrc_cust      and even though this works pretty well, I'm experiencing a problem when using `vim`: if I get to the shell from inside vim (with `:sh`) I fall into a normal shell, without my custom env. vars. and aliases. Is there a solution for this, besides using a different user in that machine? * * * **SOLUTION (given by @Shawn):** I prefixed my key into `.ssh/authorized_keys` with:               command="setenv subuser noz; tcsh"      and wrote at the end of `.tcshrc` file these lines:               if ($?subuser) then         source .tcshrc_$subuser;     endif      And everything works fine now.


title: case-insensitive search of duplicate file-names

text: I there a way to find all files in a directory with duplicate filenames, regardless of the casing (upper-case and/or lower-case)?


title: mpd/xine like daemon for displaying pictures?

text: I am looking for a daemon that allows me to programmatically display pictures under X and that listens to commands on a socket or network port. Basically think `mpd` or `xine`, just not for audio or video but for pictures. A nice-to-have feature would be blending one picture into another, if requested via a command. Any pointers? Ok, why do I need that?   I need to script displaying pictures on the display based on various inputs, calling `feh` and friends (and killing them once the next picture is to be displayed) yields a not-so-nice black screen in between the pictures, there is no "crossfading" or any other effects in between the pictures. Thanks!


title: Cannot connect to Samba shares after reinstall

text: I have a home file server on which I have recently reinstalled the OS. I replaced Ubuntu Server 10.04.2 32-bit with 10.04.3 64-bit due to hardware upgrades. I've copied my previous Samba configuration over, recreated the share user, and made sure the permissions for the shared directories, on another disk, were still intact. I have an XP and a Win7 machine. Both can see the file server, but neither can access the shares. If I go to `\\\Server` on a Windows machine, it prompts for a user/pass and appears to accept the connection. If I go to `\\\Server\Share` next, it asks for a user/pass again, and will not authenticate. No network settings have changed on the Windows machines. Is there some other configuration I might be missing for the server? What else could be wrong? **Troubleshooting:** I found the logs, as suggested. smbd and nmbd are both running. In the logs for the windows machines, I get a lot of lines like this when trying to connect.               [2011/11/07 07:23:53,  1] smbd/service.c:676(make_connection_snum)       create_connection_server_info failed: NT_STATUS_ACCESS_DENIED      This is clearly the problem, but I don't know why it's happening. The user and pass I'm using are good, and it was working before the upgrade. I did find this in log.winbindd-idmap:               [2011/11/07 07:14:12,  1] winbindd/idmap.c:321(idmap_init_domain)       idmap initialization returned NT_STATUS_UNSUCCESSFUL     [2011/11/07 07:23:40,  0] winbindd/idmap.c:201(smb_register_idmap_alloc)       idmap_alloc module tdb already registered!     [2011/11/07 07:23:40,  0] winbindd/idmap.c:149(smb_register_idmap)       Idmap module passdb already registered!     [2011/11/07 07:23:40,  0] winbindd/idmap.c:149(smb_register_idmap)       Idmap module nss already registered!     [2011/11/07 07:23:40,  1] winbindd/idmap_tdb.c:214(idmap_tdb_load_ranges)       idmap uid missing     [2011/11/07 07:23:40,  0] winbindd/idmap_tdb.c:287(idmap_tdb_open_db)       Upgrade of IDMAP_VERSION from -1 to 2 is not possible with incomplete configur     ation     [2011/11/07 07:23:40,  1] winbindd/idmap.c:321(idmap_init_domain)       idmap initialization returned NT_STATUS_UNSUCCESSFUL      log.smbd               [2011/11/06 20:01:29,  0] smbd/server.c:1069(main)       smbd version 3.4.7 started.       Copyright Andrew Tridgell and the Samba Team 1992-2009     [2011/11/06 20:01:29,  0] printing/print_cups.c:103(cups_connect)       Unable to connect to CUPS server localhost:631 - Connection refused     [2011/11/06 20:01:29,  0] printing/print_cups.c:103(cups_connect)       Unable to connect to CUPS server localhost:631 - Connection refused     [2011/11/06 20:01:29,  0] smbd/server.c:1115(main)       standard input is not a socket, assuming -D option      log.nmbd               [2011/11/06 13:40:55,  0] nmbd/nmbd.c:854(main)       nmbd version 3.4.7 started.       Copyright Andrew Tridgell and the Samba Team 1992-2009      smb.conf, most of which is stock               [global]        workgroup = MyGroup   # edited        server string = %h server (Samba, Ubuntu)        dns proxy = no        use sendfile = yes   # edited        log file = /var/log/samba/log.%m        max log size = 1000        syslog = 0        panic action = /usr/share/samba/panic-action %d        security = user   # edited        encrypt passwords = true        passdb backend = tdbsam        obey pam restrictions = yes        unix password sync = yes        passwd program = /usr/bin/passwd %u        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .        pam password change = yes        map to guest = bad user        guest account = myshareuser   # edited        usershare allow guests = yes          [printers]        comment = All Printers        browseable = no        path = /var/spool/samba        printable = yes        guest ok = no        read only = yes        create mask = 0700          [print$]        comment = Printer Drivers        path = /var/lib/samba/printers        browseable = yes        read only = yes        guest ok = no          # added     [share]     path = /mnt/storage/share     force user = myshareuser     force group = myshareuser     read only = No     create mask = 0777     directory mask = 0777     guest only = No     guest ok = No          [backup]     path = /mnt/storage/backup     force user = myshareuser     force group = myshareuser     read only = No     create mask = 0777     directory mask = 0777     guest only = No     guest ok = No


title: Why does TOP never show cpu usage reaching 100%?

text: I have a dual-core processor. I'm running two instances of the program below               void void main(){         int i;         while(1){             i=i+1;         }     }      I run TOP and CPU usage gets up to 97%, however it never reaches 100%, why doesn't it? CPU is supposed to be always busy running the two programs with no I/O operation. How would the int overflow affect the memory? Does TOP actually show all the CPU usage or is there a percentage of the CPU reserved only for the SO that is not shown there? Are there processes of the SO that are not shown there?


title: Find out if a session is running under `su`

text: I'm trying to check whether the current shell session is running within a `su` login session. What's the best way to test this condition?


title: Wrapper program that sets signal handler

text: I would like to have a wrapper program that runs a given command and sets a signal handler so that it gets run when the command receives a specified signal. The question is this:   1. Is there an utility program to do this?   2. If not, is it possible to do this by using bash's commands `trap` and `exec`?   3. If not, how can I do this? (e.g. by writing a program myself in C which does a few system calls) EDIT: The target platform is GNU/Linux. EDIT 2: Following Ignacio's answer, I managed to write a preload SO which looks like this.


title: Writing a shell script to take output of an executable and perform some calculation

text: I am not much familiar with shell script. I want to write a shell script for the following pseudo-code:               min=some garbage value     for(i=1 to N){  // N and n will be taken as input for the shell script.         for(j=1 to n){            val= './a.out' // call the executable a.out and take the output in val            if(val<min)    // a.out is a random number generator script                min=val;         }        arr[k++]=min;     }     // Then I want to calculate the sum of the elements of the array 'arr'.      How to do these by a shell script? `a.out` is such that it will produce a string of digits as output. I have to convert this string into the variable `val`. How to do this? For example, `a.out` is producing `12.34` as output but `12.34` is a character array and not a float. I want to convert this to float through shell script and I don't have permission to change the C code for which `a.out` is the executable.               #!/bin/bash     # set min to some garbage value     min=1     N=$1     n=$2     for (( i=1; i<=$N; i++ )); do        for (( j=1; j<=$n; j++ )); do            val=$(/path/to/a.out)            val2=`echo $val | bc`    // is this the correct syntax?            if (( $val2 < $min )); then                min=$val2;             fi           done        arr=("${arr[@]}" "$min")     done          # Then I want to calculate the sum of the elements of the array 'arr'.     sum=0     for (( l=0; l<${#arr[@]}; l++ )); do       sum=$( expr $sum + ${arr[$l]} )     done          echo "Sum of \$arr = ${sum}"      The above code is not working for me.


title: How do I make get-iplayer produce watchable quality without huge filesize?

text: Summary findings:   1. I'm using get-iplayer v2.82. The files I produce on hard drive are all mp4.   2. I've discovered the following (downloading same TV program in both cases): Using `\--modes=flashstd` and `\--tvmode=flashhigh2` gives a watchable quality file which is the _same filesize_ as the qualities above this that `\--modes` and `\--tvmode` can deliver. The VERY NEXT step down in quality from the above settings (from my experimenting) is   `\--modes=flashstd` and `\--tvmode=flashstd1`. This gives a smaller filesize, but is _NOT_ a watchable quality. The point being that you don't seem to be able to drop down from a "too big" filesize to a smaller size and retain watchable quality.   3. My command line had the following form:   `get-iplayer --get 1234 --modes=flashstd --tvmode=flashhigh2` I tried: i) `\--modes=flashstd --tvmode=flashhigh2` Result: Filesize 170Mb (too big for my liking).   (TV program: "The Slammer" from BBC iplayer, 30 minute duration, _watchable quality_.) ii) `\--modes=flashstd --tvmode=flashstd1` Result: Filesize 110Mb (an _acceptable size_ , but _NOT_ watchable quality).   (TV program: Same program as above, from BBC iplayer, 30 minute duration, _NOT_ watchable quality (some murky pixelation)). iii) For comparison: TV program: "Terry and June", from YOUTUBE, mp4, only 90Mb filesize (ACCEPTABLE), 30 minutes duration, WATCHABLE QUALITY. * * * Full Details:   1. My aim is to avoid downloading files with get-iplayer that are twice as big as similar-duration programs that I download from youtube. You see I don't want to swallow up disc space.   2. I've deduced the following: `\--modes`:   Specifies the _recording quality_ you want (in your file on the hard drive). For example, if you had a video tape recorder, then LP (long play) recording mode is a lower recording quality than SP (standard play). `\--tvmode`:   Specifies the _quality_ of TV program that you want to fetch from the BBC end (eg., HD, SD, and the sub-qualities within these).   3. I've intelligently experimented with combinations of `\--modes` and `\--tvmode`, but at the point at which a _smaller file_ is produced, its quality isn't good enough to watch.   4. When I download say a 30 minute TV program from youtube, the filesize is say 90Mb (mp4), and of watchable quality. But with get-iplayer (downloading from BBC), for the same program duration of 30 minutes, I can't produce a file that is less than about 170Mb _AND_ that is of watchable quality.


title: What is the easiest way to add a string on the beginning of every line of the file from the command line?

text: I am looking for a way to add some string to the beginning of every line (same string for every line). Not something customizable but rather something that will be easy to remember and available on every POSIX-compliant platform (and every shell as well).


title: Keeping track of programs

text: When I install a simple program it often uses make && make install and doesn't often even have an uninstall target. If I wish to upgrade a program is it standard protocol to assume it just rewrites seamlessly over the old program. How do I keep track of these programs, do most people just 'fire and forget' and if no uninstall target is given do I have to manually delete everything?


title: Uninstalling Software Built from Source

text: How can you uninstall software that was built and installed from source? (Using `make install`?)


title: How do I remove/uninstall a program that I have complied from source?

text: How do I remove a program that I have compiled from source using the `./configure; make; make install` method? Does it matter whether I have kept the original directory that the source was stored in or not?


title: Remap altgr key to AC10 in XKB

text: I'd like to remap the altgr key to AC10 key. So far, I edited `/usr/share/X11/xkb/symbols/us` as follows:               // key <AC10> { [ semicolon,  colon   ] };        key <AC10> { [ Alt_R ]}        After               $ cd /var/lib/xkb; sudo rm *     $ setxkbmap us     Error loading new keyboard description      Is there a way to achieve this mapping? I'd like to use `AC10` as `Alt_R`. `semicolon` and `colon` will be mapped on some other keys. I achieved this behavior in `xmodmap` `keycode 47 = ISO_Level3_Shift` And wonder if it's possible in `xkb` too.


title: tweaking the gentoo livecd for a 100% headless install

text: I am trying to enable ssh and a create a static root password for the live-cd. While the process seems quite obvious, I haven't been able to get a bootable image out of it. SSH-enabled gentoo livecd from Gentoo Wiki Archives


title: change fonts of applications in dwm

text: I'm currently using dwm 6.0 and I was wondering how I could change the font of programs like Firefox. I already changed the font given in the config.h and recompiled it but it didn't change anything. Am I right that I can't change the font of the terminal within the config.h ?


title: ksh variable substitution format?

text: I have variables named `var1EMI`, `var2EMI`, `var1DDE`, `var2DDE`, etc and I need to be able to iterate over them like this;               for dir in var1 var2     do       echo "EMI value for " $dir " is " ${${dir}EMI}       echo "DDE value for " $dir " is " ${${dir}DDE}     done      I can't figure out how to get the `${${dir}EMI}` substitutions to resolve.


title: How to resume YouTube videos in VLC?

text: Whenever I pause a YouTube video which is playing in VLC for a few minutes and resume it, it simply plays a few seconds (presumably until the end of some cache) and then stops playback. Is there some way to get it to resume the connection to YouTube and continue playing/downloading?


title: Looking for the professional video editing tool

text: No this is not a poll. I guess you have to admit that gimp is _the_ picture editing tool for linux. Well i am lookin for _the_ video editing tool for linux. Is there one?


title: How to de-select packages of a certain architecture in aptitude

text: I'm upgrading some Debian machines from i386 arch to amd64. The process is fairly straitforward:   * Boot a amd64 kernel   * For libraries which are multiarch-capable, install their amd64 companion libraries   * Manually install amd64 versions of dpkg and apt   * Start installing the amd64 versions of packages over their i386 counterparts All of this goes fairly smoothly, and I've been able to write scripts which help, but then I run into a problem: When I run aptitude, it thinks that I still want to install the old i386 versions of everything (in addition to the amd64 versions). So, my aptitude screen looks something like:               ii   iptables ...     pi   iptables:i386 ...     ii   iptraf ...     pi   iptraf:i386 ...      So, packages like iptables:i386 will show as "purged, but marked for install". This leads to several _hundred_ collisions. Up until now, I've just been going through, one-by-one, and de-selecting them. I didn't have much luck with my attempts at using "dpkg --set-selections" So, the official question is: **Does anybody know of a trick to "un-mark for install" (in aptitude) the i386 versions of every package which already has a amd64 version installed?**


title: Negate while loop condition in bash

text: In part of the script that I'm working on, I want to validate that the inputted IP address is in the correct format. I want to make a loop while the input format is NOT correct. The following works for a loop while the format IS correct.               while  [[  $range =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} ]]           do      How can I turn this around to say DOES NOT fit the format. I was hoping `!=~` would work, but I'm getting a syntax error.


title: What can cause a .sh file to not launch through this type of install?

text: I am using an Ubuntu 12.10/Gnome3 and was setting up PhpStorm using this tutorial http://devnet.jetbrains.com/thread/439389 The process involved copy/ **pasting** the files into usr/local/PhpStorm-** (with granted access through use of "Alt+F2" and type "gksu nautilus") then creating a launcher on the desktop. The launcher says it does not exist though path seems correct and when I double click the phpstorm.sh file I open it (in default editor) rather than launching. This has happened before in various attempts at making Linux my default OS and this seems to be my biggest issue, installing software not built into Synaptic or one of the installer software. So my question is not only how do I fix this, but also how to understand what is happening so I can figure out on my own next time. UPDATE: So I was able to launch in the terminal using               chmod +x phpstorm.sh     ./phpstorm.sh      Then it set up a launcher via the new PhpStorm install in my Applications/Programming. Works for now but still not the easiest process.


title: quotas not linked to users but to directories

text: Usually, quotas are enforced per user, as related to the proprietary of the file. Is it possible to apply a quota on a folder basis, in such a way, that a folder contents are limited in disk space?


title: How to configure network profiles in Centos?

text: I'm trying to setup two network profiles in Centos. One for at home, one for at work. The home profile has a fixed IP address, fixed gateway and DNS server addresses. The work profile depends on DHCP. I've created a 'home' and a 'work' directory in /etc/sysconfig/networking/profiles. Each has the following files containing the proper configuration:               > -rw-r--r-- 2 root root  422 Apr 17 20:17 hosts     > -rw-r--r-- 5 root root  223 Apr 17 20:18 ifcfg-eth0     > -rw-r--r-- 1 root root  101 Apr 17 20:17 network     > -rw-r--r-- 2 root root   73 Apr 17 20:18 resolv.conf      There was already a 'default' profile, which contains the same files. Then I issued these commands:               system-config-network-cmd --profile work --activate     service network restart      I was expecting these files to get copied from the `profiles/work` directory to `/etc/sysconfig/` and `/etc/sysconfig/networking-scripts`. And most files do get copied, except for `ifcfg-eth0`. Stangely enough that files seems to be overwritten with the current settings when I issue `system-config-network-cmd`. The other files are also touched, but there contents stays in tact. The system is Centos 5.7 running on a virtual pc within a windows 7 machine. Here is the output for ifconfig:               # ifconfig     eth0      Link encap:Ethernet  HWaddr 00:03:FF:6F:2E:AB               inet addr:192.168.1.200  Bcast:192.168.1.255  Mask:255.255.255.0               inet6 addr: fe80::203:ffff:fe6f:2eab/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:4199761 errors:7 dropped:0 overruns:0 frame:0               TX packets:1733750 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:2316624688 (2.1 GiB)  TX bytes:415533386 (396.2 MiB)               Interrupt:9      Can someone tell what I'm missing here?


title: ZSH and completion of files with newline characters

text: I am experimenting with ZSH on nasty file names, especially file names with the newline character in it. Here is how I create them:               $ touch "filename<hit return here>     1"          $ touch "filename<hit return here>     2"      Now I want to copy it:               $ cp filename<tab>      ZSH completes with:               $ cp filename$'\n'      and refuses to give me the option for 1 or 2. What's happening here ?


title: Editing images with sips doesn't work without being executed directly from Terminal?

text: I made a cheesy application with a bash script using CocoaDialog, and within this application I need to modify the size of a photo. So, I researched a little and found the sips command; and it works perfectly when I execute my script directly from Terminal. Unfortunately, when the script is executed from the app being clicked on, the image isn't modified at all. I read through the sips man page, and found nothing that would solve my problem. If you have any alternatives for editing a photo in this situation, or even something that I may be missing within the sips command, please let me know.


title: Why is number of open files limited in Linux?

text: Right now, I know that:   * Find open files limit per process: `ulimit -n`   * Count all opened files by all process: `lsof | wc -l`   * Get maximum open files count allowd: `cat /proc/sys/fs/file-max` My question here is that: Why there would be a limit of open files in Linux?


title: How to find by what means a software has been installed on linux

text: I have plenty of softwares installed on my Linux machine (RHEL) and some were installed with yum, some other by downloading a rpm and executed it from gnome file manager. I also have few softwares archives (zip or tar) I just unzipped in the /opt directory. My question is: is it possible to know by which method I installed e.g the chrome browser which is located in /opt/google/ folder? The answer can be different by Linux distro, but I am more interested for these distros: RHEL, CentOS, Fedora (sorted by importance). The answer is enough for me if I can know: it was installed by yum, rpm or zip. I checked the `history` (for both my own user and for `root`) but there is not traces there anymore.


title: Error while trying to connect to internet using wvdial

text: I am getting error while connecting to Internet through Wvdial . This is the output which I am getting :               tusharmakkar08@tusharmakkar08-Satellite-C660 ~ $ sudo wvdial     --> WvDial: Internet dialer version 1.61     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 S0=0 &C1; &D2; +FCLASS=0     ATQ0 V1 E1 S0=0 &C1; &D2; +FCLASS=0     OK     --> Modem initialized.     --> Sending: ATDT#777     --> Waiting for carrier.     ATDT#777     CONNECT 316800     --> Carrier detected.  Starting PPP immediately.     --> Starting pppd at Thu Nov  7 15:24:48 2013     --> Pid of pppd: 6699     --> Using interface ppp0     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> local  IP address 115.241.16.160     --> pppd: �p�[08]�h�[08]     --> remote IP address 220.224.141.145     --> pppd: �p�[08]�h�[08]     --> primary   DNS address 220.226.6.104     --> pppd: �p�[08]�h�[08]     --> secondary DNS address 220.226.100.40     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> Connect time 0.1 minutes.     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> Disconnecting at Thu Nov  7 15:24:58 2013     --> The PPP daemon has died: A modem hung up the phone (exit code = 16)     --> man pppd explains pppd error codes in more detail.     --> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.     --> Auto Reconnect will be attempted in 5 seconds     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 S0=0 &C1; &D2; +FCLASS=0     ATQ0 V1 E1 S0=0 &C1; &D2; +FCLASS=0     OK     --> Modem initialized.     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 S0=0 &C1; &D2; +FCLASS=0     ATQ0 V1 E1 S0=0 &C1; &D2; +FCLASS=0     OK     --> Modem initialized.     --> Sending: ATDT#777     --> Waiting for carrier.     ATDT#777     CONNECT 3100000     --> Carrier detected.  Starting PPP immediately.     --> Starting pppd at Thu Nov  7 15:25:10 2013     --> Pid of pppd: 6758     --> Using interface ppp0     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> pppd: �p�[08]�h�[08]     --> Disconnecting at Thu Nov  7 15:25:11 2013     --> The PPP daemon has died: A modem hung up the phone (exit code = 16)     --> man pppd explains pppd error codes in more detail.     --> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.     --> Auto Reconnect will be attempted in 10 seconds     --> Initializing modem.     --> Sending: ATZ     ATZ     OK     --> Sending: ATQ0 V1 E1 S0=0 &C1; &D2; +FCLASS=0     ATQ0 V1 E1 S0=0 &C1; &D2; +FCLASS=0     OK     --> Modem initialized.      This is the `wvdial.conf` output :               Editing `/etc/wvdial.conf'.          Scanning your serial ports for a modem.          Modem Port Scan: S0   S1   S2   S3   S4   S5   S6   S7        Modem Port Scan: S8   S9   S10  S11  S12  S13  S14  S15       Modem Port Scan: S16  S17  S18  S19  S20  S21  S22  S23       Modem Port Scan: S24  S25  S26  S27  S28  S29  S30  S31                 Sorry, no modem was detected!  Is it in use by another program?     Did you configure it properly with setserial?          Please read the FAQ at http://alumnit.ca/wiki/?WvDial      This is the content of my wvdial.conf               [Dialer Defaults]     Init1 = ATZ     Init2 = ATQ0 V1 E1 S0=0 &C1; &D2; +FCLASS=0     Stupid Mode = 1     Modem Type = USB Modem     ISDN = 0     Phone = #777     New PPPD = yes     Modem = /dev/ttyUSB0      Username = 9354380887     Password = 9354380887      CBaud = 460800      My `/etc/ppp/options` file include               # /etc/ppp/options     #      # Originally created by Jim Knoble      # Modified for Debian by alvar Bray      # Modified for PPP Server setup by Christoph Lameter      #     # To quickly see what options are active in this file, use this command:     #   egrep -v '#|^ *$' /etc/ppp/options          # Specify which DNS Servers the incoming Win95 or WinNT Connection should use     # Two Servers can be remotely configured     # ms-dns 192.168.1.1     # ms-dns 192.168.1.2          # Specify which WINS Servers the incoming connection Win95 or WinNT should use     # ms-wins 192.168.1.50     # ms-wins 192.168.1.51          # Run the executable or shell command specified after pppd has     # terminated the link.  This script could, for example, issue commands     # to the modem to cause it to hang up if hardware modem control signals     # were not available.     #disconnect "chat -- \d+++\d\c OK ath0 OK"          # async character map -- 32-bit hex; each bit is a character     # that needs to be escaped for pppd to receive it.  0x00000001     # represents '\x01', and 0x80000000 represents '\x1f'.     asyncmap 0          # Require the peer to authenticate itself before allowing network     # packets to be sent or received.     # Please do not disable this setting. It is expected to be standard in     # future releases of pppd. Use the call option (see manpage) to disable     # authentication for specific peers.     #auth     noauth     # ... Unfortunately, fixing this properly in the peers file     # (/etc/ppp/peers/ppp0, typically) is apparently incompatible with the     # paradigm used by gnome-system-tools and system-tools-backend for     # managing the peers files.  So in Ubuntu Feisty we change the default.          # Use hardware flow control (i.e. RTS/CTS) to control the flow of data     # on the serial port.     crtscts          # Use software flow control (i.e. XON/XOFF) to control the flow of data     # on the serial port.     #xonxoff          # Specifies that certain characters should be escaped on transmission     # (regardless of whether the peer requests them to be escaped with its     # async control character map).  The characters to be escaped are     # specified as a list of hex numbers separated by commas.  Note that     # almost any character can be specified for the escape option, unlike     # the asyncmap option which only allows control characters to be     # specified.  The characters which may not be escaped are those with hex     # values 0x20 - 0x3f or 0x5e.     #escape 11,13,ff          # Don't use the modem control lines.     #local          # Specifies that pppd should use a UUCP-style lock on the serial device     # to ensure exclusive access to the device.     lock          # Don't show the passwords when logging the contents of PAP packets.     # This is the default.     hide-password          # When logging the contents of PAP packets, this option causes pppd to     # show the password string in the log message.     #show-password          # Use the modem control lines.  On Ultrix, this option implies hardware     # flow control, as for the crtscts option.  (This option is not fully     # implemented.)     modem          # Set the MRU [Maximum Receive Unit] value to  for negotiation.  pppd     # will ask the peer to send packets of no more than  bytes. The     # minimum MRU value is 128.  The default MRU value is 1500.  A value of     # 296 is recommended for slow links (40 bytes for TCP/IP header + 256     # bytes of data).     #mru 542          # Set the interface netmask to , a 32 bit netmask in "decimal dot"     # notation (e.g. 255.255.255.0).     #netmask 255.255.255.0          # Disables the default behaviour when no local IP address is specified,     # which is to determine (if possible) the local IP address from the     # hostname. With this option, the peer will have to supply the local IP     # address during IPCP negotiation (unless it specified explicitly on the     # command line or in an options file).     #noipdefault          # Enables the "passive" option in the LCP.  With this option, pppd will     # attempt to initiate a connection; if no reply is received from the     # peer, pppd will then just wait passively for a valid LCP packet from     # the peer (instead of exiting, as it does without this option).     #passive          # With this option, pppd will not transmit LCP packets to initiate a     # connection until a valid LCP packet is received from the peer (as for     # the "passive" option with old versions of pppd).     #silent          # Don't request or allow negotiation of any options for LCP and IPCP     # (use default values).     #-all          # Disable Address/Control compression negotiation (use default, i.e.     # address/control field disabled).     #-ac          # Disable asyncmap negotiation (use the default asyncmap, i.e. escape     # all control characters).     #-am          # Don't fork to become a background process (otherwise pppd will do so     # if a serial device is specified).     #-detach          # Disable IP address negotiation (with this option, the remote IP     # address must be specified with an option on the command line or in     # an options file).     #-ip          # Disable IPCP negotiation and IP communication. This option should     # only be required if the peer is buggy and gets confused by requests     # from pppd for IPCP negotiation.     #noip          # Disable magic number negotiation.  With this option, pppd cannot     # detect a looped-back line.     #-mn          # Disable MRU [Maximum Receive Unit] negotiation (use default, i.e.     # 1500).     #-mru          # Disable protocol field compression negotiation (use default, i.e.     # protocol field compression disabled).     #-pc          # Require the peer to authenticate itself using PAP.     #+pap          # Don't agree to authenticate using PAP.     #-pap          # Require the peer to authenticate itself using CHAP [Cryptographic     # Handshake Authentication Protocol] authentication.     #+chap          # Don't agree to authenticate using CHAP.     #-chap          # Disable negotiation of Van Jacobson style IP header compression (use     # default, i.e. no compression).     #-vj          # Increase debugging level (same as -d).  If this option is given, pppd     # will log the contents of all control packets sent or received in a     # readable form.  The packets are logged through syslog with facility     # daemon and level debug. This information can be directed to a file by     # setting up /etc/syslog.conf appropriately (see syslog.conf(5)).  (If     # pppd is compiled with extra debugging enabled, it will log messages     # using facility local2 instead of daemon).     #debug          # Append the domain name  to the local host name for authentication     # purposes.  For example, if gethostname() returns the name porsche,     # but the fully qualified domain name is porsche.Quotron.COM, you would     # use the domain option to set the domain name to Quotron.COM.     #domain           # Enable debugging code in the kernel-level PPP driver.  The argument n     # is a number which is the sum of the following values: 1 to enable     # general debug messages, 2 to request that the contents of received     # packets be printed, and 4 to request that the contents of transmitted     # packets be printed.     #kdebug n          # Set the MTU [Maximum Transmit Unit] value to . Unless the peer     # requests a smaller value via MRU negotiation, pppd will request that     # the kernel networking code send data packets of no more than n bytes     # through the PPP network interface.     #mtu           # Set the name of the local system for authentication purposes to .     # This is a privileged option. With this option, pppd will use lines in the     # secrets files which have  as the second field when looking for a     # secret to use in authenticating the peer. In addition, unless overridden     # with the user option,  will be used as the name to send to the peer     # when authenticating the local system to the peer. (Note that pppd does     # not append the domain name to .)     #name           # Enforce the use of the hostname as the name of the local system for     # authentication purposes (overrides the name option).     #usehostname          # Set the assumed name of the remote system for authentication purposes     # to .     #remotename           # Add an entry to this system's ARP [Address Resolution Protocol]     # table with the IP address of the peer and the Ethernet address of this     # system.     #proxyarp          # Use the system password database for authenticating the peer using     # PAP. Note: mgetty already provides this option. If this is specified     # then dialin from users using a script under Linux to fire up ppp wont work.     # login          # If this option is given, pppd will send an LCP echo-request frame to the     # peer every n seconds. Normally the peer should respond to the echo-request     # by sending an echo-reply. This option can be used with the     # lcp-echo-failure option to detect that the peer is no longer connected.     lcp-echo-interval 30          # If this option is given, pppd will presume the peer to be dead if n     # LCP echo-requests are sent without receiving a valid LCP echo-reply.     # If this happens, pppd will terminate the connection.  Use of this     # option requires a non-zero value for the lcp-echo-interval parameter.     # This option can be used to enable pppd to terminate after the physical     # connection has been broken (e.g., the modem has hung up) in     # situations where no hardware modem control lines are available.     lcp-echo-failure 4          # Set the LCP restart interval (retransmission timeout) to  seconds     # (default 3).     #lcp-restart           # Set the maximum number of LCP terminate-request transmissions to      # (default 3).     #lcp-max-terminate           # Set the maximum number of LCP configure-request transmissions to      # (default 10).     #lcp-max-configure           # Set the maximum number of LCP configure-NAKs returned before starting     # to send configure-Rejects instead to  (default 10).     #lcp-max-failure           # Set the IPCP restart interval (retransmission timeout) to      # seconds (default 3).     #ipcp-restart           # Set the maximum number of IPCP terminate-request transmissions to      # (default 3).     #ipcp-max-terminate           # Set the maximum number of IPCP configure-request transmissions to      # (default 10).     #ipcp-max-configure           # Set the maximum number of IPCP configure-NAKs returned before starting     # to send configure-Rejects instead to  (default 10).     #ipcp-max-failure           # Set the PAP restart interval (retransmission timeout) to  seconds     # (default 3).     #pap-restart           # Set the maximum number of PAP authenticate-request transmissions to     #  (default 10).     #pap-max-authreq           # Set the maximum time that pppd will wait for the peer to authenticate     # itself with PAP to  seconds (0 means no limit).     #pap-timeout           # Set the CHAP restart interval (retransmission timeout for     # challenges) to  seconds (default 3).     #chap-restart           # Set the maximum number of CHAP challenge transmissions to      # (default 10).     #chap-max-challenge          # If this option is given, pppd will rechallenge the peer every      # seconds.     #chap-interval           # With this option, pppd will accept the peer's idea of our local IP     # address, even if the local IP address was specified in an option.     #ipcp-accept-local          # With this option, pppd will accept the peer's idea of its (remote) IP     # address, even if the remote IP address was specified in an option.     #ipcp-accept-remote          # Disable the IPXCP and IPX protocols.     # To let pppd pass IPX packets comment this out --- you'll probably also     # want to install ipxripd, and have the Internal IPX Network option enabled     # in your kernel.  /usr/doc/HOWTO/IPX-HOWTO.gz contains more info.     noipx          # Exit once a connection has been made and terminated. This is the default,     # unless the `persist' or `demand' option has been specified.     #nopersist          # Do not exit after a connection is terminated; instead try to reopen     # the connection.     #persist          # Terminate after n consecutive failed connection attempts.     # A value of 0 means no limit. The default value is 10.     #maxfail           # Initiate the link only on demand, i.e. when data traffic is present.      # With this option, the remote IP address must be specified by the user on     # the command line or in an options file.  Pppd will initially configure     # the interface and enable it for IP traffic without connecting to the peer.      # When traffic is available, pppd will connect to the peer and perform     # negotiation, authentication, etc.  When this is completed, pppd will     # commence passing data packets (i.e., IP packets) across the link.     #demand          # Specifies that pppd should disconnect if the link is idle for  seconds.     # The link is idle when no data packets (i.e. IP packets) are being sent or     # received.  Note: it is not advisable to use this option with the persist     # option without the demand option.  If the active-filter option is given,     # data packets which are rejected by the specified activity filter also     # count as the link being idle.     #idle           # Specifies how many seconds to wait before re-initiating the link after     # it terminates.  This option only has any effect if the persist or demand     # option is used.  The holdoff period is not applied if the link was     # terminated because it was idle.     #holdoff           # Wait for up n milliseconds after the connect script finishes for a valid     # PPP packet from the peer.  At the end of this time, or when a valid PPP     # packet is received from the peer, pppd will commence negotiation by     # sending its first LCP packet.  The default value is 1000 (1 second).     # This wait period only applies if the connect or pty option is used.     #connect-delay           # Packet filtering: for more information, see pppd(8)     # Any packets matching the filter expression will be interpreted as link     # activity, and will cause a "demand" connection to be activated, and reset     # the idle connection timer. (idle option)     # The filter expression is akin to that of tcpdump(1)     #active-filter      lcp-echo-failure 0     lcp-echo-interval 0     -vj          # ------      How to remove/rectify this error ?


title: Why doesn't this regex work?

text: I want to look at the output of `git status -s` to determine whether there are any untracked files in the tree. I tried the following test, but the regex doesn't match. Why not?               $ git status -s     ## master      M updated-file     ?? new-file     $ [[ $(git status -s) =~ ^\?\? ]] || echo "no match"     no match      I'd also like to be able to test for added/modified/deleted files in the same way. I'd normally just use something like `^\s*[AMD]` for this purpose, but this doesn't work either. What gives?


title: How can I force codepage/locale (different from my Linux system locale) for non-Unicode Wine applications?

text: I prefer using English locales for my system, but have to use some old Unicode-unaware Russian and Czech applications. In Windows I could set a locale for such applications in a separate Control Panel place. How can I configure this in Linux/Wine?


title: Backup from remote server

text: I'm a novice so go easy. :) If it makes a difference I'm using Ubuntu/Debian machines. I want to back up our dedicated web server to a local location in-house. This is for many reasons - I know that our web host will back up properly, however there are occasions when we will will release a new website and our clients will want to get access to old data and we will want to roll back to an earlier version of the site, and other similar situations. I know that to do this I need to use rsync and cron, but I don't know much more than that. The aim is to get the latest backup onto our in-house server and then to push that backup to our network attached storage device where the previous backups are also stored. So with rsync I will always have the latest version on the in-house server right? Rsync will only transfer files which have updated. Then from there I can run a cron which will push via rsync or SMB to the NAS box? So my question is, assuming that my method is correct, how would I use rsync to pull down the /home directory on my remote server? Is it an easy process? Is there a beginners guide to rsync? Can I do rsync from the local machine? We don't have a static ip address and I would like to cron this so that it does a backup automatically every night (or week depending on how long it takes and how much space it takes up).


title: When are the built-in commands loaded to memory

text: Let's say if I type in `cd` in my shell. Is `cd` loaded from the memory at that moment? My intuition is that these built-in commands are pre-loaded to the system memory after the kernel has been loaded, but someone insisted that they are loaded only when I actually invoke the command (press enter on a shell). Could you please tell me if there is a reference that explains this?


title: Serve files over USB

text: I would like to be able to serve a section of my box's file system over USB to another computer. For example, if the files are on box A and I am reading from box B, then B would mount A, see those files, and mount them as a file system device (ie., like a thumb drive). Ideally the solution would work for any Linux distro, but I will most likely be running this on Debian variants. Please let me know if you need any more info. Cheers.


title: Complete system hang on umount and `ls /dev/sd*`

text: I have a portable hard drive which I mount on `/mnt/ext`. Normally it works fine. But if I leave it mounted with no activity for sufficiently long, it can cause my system to completely hang. This has happened twice so far. No mouse movement, the clock doesn't update, ctrl-alt-f1 doesn't work. (I don't have a sysrq key to try magic sysrq with.) When I left the house this morning it had been like that for over ten minutes; last time I rebooted after probably five minutes or so. (Update: it was still frozen when I got home after almost ten hours.) Last time, I'm pretty sure the hang happened when I ran `ls /dev/sd*` (or possibly with `-l`). This seems really odd to me, so it's possible I'm misremembering. This morning I ran `ls /dev/sd*` and it didn't hang, but it did hang when I ran `umount /mnt/ext`. Actually, first time I tried to umount, it complained that the device was busy; I quit the shell that was cd'd inside it, tried to umount again, and then it hung. In both cases, the command running didn't run to completion (I didn't get another shell prompt) or produce any output. This is a fairly new laptop, but old hard drive. I didn't have this problem on my old laptop with the same hard drive. I don't recall being in this situation with the new laptop and it not crashing, but that doesn't necessarily mean I haven't been. I haven't tried other hard drives. The hard drive spins down some minutes of inactivity, but it takes longer than that for this problem to kick in. I don't recall ever testing periods between 'a few hours' and 'a few days'. I'm using gentoo's genkernel, I don't recall which version but I only installed it a few months ago. This seems to be the relevant section from my system logs: http://pastebin.com/gi8NUp0D. 08:44 is when my system froze; the next entry is from 18:26, when I booted it up again.


title: How to highlight logs with bash coloring on vim?

text: I have some nicely colored logs from some tools with bash color codes. When I view them through less or similar tools it get color rendered by bash (obviously). However it is pain to watch and edit them in any text editor like vim, because Ansi escape sequences that describes colors gets mangled and becomes really annoying to select edit, cut, paste, etc. etc.. I have ugly stuff like this when watched by vim or any editor:               0:00:00.001474526 ^[[334m11931^[[00m      0x21df400 ^[[36mDEBUG  ^[[00m ^[[00m             So:   1. Is there anything like plugin for vim to color text according these bash color descriptors. Anything like that. If Vim could highlight text according Ansi escape sequences for more pleasant viewing.   2. If above is impossible how to pipe log through something and have colorless output feed to vim for it to be at least editable.