title: How given script makes executables in /usr/local/bin/

text: While doing project , I found a script that is bounced over my head. Can you help me to understand this script . Please explain this script step by step. **SCRIPT**               if ! [ -f /usr/local/bin/XXX -a -f /usr/local/bin/YYY -a -f /usr/local/bin/ZZZ ]     then         if [ "`uname`" = "Linux" ]         then             UUDECODE="uudecode -o /dev/stdout"         else             UUDECODE="uudecode -p"         fi         cat $0 | awk 'printme == "1" {print} /^DATA BEGINS HERE/ {printme = "1"}' | ${UUDECODE} | (cd /usr/local/bin ; sudo tar xzf - --unlink)         sudo chmod AAAA /usr/local/bin/XXX /usr/local/bin/YYY     fi      **My understanding so far**   1. This script checks if XXX , YYY , ZZZ is present in /usr/local/bin , is present or not.   2. If not then it enters in the body of if.   3. If current OS is Linux, then it do    4. But after that I didn't understand. Strange after running this script these three executables are in /usr/local/bin. Explain below script line by line please. **One thing that I mention that, at the end of script, there is some unreadable data is there, starting from "DATA BEGINS HERE". Is this script copies this data to /usr/local/bin ?**


title: How to identify which application is trying to access the unixbuild server?

text: The error message I am seeing is:               Failed publickey for raj from 10.*.*.** port 34355 ssh2     Mar 18 05:22:34      unixbuild sshd[16956]: [ID 1000034 auth.info] Failed password for raj from 10.*.*.* port 34355 ssh2


title: Read only mode in gdb

text: Is there `gdb` read only mode ? Is there way I can restrict gdb level to read only. So I will not be able to modify current data in gdb. Can gdbserver or any other tool help in this case?


title: Auditing of gdb commands

text: Is there a way I can log all gdb commands executed by a user? And do user level logging? Is any other tool like gdbserver can help in this case ?


title: emacs-nox doesn't load the files I ask it to at command line

text: I have a few different Ubuntu installs and this is the first time I've experienced this. I have `emacs-nox` installed, because I hate graphical versions of emacs. Normally when I type `emacs test.txt` it will load `test.txt` if it exists and load a blank file if it does not exist. Instead, on this machine, it says:               File exists: /home/myusername/.emacs.d/      And loads a blank file, even if it exists. Then when I try to save it, it makes me specify a full path, like I had not told it where I wanted it to save when I called it from the command line. Any thoughts on what might be causing this? I didn't customize my emacs install in any way, and I've tried removing and re-installing the package to no avail. **Edit to add requested details**               user@comp:~$ ls -l ~/.emacs.d     ls: cannot open directory /home/user/.emacs.d: Permission denied     user@comp:~$ sudo ls -l ~/.emacs.d     total 0


title: Reduce the over use of files in text processing

text: Currently, I have a file (`Results.txt`) which has 27k rows. The file content is as below.               45008657        |       A.      |               |       Long    |       0     49210987        |       A.      |               |       Steven  |       3262     49600694        |       A.      |               |       Steven    |       4772     467814  |       A.      |       Rafeal    |       Nadal|       4133     53111047        |       A.      |       Mike    |       Tyson  |       13484      I need to remove the extra white spaces, which am doing like below.               cat Results.txt | tr -d " \t\r" > Results1.txt      The file (`Results1.txt`) is neatly formatted with no extra white spaces.               45008657|A.||Long|0     49210987|A.||Steven|3262     49600694|A.||Steven|4772     467814|A.|Rafeal|Nadal|4133     53111047|A.|Mike|Tyson|13484      Now, I need to convert all the alphabets to lowercase and append columns 2 to 4.               awk 'BEGIN { FS = "|" } ; { print $1"|"tolower($2) tolower($3) tolower($4)"|"$5 }' Results1.txt > Results2.txt      My `Results2.txt` file will look like below.               45008657|a.long|0     49210987|a.steven|3262     49600694|a.steven|4772     467814|a.rafealnadal|4133     53111047|a.miketyson|13484      Is there any way I could accomplish all the above mentioned steps in my initial file (`Results.txt`) itself? I want to reduce over usage of files so that it would be easy for debugging in later stages. **EDIT** : I simply do not want to remove the files once after creating a new file which doesn't seem an elegant solution to me.


title: In bash, how to convert 8 bytes to an unsigned int (64bit LE)?

text: How can I 'read/interpret' 8 bytes as an **unsigned** int _(Little Endian)_?   Perhaps there is a Bash-fu magic conversion for this? UPDATE:   It seems that something got cross-wired in the interpretation of my question. Here is a broader example of what I am trying to do. I want to read the first (and last) 64k of a file. Each 8-byte word is to be interpreted as a 64-bit Little-Endian unsigned integer. These **integers** are to be used in a hashing computation which uniquely identifies the file. So there are a lot of calculations to make, ∴ speed is preferred, but not critical. (Why am I doing it? Because `smplayer` hashes the names of its played-media .ini files, and I want to access, and modify these files, so I am mimicking the smplayer's C++ code in Bash.) A solution which caters to accepting a piped input would be optimal, and is probably essential because of the way Bash variables can't handle \x00.. I realize that something like this is probably better suited to the likes of Python, Perl, and C/C++, but I don't know Python and Perl, and although I could do it in C++, it's been years since I've used it and I'm trying to focus on Bash. Short Perl and Python snippets are good. Bash is preferred (but not at the sacrifice of speed).


title: How to display the server time inside Vim

text: I want to know how to display the server time inside the Vim editor, if possible.


title: A Live CD distro for getting data off a NTFS partition without X Windows

text: The Windows partition on my laptop seems to refuse to boot, and since I lack the original install CD, I was thinking of installing my preferred Linux distro, Arch on it. I want to recover data off the Windows hard drive (and onto my external) first before installing Arch, so I intend to use a Live CD to do so. Both the Windows HD and my external HD are formatted using NTFS. However, the display requires manual configuration in order to use X, which precludes the use of a Live CD that will boot directly into X. What Live CD distros are available that support reading and writing to NTFS (preferably using ntfs-3g) and boot into text mode?


title: How to specify the media directory in MediaTomb

text: I have mediatomb in ubuntu. I have started it with "sudo service mediatomb start", and its process shows in ps. But in the config I cant find where to specify the media directory. I searched the web too, with no luck.


title: Denyhosts: how to always allow certain known users?

text: With Denyhosts, how can I "whitelist" a known good user by username plus the fact that they have a valid RSA keypair (or in combination with some other known fact about the user such as MAC address)? Some background: On a Ubuntu server, denyhosts is blocking some SSH users (but not all) from logging in. The users are all configured exactly the same -- even using the same Linux user account. Every user has an RSA key pair and logs in via keypair only. No password based SSH logins are allowed. (These are automated SSH logins to an update server.) If I add the problematic users's IP addresses to Denyhost's hosts.allow file (and remove the address from any restricted/deny files), the user can login just like the other users. But none of these users have static IP addresses, so this isn't a solution. Given the fact that these users have a valid RSA key and they have a Linux user account, is there a way I can make denyhosts stop blocking them (without weaking its proper functioning, especially for all the would-be attackers who try to log in with invalid passwords)? Update:   I have `PasswordAuthentication no` and `AllowUsers foo@*` in `/etc/ssh/sshd_config` along with the other relevant settings so that my users can only log in with RSAAuthentication. Of course, I could always stop using Denyhosts. But my question is how can I make Denyhosts work the way I intend so I don't have to stop using it.


title: Bad utf8 display with tmux

text: When I press the "é" key multiple times on my keyboard, here is what tmux print (notice the spaces) :               arcanis@~ > é é é é é é é é é é é é é      It also broke emacs when the file contains utf8 characters. My locale is :               arcanis@~ > locale     LANG=en_US.UTF-8     LC_CTYPE="en_US.UTF-8"     LC_NUMERIC="en_US.UTF-8"     LC_TIME="en_US.UTF-8"     LC_COLLATE="en_US.UTF-8"     LC_MONETARY="en_US.UTF-8"     LC_MESSAGES="en_US.UTF-8"     LC_PAPER="en_US.UTF-8"     LC_NAME="en_US.UTF-8"     LC_ADDRESS="en_US.UTF-8"     LC_TELEPHONE="en_US.UTF-8"     LC_MEASUREMENT="en_US.UTF-8"     LC_IDENTIFICATION="en_US.UTF-8"     LC_ALL=      How can I fix this ?


title: zsh doesn't work correctly in Mint

text: I successfully installed zsh, change config on my old, but it's not working properly. I don't know how this feature calls. When i write something - `sudo` for instance, and press ↑ (arrow up) it doesn't searching line with this start text in history, it's just return previous line. this is my zshrc file Of course, the history contains expected lines.


title: Run a dbus program in crontab , how to know about the SESSION id?

text: I need to run some program within crontab , but how can the program know about dbus session id ? it's only available for programs launched by session managers.


title: How to clean a home directory to install from scratch a previously installed distro?

text: I am using linuxmint-10-KDE.   I have several partitions that I will reuse. One of them is `/home`.   This `/home/nomikos` has a lot of gnome related files that I want to delete before install the new linuxmint-12-gnome.   So how could I make some clean in my home directory to achieve the cleanest installation? EDIT1: The main idea of this clean process is don't use old and erroneous configuration files. Maybe deleting some .gnome/ or .gtk directories? EDIT2: Resuming: "I want to keep most of /home intact except for .gnome stuff." (THX @jw013)


title: How to add a GUI to a minimal install of CentOS?

text: I did a minimal install of CentOS 6.3 and now want to add a GUI. I tried using `yum` to install a GUI, but it is unable to resolve the CentOS repository server `mirror.centos.org`. I tried to install networking packages but I get `directory not found` for `/etc`. How can I install and enable Gnome Desktop on CentOS?


title: lsof - age of file

text: The *nix command `lsof` gives you a list of open files. Is anyone aware of a way that would also list how long a particular file has been open? Either by using `lsof` or any other command. I'm using CentOS 5.3 and unfortunately I can't install additional repositories so I'd have to work from the default CentOS repos. Thanks


title: Command-line tool to search docx files

text: Is there a command-line tool to text-search a docx file? I tried `grep`, but it doesn't work with docx even though it works fine with txt and xml files. I could convert the docx to txt first, but I'd prefer a tool that operates directly on docx files. I need the tool to work under Cygwin. OP edit: Later I found out that the easiest way to achieve the grep is actually to convert those docx to txt then grep over them.


title: Unable to install libhighgui-dev package in 11.10

text: I the `libhighgui-dev` package has unmet dependencies in 11.10. what should I do? Synaptic says:               libhighgui-dev:      Depends: libgtk2.0-dev but it is not going to be installed      Depends: libjasper-dev but it is not going to be installed      where               libgtk2.0-dev:      Depends: libgtk2.0-0 (=2.24.6-0ubuntu5) but 2.24.6-0ubuntu5linuxmint1 is to be installed      Depends: libpango1.0-dev but it is not going to be installed      Depends: libcairo2-dev but it is not going to be installed      Recommends: debhelper but it is not going to be installed      and so on.. **Update:** /etc/apt/sources.list:               # deb cdrom:[Ubuntu 11.10 _Oneiric Ocelot_ - Release amd64 (20111012)]/ dists/oneiric/main/binary-i386/          # deb cdrom:[Ubuntu 11.10 _Oneiric Ocelot_ - Release amd64 (20111012)]/ oneiric main restricted          # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to     # newer versions of the distribution.          ## Major bug fix updates produced after the final release of the     ## distribution.          ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu     ## team. Also, please note that software in universe WILL NOT receive any     ## review or updates from the Ubuntu security team.     # deb http://ir.archive.ubuntu.com/ubuntu/ oneiric universe     # deb-src http://ir.archive.ubuntu.com/ubuntu/ oneiric universe     # deb http://ir.archive.ubuntu.com/ubuntu/ oneiric-updates universe     # deb-src http://ir.archive.ubuntu.com/ubuntu/ oneiric-updates universe          ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu      ## team, and may not be under a free licence. Please satisfy yourself as to      ## your rights to use the software. Also, please note that software in      ## multiverse WILL NOT receive any review or updates from the Ubuntu     ## security team.     # deb http://ir.archive.ubuntu.com/ubuntu/ oneiric multiverse     # deb-src http://ir.archive.ubuntu.com/ubuntu/ oneiric multiverse     # deb http://ir.archive.ubuntu.com/ubuntu/ oneiric-updates multiverse     # deb-src http://ir.archive.ubuntu.com/ubuntu/ oneiric-updates multiverse          ## N.B. software from this repository may not have been tested as     ## extensively as that contained in the main release, although it includes     ## newer versions of some applications which may provide useful features.     ## Also, please note that software in backports WILL NOT receive any review     ## or updates from the Ubuntu security team.               ## Uncomment the following two lines to add software from Canonical's     ## 'partner' repository.     ## This software is not part of Ubuntu, but is offered by Canonical and the     ## respective vendors as a service to Ubuntu users.     deb http://archive.canonical.com/ubuntu oneiric partner     deb-src http://archive.canonical.com/ubuntu oneiric partner          ## This software is not part of Ubuntu, but is offered by third-party     ## developers who want to ship their latest software.     deb http://extras.ubuntu.com/ubuntu oneiric main     deb-src http://extras.ubuntu.com/ubuntu oneiric main     deb http://archive.ubuntu.com/ubuntu oneiric multiverse restricted universe main     deb-src http://archive.ubuntu.com/ubuntu oneiric restricted main multiverse universe #Added by software-properties      **2nd update:**               dpkg -l | grep linuxmint      prints:               ii  gir1.2-gtk-2.0                         2.24.6-0ubuntu5linuxmint1                The GTK+ graphical user interface library -- gir bindings     ii  grub-common                            1.99-12ubuntu5-1linuxmint1               GRand Unified Bootloader (common files)     ii  grub-pc                                1.99-12ubuntu5-1linuxmint1               GRand Unified Bootloader, version 2 (PC/BIOS version)     ii  grub-pc-bin                            1.99-12ubuntu5-1linuxmint1               GRand Unified Bootloader, version 2 (PC/BIOS binaries)     ii  grub2-common                           1.99-12ubuntu5-1linuxmint1               GRand Unified Bootloader (common files for version 2)     ii  libgail-common                         2.24.6-0ubuntu5linuxmint1                GNOME Accessibility Implementation Library -- common modules     ii  libgail18                              2.24.6-0ubuntu5linuxmint1                GNOME Accessibility Implementation Library -- shared libraries     ii  libgtk2.0-0                            2.24.6-0ubuntu5linuxmint1                The GTK+ graphical user interface library     ii  libgtk2.0-bin                          2.24.6-0ubuntu5linuxmint1                The programs for the GTK+ graphical user interface library     ii  libgtk2.0-common                       2.24.6-0ubuntu5linuxmint1                Common files for the GTK+ graphical user interface library     ii  libgtk2.0-dev                          2.24.6-0ubuntu5linuxmint1                Development files for the GTK+ library     ii  libplymouth2                           0.8.2-2ubuntu28-1linuxmint2              graphical boot animation and logger - shared libraries     ii  libyelp0                               3.2.0-0ubuntu1-1linuxmint1               Library for the GNOME help browser     ii  plymouth                               0.8.2-2ubuntu28-1linuxmint2              graphical boot animation and logger - main package     ii  plymouth-label                         0.8.2-2ubuntu28-1linuxmint2              graphical boot animation and logger - label control     ii  plymouth-theme-ubuntu-logo             0.8.2-2ubuntu28-1linuxmint2              graphical boot animation and logger - ubuntu-logo theme     ii  plymouth-theme-ubuntu-text             0.8.2-2ubuntu28-1linuxmint2              graphical boot animation and logger - ubuntu-logo theme     ii  python-software-properties             0.81.13.1-1linuxmint3                    manage the repositories that you install software from     ii  software-properties-common             0.81.13.1-1linuxmint3                    manage the repositories that you install software from (common)     ii  software-properties-gtk                0.81.13.1-1linuxmint3                    manage the repositories that you install software from (gtk)     ii  unity-greeter                          0.1.1-1linuxmint1                        Unity Greeter     ii  usb-creator-common                     0.2.34-1linuxmint1                       create a startup disk using a CD or disc image (common files)     ii  usb-creator-gtk                        0.2.34-1linuxmint1                       create a startup disk using a CD or disc image (for GNOME)     ii  yelp                                   3.2.0-0ubuntu1-1linuxmint1               Help browser for GNOME


title: How do I make my USB Bluetooth dongle work? (Can't init device hci0: Connection timed out (110))

text: I have a USB bluetooth dongle:               root@maiko-cce-lin:~# lsusb | grep Bluetooth     Bus 001 Device 007: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)      It rarely works, and when I do get it to work it stops working when I reboot. It isn't software blocked:               root@maiko-cce-lin:~# rfkill list     0: phy0: Wireless LAN         Soft blocked: no         Hard blocked: no     1: hci0: Bluetooth         Soft blocked: no         Hard blocked: no      My device is recognized by `hciconfig`               root@maiko-cce-lin:~# hciconfig -a     hci0:   Type: BR/EDR  Bus: USB         BD Address: 00:1F:81:00:01:1C  ACL MTU: 1021:4  SCO MTU: 180:1         DOWN          RX bytes:330 acl:0 sco:0 events:8 errors:0         TX bytes:24 acl:0 sco:0 commands:30 errors:22         Features: 0xff 0x3e 0x09 0x76 0x80 0x01 0x00 0x80         Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3          Link policy:          Link mode: SLAVE ACCEPT       but I can't turn on my hci interface:               root@maiko-cce-lin:~# hciconfig hci up     Can't init device hci0: Connection timed out (110)      I don't understand why; the `hcitool` command doesn't show any devices:               root@maiko-cce-lin:~# hcitool dev     Devices:      I've tried to restart my bluetooth service too with this command (and then repeated all the previous commands again) but it didn't work:               root@maiko-cce-lin:~# service bluetooth restart      * Stopping bluetooth                                                    [ OK ]       * Starting bluetooth                                                    [ OK ]      root@maiko-cce-lin:~#       What could be wrong?


title: Why is mono-complete completely outdated on all versions of Debian?

text: The current stable Debian 7/Wheezy is running on my server.   With `apt-get` the latest mono version I can get is 2.10 which is three years old.   I looked up the mono-complete package and even on unstable Debian 9/Sid all you get is version 3.2.8, when the latest stable version is 3.6 and 3.8.1 is available. I have two questions:   1. **Is there a way to get an at least somewhat recent version of mono with`apt-get`?** Following a guide to install the latest mono was rather uncomfortable to me and I dread the next time I want to do an update.    2. **Why are only those horribly outdated packages available (even on unstable, future versions of Debian), when there are new, stable versions that are years ahead?**


title: Script to ssh and run a command doesn't work

text: Below is the script. I wanted to login several servers and check for the kernel version.               #!/bin/bash     #input server names line by line in server.txt     cat server.txt | while read line     do     sshpass -p password ssh root@$line << EOF     hostname     uname -r     EOF     done      I would expect output which goes like..               server1_hostname     kernel_version     server2_hostname     kernel_version      and so on.. I ran this script with about 80 servers in server.txt And the output i got was like.....               Pseudo-terminal will not be allocated because stdin is not a terminal.      Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.          ========================================================================     ================================ WARNING ===============================     ========================================================================     This system is solely for the use of authorized personnel. Individuals     using this system are subject to having some or all of their activities     monitored and recorded. Anyone using this system expressly consents to     such monitoring and is advised that any unauthorized or improper use of     this system may result in disciplinary action up to and including     termination of employment. Violators may also be subject to civil and/or     criminal penalties.     ========================================================================          Warning: no access to tty (Bad file descriptor).     Thus no job control in this shell.     xxxxdev01     2.6.32-431.23.3.el6.x86_64     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.     Pseudo-terminal will not be allocated because stdin is not a terminal.      Here I got output for only 1 host, which is `xxxxdev01` and that too comes with the ssh banner and other warning. I need output of all other hosts and without ssh banner.. What is going wrong here?


title: What's the cleanest way to schedule autoexec.bat like command in Linux?

text: I want to create a small script for my Linux system that would do some simple things on PC boot. The script is most likely going to be Python, but maybe I'll resort to C or shell. The problem is that I'm a Windows developer, and the tutorials on the web look suspicious. Some of them close all file descriptors, some don't, some implement restart, force-restart, some don't. With later ones seemingly being against the spec. Then there is the whole gid thing, that confuses me. So basically, I don't know which script base I can use for a stable daemon, and which ones are works-on-my-machine-so-it's-correct type. Then I stumbled upon http://manpages.ubuntu.com/manpages/hardy/man1/daemon.1.html which seems to be an official process that creates daemons, SAFELY. But then again, it's scripts in init.d that do the start-up, if I understand correctly, not existing processes. Then there is "nice" which should be used for long running tasks, if I got it right, and probably some other gotchas. So I'm lost here. Can anyone give me a few warnings, don'ts and maybe an idea where to look for the information online? P.S. The script I'm going to call will have to call processes, does that mean the daemon will fork for each of them?


title: What are the settings to correct vsftpd "500 OOPS: cannot change directory" error?

text: My question is what settings do I need to change and/or commands to run to allow me to log into my vsftpd system? I am getting this error, when I login using ftp instead of sftp:               Name (localhost:dbadmin): dbadmin     331 Please specify the password.     Password:     500 OOPS: cannot change directory:/home/dbadmin     Login failed.     ftp>       This works when logging in using `sftp@`, but my server is behind a firewall, and I need to be able to login using ftp as well as sftp. I have been looking at quite a few posts about the "OOPS" error but so far have had no luck logging in. Here is some information about my system and settings: I am running CentOS 6.4. iptables and ip6tables are stopped and disabled. My home directory is protected 700, and I have tried 750, just to see if that made a difference. It did not. Here are the active lines in `/etc/vsftpd/vsftpd.conf`               anonymous_enable=NO     local_enable=YES     write_enable=YES     local_umask=022     dirmessage_enable=YES     xferlog_enable=YES     connect_from_port_20=YES     xferlog_std_format=YES     listen=YES     pam_service_name=vsftpd     userlist_enable=YES     tcp_wrappers=YES      My login name is not in user_list.


title: Break a large file into smaller pieces

text: How do I break a large, **+4GB** file into smaller files of about **500MB** each. And how do I **re-assemble** them again to get the original file?


title: Procmail: Denying special privileges for "/etc/procmailrcs/default.rc"

text: I'm trying to setup postfix, dovecot and procmail to work together with virtual users. In the end I want to have virtual users and the possibility to add rules to sort incoming rules. For the last thing, I need procmail (right?). When I send an email to my server, I don't get it in my Maildir, and see this in mail.log:               Jun 17 21:01:03 cs postfix/smtpd[24811]: connect from dub0-omc2-s13.dub0.hotmail.com[157.55.1.152]     Jun 17 21:01:03 cs postfix/smtpd[24811]: D8C9F44D88: client=dub0-omc2-s13.dub0.hotmail.com[157.55.1.152]     Jun 17 21:01:03 cs postfix/cleanup[24816]: D8C9F44D88: message-id=<DUB115-W85D8D79486AEC1D4346693C0830@phx.gbl>     Jun 17 21:01:04 cs postfix/qmgr[24806]: D8C9F44D88: from=<my-test-email>, size=1617, nrcpt=1 (queue active)     Jun 17 21:01:04 cs procmail[24818]: Denying special privileges for "/etc/procmailrcs/default.rc"     Jun 17 21:01:04 cs postfix/smtpd[24811]: disconnect from dub0-omc2-s13.dub0.hotmail.com[157.55.1.152]     Jun 17 21:01:04 cs postfix/pipe[24817]: D8C9F44D88: to=<my-virtual-email>, relay=virtualprocmail, delay=0.18, delays=0.15/0/0/0.02, dsn=2.0.0, status=sent (delivered via virtualprocmail service)     Jun 17 21:01:04 cs postfix/qmgr[24806]: D8C9F44D88: removed      How can I fix the line "Denying special privileges" procmail spits out?               camilstaps@cs:/# ls -al /etc/procmailrcs     total 12     drwxr-xr-x  2 root  vmail   4096 Jun 17 19:48 .     drwxr-xr-x 97 root  root    4096 Jun 17 19:47 ..     -rw-------  1 vmail postfix   44 Jun 17 19:48 default.rc      Here's my `/etc/postfix/master.cf`:               smtp      inet  n       -       -       -       -       smtpd     submission inet  n       -       n       -       -       smtpd     pickup    unix  n       -       -       60      1       pickup     cleanup   unix  n       -       -       -       0       cleanup     qmgr      unix  n       -       n       300     1       qmgr     tlsmgr    unix  -       -       -       1000?   1       tlsmgr     rewrite   unix  -       -       -       -       -       trivial-rewrite     bounce    unix  -       -       -       -       0       bounce     defer     unix  -       -       -       -       0       bounce     trace     unix  -       -       -       -       0       bounce     verify    unix  -       -       -       -       1       verify     flush     unix  n       -       -       1000?   0       flush     proxymap  unix  -       -       n       -       -       proxymap     proxywrite unix -       -       n       -       1       proxymap     smtp      unix  -       -       -       -       -       smtp     relay     unix  -       -       -       -       -       smtp     showq     unix  n       -       -       -       -       showq     error     unix  -       -       -       -       -       error     retry     unix  -       -       -       -       -       error     discard   unix  -       -       -       -       -       discard     local     unix  -       n       n       -       -       local     virtual   unix  -       n       n       -       -       virtual     lmtp      unix  -       -       -       -       -       lmtp     anvil     unix  -       -       -       -       1       anvil     scache    unix  -       -       -       -       1       scache     maildrop  unix  -       n       n       -       -       pipe       flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}     uucp      unix  -       n       n       -       -       pipe       flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)     ifmail    unix  -       n       n       -       -       pipe       flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)     bsmtp     unix  -       n       n       -       -       pipe       flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient     scalemail-backend unix  -       n       n       -       2       pipe       flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}     virtualprocmail unix - n n - - pipe flags=DRXhuq user=vmail       argv=/usr/bin/procmail -m E_SENDER=$sender E_RECIPIENT=$recipient ER_USER=$user ER_DOMAIN=$domain ER_DETAIL=$extension NEXTHOP=$nexthop /etc/procmailrcs/default.rc     mailman   unix  -       n       n       -       -       pipe       flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py       ${nexthop} ${user}      I'm on Ubuntu Server 13.04.


title: Parse a dragged path from a remote machine

text: I am writing an application that needs to be able to parse a path that is dragged from a remote server onto the command line. However, when I drag a path from a remote machine to the terminal I get something that looks like the following: `/home/user/.gvfs/sftp for Name on server-alias/the/full/path/is/here.file`. I would like just `/the/full/path/is/here.file` to be parsed. I was wondering if there's a setting I can tweak to prevent this extra path prefix (preferable) or if there's some built in functionality somewhere in linux to do this. I can of course use regexs to parse this, but I would like to avoid that if possible. I'm on ubuntu 10.04 LTS.


title: Mounting Windows share on startup without storing password in plain text

text: I have the following in my `/etc/fstab` on a Red Hat 5 system:               //share/folder /mnt/folder cifs username=<my username>,password=<my password>,ro,soft,nounix      Can I replace this with something that will still mount `//share/folder` on my Linux box on startup without storing my plain text password in fstab?


title: Tab completion when `patch` asks for filename

text: When the patch command doesn't find the file to patch, it asks for a filename. Is there any way to get this to use tab complete?


title: Screen doesn't always shut off on its own

text: It seems like when I have certain web pages focused, my screensaver will kick in, but the screen won't turn itself off. Does anyone have any ideas why this might be? Is there a way to disable whatever is keeping DPMS from kicking in?


title: How to reboot/shut down gracefully in Awesome WM?

text: My current configuration uses               kdesu shutdown -[rh] now      to reboot/shut down. The entire shutdown procedure takes about 1-2 seconds. But after every boot Firefox says it was shut down prematurely, very likely indicating that it was brutally murdered rather than laid to rest. How do I configure a "normal" WM shutdown procedure (something like `kill -SIGTERM && sleep 10 && kill -SIGKILL`, but preferably using **an existing tool** ) in Awesome WM? Related question for GDM.


title: Supervisord does not work

text: Kinda shocked about supervisor. I get this error               unix:///var/run/supervisor.sock no such file      What is so shocking is the file is there! I am running on ubuntu on ec2. I tired to chmod to 0777 as well.               [supervisord]     logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log)     logfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)     logfile_backups=10          ; (num of main logfile rotation backups;default 10)     loglevel=debug               ; (log level;default info; others: debug,warn,trace)     pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)     nodaemon=false              ; (start in foreground if true;default false)     minfds=1024                 ; (min. avail startup file descriptors;default 1024)     minprocs=200                ; (min. avail process descriptors;default 200)          [supervisorctl]     serverurl=unix:///var/run/supervisor.sock          [include]     files = *.supervisor


title: Querying Microsoft SQL SERVER 2008 from Linux

text: Basically I want to write all the lines of a text file present in linux machine to Microsoft SQL server database. I need a shell script to connect from my Linux machine to a remote Microsoft SQL Server (2008) database and do insertion. How do I do this?


title: Linux Booting with USB File System

text: I'm trying to boot a Linux system stored in a USB drive that I got by following the Linux from Scratch manual. I finished all but the booting part, the problem is that when the kernel tries to to mount the file system the USB drive is not part of the options, only the hard drive. I suppose USB and other storage systems are enumerated in `/dev` only after the file system is mounted. Is there a workaround so I can mount the filesystem from a USB drive? Even if is necessary to patch the kernel source. EDIT: Sorry about the lack of information. I'm using Grub2 as bootloader I'm using sysvinit (Kernel never launch it) It's an MBR partition, I'm using PARTUUID=000337f3-01 in as root. It works in a QEMU machine To setup ramdisk I just do initrd /bzImage Yes I've build udev


title: mkreiserfs block size limit other than in man / info page?

text: I have tried to format a partition on an USB pendrive with `mkreiserfs 3.6.21` as follows: `mkreiserfs --block-size=2048 /dev/sdb1` Which resulted in > Block sizes smaller than 4k are not supported. Interesting, because both `info` and `man mkreiserfs` describe as possible block size: > `-b | --block-size N`   >  N is block size in bytes. It may only be set to a power of 2 within the > 512-8192 interval. So I tried it from the other end: > `mkreiserfs /dev/sdb1 --block-size=8192` and got: `Block sizes larger than 4k are not supported on all architectures`. A bit picky, aren't we… Working with Linux `3.2.0-4-amd64` kernel I've tried the same as before in combination with the `\--format` option. Same results. ## Question _What am I doing wrong?_ Some ideas I came across:   * bad idea to create this on an USB device   * _problem is located in the compiled version of`mkreiserfs`?_   * ( _bug in documentation_?) Yes, I know that `reiser4` was created to replace `reiserfs` and it isn't very common anymore (or could I say " _is defunct_ "?). * * * Having little to no idea about `.h` files but at least willing to try to find anything informative, I found this in `/usr/include/linux/reiserfs_fs.h` - not helpful but worth sharing, I guess: ![enter image description here](http://i.stack.imgur.com/94Dz5.png)


title: how to enable java support to buildroot

text: I'm using buildroot 2012.08 version for building embedded linux. I'm looking for best solution to add java support. Is it possible to do trough buildroot?


title: php shell_exec() permission on Linux Ubuntu

text: I'm developing a php application using Linux server. My problem is executing `shell_exec()` to call some exe file is not work(actually not exe, it's kind of linux executable file)               echo shell_exec("whoami");      I got daemon               echo shell_exec("ls")      I got some filename but               echo shell_exec("php -v")      I got nothing, a blank page               echo shell_exec("php ....bla bla bla")      a blank page too. All these command if I type on terminal(user hu) will works. I have searched google for several hour, people says that because of permission. I don't have experience on Linux. What do I have to do to execute my program in php?


title: Cloning ChromiumOS source code

text: I try to compile ChromiumOS, following the documentation. I am in the _Get source code_ section. I get the following error:               ionicabizau@desktop:~/chromiumos$ repo init -u https://chromium.googlesource.com/chromiumos/manifest.git --repo-url https://chromium.googlesource.com/external/repo.git     gpg: keyring `/home/ionicabizau/.repoconfig/gnupg/secring.gpg' created     gpg: keyring `/home/ionicabizau/.repoconfig/gnupg/pubring.gpg' created     gpg: /home/ionicabizau/.repoconfig/gnupg/trustdb.gpg: trustdb created     gpg: key 920F5C65: public key "Repo Maintainer <repo@android.kernel.org>" imported     gpg: key 692B382C: public key "Conley Owens <cco3@android.com>" imported     gpg: key 18275935: public key "Stefan Zager <szager@chromium.org>" imported     gpg: Total number processed: 3     gpg:               imported: 3  (RSA: 2)          fatal: Cannot get https://chromium.googlesource.com/a/external/repo.git/clone.bundle     fatal: HTTP error 401      What should I do? I guess it's an authentication related error, but I don't know how to fix it. I followed _Gerrit credentials setup_ as well:               $ git ls-remote https://chromium.googlesource.com/a/chromiumos/manifest.git     a226dafd79b161cf8e0881e8c184d558922a6f9b    HEAD     64a43418102660d49d1495cac84a45dc86ea5f55    refs/cache-automerge/b3/ff98a1dc9a5fbd02c3be8dc123e54ee4be8ae6     d8a75f0e8ae0d2e50af36b57f4fbb7a1ce0136a8    refs/changes/00/14300/1     2e5f4cbebda72439dd1b687dc3da28605f14b28c    refs/changes/00/202700/1     f35774fbbb56174bdf5fa7158025a6a5de04dec9    refs/changes/00/202700/2     9c7ae471a7c5dca20498a3fe883d44d09fe3e2b5    refs/changes/00/202700/3     6da65383e2cc8514d03d286b31b818402c8dcb6e    refs/changes/01/16201/1     ab376eb89c8d77d016750ffdcfdead3261fb4df0    refs/changes/01/188501/1     ed73419dab624c4962b94a5539897fe7428d25f8    refs/changes/01/188501/2     7c75676f9f5551774c1ba48cbd00813738ae515b    refs/changes/01/22101/1     ...


title: What are all of the linux distros?

text: I am running Ubuntu currently, but I want to try other linux distros. I am not bored of Ubuntu, but I want to try as many Linux distros as I can. So if anyone knows of a Linux OS just post the name and if you want, you can post a link.


title: How to modify iptables rules via editing a file rather than interacting via command line?

text: In the history, i would simply edit a file and then   reboot the whole server. i would clone the line that had port 22 open   change it to 80 and then save the file.. and reboot   the whole system so the iptables would start with port 80 open. but in the recent times.. that file is no longer in existent   in my centos 6.5 O.S. most answers on google suggest i must interact with iptables   in order to enable and disable ports. is it possible to not interact with iptables but rather   just see everything infront of you as one editable file ?


title: couldn't ping router, although it offered an IP-address

text: I've installed Linux Mint 16 on my HP envy 6. It activated automatically the proprietary driver, which recognized the WiFi interface and called it eth1.   I could connect to my router, I get the IP address 192.168.0.100, but I'm still not able to get an internet connection, or ping the routers IP. ### Questions   * What could be a solution for that problem?   * Is the power management of the interface a problem? Output of `traceroute` and `ip route show`:               $ traceroute 8.8.8.8       traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets       1 * * *       2 * * *       3 * * *       4 * * *       5 * * *       6 * 72.14.238.153 (72.14.238.153) 399.087 ms *       7 * * *       8 * * *       9 * * *       10 * * *       11 * * * 12 8.8.8.8 (8.8.8.8) 261.041 ms 260.956 ms *           $ ip route show       default via 192.168.0.1 dev eth0 proto static       192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.112 metric 1       192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.100 metric 9


title: How do i remove all occurences of semicolon from the end of all lines?

text: These are the steps i am following.               `sed 's/[;]+$//g'`      also                 sed 's/;{1,\}$//g'


title: /etc/sysconfig/iptables : how to block everything except for port 80 and 22?

text: My new centos 6.5 cloud server came with this               /etc/sysconfig/iptables      inside we have:               # Generated by iptables-save v1.4.7 on Mon Jun 16 20:04:05 2014     *filter     :INPUT ACCEPT [8:607]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [6:1089]     COMMIT     # Completed on Mon Jun 16 20:04:05 2014      but it looks like regardless if i stop or start iptables.. other ports remain open. i know this because i installed things such as webmin which was working fine on port 10000 and i also added a port to httpd.conf                listen 81      as well as a virtual host for port 81. it all works regardless of if iptables is started or stopped. which means this above iptables file i have needs modifications. i would like to disable all ports except for port 80 and 22 from there on i can test and add other ports myself.


title: "No space left on device" - plenty of space and inodes left

text: I am using amazon linux on an ec2 instance. I am running a cron script as root that copies files to a different directory on the same machine, but some of the file copies are failing with a "no space left on device" error. The files are only about 65M and there is about 3G of free space and only 7% inode usage. When I copy the files manually from the command line as root, it works fine. What could the problem be?


title: Users home path in a bash script

text: I'm writing a bash-script that will be run as a cron job everyday. Very basic, I was wanting to change the wallpaper daily. I have mint-14 with mate. The thing I'm getting caught up on right now is, I want to have the user's home path detected automatically. If I don't do this I would have to change it for all other users that run the script. So far I have tried:               homedir=${HOME}/Pictures/daily          mateconftool-2 -t string -s /desktop/mate/background/picture_filename $homedir;      This doesn't work but,               echo $homedir      Prints out the correct path? EDIT: When I tried `~user` like @vonbrand was suggesting there is no difference.               mateconftool-2 -t string -s /desktop/mate/background/picture_filename ~user/Pictures/daily;


title: 3G-modem for Linux supporting USB 3.0

text: I've laptop with three USB3.0-ports.OS is Linux Mint 13 (yeah, it's Ubuntu- based). My modem **Huawei E1552/E1800** could work in two modes: 1) as flash with drivers 2) modem The device is operating as modem and seen in _Network Manager_ if only it's attached before OS loading. If after, it's detected as flash. The all mine attempts and games with _usb_modeswitch_ are in vain and wasn't came to good. So I would like to ask if there are such modems' model (it's not important what the manufucturer is): 1) that has single operating mode (modem) or 2) if it supports 2 modes, I'll be able to swich device into the mode without much hassle.


title: how to code c++ via ssh with Vim or Vi?

text: Would I have to rent and configure a server or something? I'm sort of new to unix, but when I was in school I had this nifty setup where I could ssh from any terminal in linux or mac or putty in windows and point it to an address like               ssh pc7.cs.nameofschool.edu      then I would be taken to my own directory in their cloud where I could code and save files and make directories. it was like my personal console that I could access from anywhere. they had redhat installed as i recall and they had access to gcc as well as g++ compilers which was awesome! How do I do this now that I am out of school and they deleted my files! I'd rather not spend any money on it but if it weren't too outrageous I would consider it. Thanks! I'm not too advanced a programmer but I am sort of trying to get back into it and it would be nice to be able to access an IDE/compiler from anywhere. Thanks!


title: Why to use Kali Linux instead of "Ubuntu with Kali Tools"?

text: There are a lot of tutorials which show how to install Kali Linux's tools on Ubuntu distros. So I was wondering, why do pen-testers use Kali instead of Ubuntu? while it's more reliable & fancy than Kali. What are the pros of working on Kali?


title: Could I set flag "barrier=0" when using SSD?

text: I'm using ext4 filesystem in SSD,when mounting SSD,could I use flag "barrier=0"? I knew this flag is safe for BBU（battery backup unit）,but is it safe for SSD?


title: Essential tasks of a routing daemon in Linux

text: What I have understood so far from some software router projects already there (e.g. bird), there are some essential subtasks for routing in Linux. Task 1: Get a routing table first (using `ip route` or `RTM_GETROUTE`) and then Listening to routing table changes using `netlink route sockets (nl_groups = RTMGRP_IPV4_ROUTE)`. Task 2: Listen to routing updates on certain TCP/UDP port number designed for the specific routing protocol, include/delete routes from table as per update. **Q1** : Can it be done in a single daemon? `YES, Answered by Ulrich already` **Q2** : Is there any other necessary task to be done to make this system behave as a proper router(may be deleting some routes periodically if no updates endorse them etc., or anything else I missed)?


title: groupadd failure while writing changes to /etc/group

text: I have been following this guide on installing debian-kit on my Sony Xperia Tablet Z and the installation goes fine until I try to `apt-get install andromize` which fails with the error `groupadd: failure while writing changes to /etc/group`. I also get the same message if I try to add a user with `adduser`. I have partitioned my external SD card to 10gb FAT32 and 20GB ext2 and used the `mk-debian -i /dev/block/vold/179:37` which is the correct partition. If I look in `/etc/` I can see that there are additional files called `group-` and `passwd-` as well as `group` and `passwd` but I have no idea if this is relevant. I'm logged in as root and the partition is loaded readwrite because all other apt-get installs work, it just fails on any that modify the users / groups. `ls -l /etc/group` returns the following...               -rw-r--r--. 1 root root 476 Jul17 19:13 /etc/group


title: How does stack allocation work in Linux?

text: Does the OS reserve the fixed amount of valid virtual space for stack or something else? Am I able to produce a stack overflow just by using big local variables? I've wrote a small `C` program to test my assumption. It's running on X86-64 CentOS 6.5.               #include <string.h>     #include <stdio.h>     int main()     {         int n = 10240 * 1024;         char a[n];         memset(a, 'x', n);         printf("%x\n%x\n", &a[0], &a[n-1]);         getchar();         return 0;     }      Running the program gives `&a[0] = f0ceabe0` and `&a[n-1] = f16eabdf` The proc maps shows the stack: `7ffff0cea000-7ffff16ec000. (10248 * 1024B) ` Then I tried to increase `n = 11240 * 1024` Running the program gives `&a[0] = b6b36690` and `&a[n-1] = b763068f` The proc maps shows the stack: `7fffb6b35000-7fffb7633000. (11256 * 1024B) ` `ulimit -s` prints `10240` in my PC. As you can see, in both case the stack size is bigger than which `ulimit -s` gives. And the stack grows with bigger local variable. The top of stack is somehow 3-5kB more off `&a[0]` (AFAIK the red zone is 128B). So how does this stack map get allocated?


title: Instability of debian graphics

text: I have done some googling but am unable to find the cause of this problem. I'm using a fresh copy of Debian 7.1 and shortly after, using the machine will start rendering graphics improperly and spit out a whole lot of entries (below) to syslog. I'm wondering if I should try using a different kernel? Currently using 3.2.0-4-686-pae               [drm:drm_gem_create_mmap_offset] *ERROR* failed to allocate offset for bo 0     [drm:drm_gem_create_mmap_offset] *ERROR* failed to allocate offset for bo 0     [drm:drm_gem_create_mmap_offset] *ERROR* failed to allocate offset for bo 0


title: vnc server setup in RHEL machines

text: ## Lab setup I recently setup a lab with 10 RHEL machines for big data computation using _Map/Reduce_ frameworks. The lab was setup in a closed network in such a way that all the machines had static IP addresses assigned to them. They were connected through the switches to the router and the router was used as the default gateway to communicate with the outer world. ## Ten Machines - One monitor I had one monitor for all the 10 machines. During installation of the machines, I had to constantly switch between the machines by unplugging the monitor from one machine and connecting it to the other machine. Is there an easy solution so that I can view all the machines using the single desktop? I need some solution like `ssh` which will enable me to view the desktops of all the machines using a single monitor.


title: cumulative totals with shifted column

text: Apologies in advance since I am sure this is an easy problem. Nevertheless, here goes.               cat blah.txt     aa+2     bb+4     cc+10     dd+31      I would like to process blah.txt to produce the folowing:               aa+0     bb+2     cc+6     dd+16      The notion here is that the first column might be a list of songs, and the second their start times. My hunch was to do this using awk. I thought of two arrays with numeric indices storing $1 and the running total of $2. My idea was to shift the numeric index for the running totals by 1.               tail -r blah.txt |      awk -F "+" '{ for(i=0;i<=NR;i++) arr[i+1]+=$2; farr[i]=$1 } END      { for(i=NR+1;i>1;i--) {if (i==NR) {print farr[NR] FS 0 }      else { print farr[i] FS arr[i]}}}'      This isn't concise, and what's more doesn't work. I am befuddled by the failure of the array making above all. Anyway, 'nuf said, could some kind person please put me out of my misery ? Tom


title: SOLVED: KVM Can't Read Keymap File on Ubuntu 14.04

text: When I try to create a KVM domain with virt-install on Ubuntu 14.04, I get the following message:               ERROR    internal error: process exited while connecting to monitor: Could not read keymap file: 'en-us'      When I look at the /usr/share/qemu/keymaps folder, there is a file named en- us. However, after looking up this error, I noticed that most errors had a full path, like "/usr/share/qemu/keymaps/en-us", while my error had a relative path. Could this be a configuration error somewhere? **UPDATE:** I think I've narrowed this problem down to virt-install, as I was able to successfully create a virtual machine earlier with qemu-system-x86_64. **SOLVED:** I solved this issue by purging every package that related to qemu, xen, or virt-install and then reinstalling those packages.


title: What's the {} in find /path/ -exec command '{}' do?

text: I'm curious as to what the {} in the following command is actually for? **Example Command:** `find /foo/ -name "*.txt" -exec rm -v {} \;` The Man page provided a small blurb but it confused me a little bit: > The string '{}' is replaced by the current file name being processed > everywhere it occurs in the arguments to the command, not just in arguments > where it is alone, as in some versions of find.


title: Linux (3.4) SSD swap partition usage causes extreme latency - how to eliminate?

text: I'm running on 4G RAM with an extra 6G swap partition, SSD is a pretty decent SAMSUNG MZMPA128HMFU model. System responds very well to workloads when things stay in RAM, but as soon as things reach the swap partition in any meaningful quantity (let say 1GB+ swap used), responsiveness goes completely down the drain during swapping episodes. SSD light stays on for several seconds while apparently loads of stuffs get paged in or out, during this all other IO is blocked. I've seen system load jump from 0.8 to 10 in a few seconds, then drop back down as IO gets going again. When swap is in active use (I keep a bunch of big apps open) these gagging swap episodes happen more and more often as uptime increases (at 26 days now). I am looking at latencytop, but it isn't telling me much I could go on. There seems to be no other solution at this point than stop enough apps to be able to do swapoff -a and just stop using swap. Not sure how this affects my usage patterns, I'm almost certain it's going to be enough for the set of apps I regularly run. Turning vm.swappiness down to 1 doesn't help things. At least not by itself. Is this some well known thing? What are my options to have decent desktop responsiveness while using virtual memory?


title: What's the best way to list size of / in Terminal?

text: I want to see how much total space `/` is taking, but I don't know how to do that. I can use `ls -hal` and add up the subtotals, or I can use `fdisk` to tell me the size of that partition, but is there a better way?


title: Configuring OpenVPN to share internet

text: my university is providing OpenVPN to provide public internet IP address for students (for some libraries etc.) - in other words, they are sharing their internet connection via openVPN... I would like to do same thing in my home server, but I have no idea, how to configure it... I've finished first 13 points following the manual ( http://fedoraproject.org/wiki/Openvpn ). But have no clue, what should be in server.conf and how to set fedora 17 firewall (propably iptables). Server has one interface `em1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500` which has private network address (192.168.20.0/24). NAT router is configured to send all incoming traffic to the server (DMZ). Can somebody send me simple example of OpenVpn server and client config file, to share internet -> when somebody connect to my OpenVPN, he can access internet services in his computer with my IP address? Many thanks


title: Missing/broken dependancies on OpenSUSE, normal?

text: Re-installing our little LAMP server at work, a bit tired of Ubuntu server so I had a look around and decided on OpenSUSE, nicely supported, well maintained blah blah however pretty much every package I try to install seems to have missing dependencies. I'm trying to get apache2 and it's various modules like PHP and docs etc... installed but I'm constantly hitting missing dependencies using both YaST and zypper. I am well aware of how to resolve them but in truth I shouldn't have to and I just can't be bothered. Perhaps I'm a terrible human being but is this a result of bad install/config somewhere or is this normal for OpenSUSE? In terms of repos _zypper lr -d_ tells me that all the standard repos (non- oss, repo-oss, update, update-non-oss) are all enabled, only the source and debug repos are disabled. Never used OpenSuse before so I am likely missing something here, any pointers on getting repos that actually work/have better dependencies? ------------------------ Edit 1 --------------------------------               Loading repository data...     Reading installed packages...     Resolving package dependencies...          Problem: apache2-mod_php5-5.4.20-12.1.x86_64 requires php5 = 5.4.20, but this requirement cannot be provided       uninstallable providers: php5-5.4.20-1.2.x86_64[openSUSE-13.1-1.10]                        php5-5.4.20-1.2.i586[repo-oss]                        php5-5.4.20-1.2.x86_64[repo-oss]                        php5-5.4.20-12.1.i586[repo-update]                        php5-5.4.20-4.1.i586[repo-update]                        php5-5.4.20-8.2.i586[repo-update]                        php5-5.4.20-12.1.x86_64[repo-update]                        php5-5.4.20-4.1.x86_64[repo-update]                        php5-5.4.20-8.2.x86_64[repo-update]      Solution 1: deinstallation of patterns-openSUSE-minimal_base-conflicts-13.1-13.6.1.x86_64      Solution 2: do not install apache2-mod_php5-5.4.20-12.1.x86_64      Solution 3: do not install apache2-mod_php5-5.4.20-12.1.x86_64      Solution 4: break apache2-mod_php5-5.4.20-12.1.x86_64 by ignoring some of its dependencies          Choose from above solutions by number or cancel [1/2/3/4/c] (c):       Repeat for _zypper in php5_ except it needs _smtp_daemon_ which then gives a conflict with an existing mail daemon installed with the base OS. Can't remember the last time I had to deal with dependency issues! * * *


title: A Linux OS as Single Display Groupware

text: For use in extreme programming environments, the idea of single display groupware has become rather interesting. I understand that applications need to be retooled in order to function as single display groupware in themselves. However, there is another idea that is worth considering, and I was wondering how involved it would be to develop this for Linux or if something like this already exists.   1. Applications themselves do not need to be tooled to operate as single display groupware   2. Multiple mice and multiple keyboards are to be plugged into USB drives   3. Each mouse is internally paired with a keyboard by the OS to coordinate the relationship of a separate user with their mouse and keyboard   4. Each mouse is given a unique colored cursor on the screen in the OS desktop environment   5. Each mouse/keyboard/cursor is associated with a separate human being that we will call a "user" (does NOT have to be a "system" user, but it can)   6. When a user clicks on an application window, that user "steals" focus for that application   7. When a user has focus for an application, the OS channels that user's mouse and keyboard as the input controls for that application   8. Focus can be "stolen" by any user at any time for an application by simply clicking on that application window   9. The desktop environment can be extended to multiple displays (as is typical for multi-screen setups), and this ability for users to "steal" application focus should continue to work across these multiple displays What would be involved to see something like this become a reality for Linux?


title: Developing an interactive backup script for end users

text: I need help with the following: cmd/script to specify directory to be backed up


title: Apply image perspective through batch mode in gimp

text: I need to perform image perspective operation from command line? Is there any place where documentation is provided properly. I have asked this question on stack overflow, you can check here. If any other tool is available which provides command line interface to do same thing then it will also good for me.


title: when "DirectoryIndex 1" in "httpd.conf" SOMETIMES & at random i see "/1 not found" error on the web

text: In my `httpd.conf`, I have written `DirectoryIndex 1` above the virtual hosts section. Randomly (1 incident of 100-200 browser refreshes) I see a message on the web browser:                /1 is not found on this server      This is happening for quite some time, maybe even decades, as far as I remember. I have this in the virtual hosts section:                WSGIScriptAlias /1 /0/1/1.wsgi      Does this have to do something with my problem? It seems that the error occurs because of `DirectoryIndex 1`. I am certain this problem would go away if I change `DirectoryIndex 1` to `DirectoryIndex index.html`. Could it be associated to the allocated memory, given that this error happens, when there are a lot of visitors on my main index page?


title: top not working

text: My below cronjob is not working. What am I doing wrong here??               */5 * * * * /usr/bin/top -n1 | head -10 >>/tmp/load.txt


title: rc.local not being executed when os boots up

text: I have a script that needs to be run when os boots up. I added it to `/etc/rc.local`. It was working fine for sometime but now `rc.local` does not load at boot time. When i checked the permissions on the file,               [root@localhost etc]# ls -al rc.local      -rw-rw-rw-. 1 root root 288 Mar 14 12:40 rc.local      So I used `chmod a+x rc.local` to set executable permission. But on reboot it didn't start. Again, `ls -al rc.local` showed that `rc.local` doesn't have executable permission. Why did it get reset? How to make `rc.local` executable permanantly? Update : Ok, so I did `chmod u+x rc.local` and now when the os boots up, the file is displayed as having executable permission. But still it isn't getting executed. Ouput of `ls -lZ`               [root@localhost etc]# ls -lZ rc.local      -rwxrw-rw-. root root unconfined_u:object_r:etc_t:s0   rc.local


title: Changing network config during CentOS netinstall

text: I cannot find a way to change the networking information during a CentOS netinstall, when using the URL installation method. I always use a netinstall, and occasionally fat-finger the network information. Once you try to access the URL, it will error if it cannot get to the image - but it will not let you go back and change the network configuration. Is there anyway to get to a shell or reset the information, without just having to reboot? It seems odd you cannot change this - just something I would like to know for future reference.


title: MPlayer benchmarking - realtime FPS counter

text: I was trying to use MPlayer as a simple benchmarking tools and I need it to show the real time FPS counter, either on the console or on the video playback itself. I googled around and I stumbled across `-benchmark` option but I don't see the information I required anywhere. I get something like this:               A:   6.9 V:   6.9 A-V:  0.000 ct: -0.039   0/  0  5%  8%  0.3% 0 0      Is there any way I can retrieve such information, though I prefer if it shows on the video playback itself. If Mplayer cannot perform this, is there any alternative that fulfill my requirements?


title: expr command used to work and stopped

text: I am on SunOS machine trying to get the date string of the past minute, yesterday I used this command I found on the internet               expr `date +%Y%m%d%k%M` - 1      which is worked just fine and I saw the output and this is the output I got from my session that is still opened:               bash-3.00$ expr `date +%Y%m%d%k%M` - 1     201303131641      Now I am trying to run this command on the same session and I got this output:               bash-3.00$ expr `date +%Y%m%d%k%M` - 1     expr: syntax error      My machine is running this OS:               bash-3.00$ uname -a     SunOS mySunOS 5.10 Generic_144488-11 sun4v sparc SUNW,Netra-T2000      I think there is some environmental variable or something that have been changed, can anyone help me out with this?


title: Cron job running but not establishing tunnel

text: I have a script which establishes a reverse tunnel on an endpoint `HostB`. It looks like this: `cat tun.sh`               #!/usr/bin/env bash          # Test code     /usr/bin/ssh -V 1> /home/userA/bin/tun.stdout 2> /home/userA/bin/tun.stderr          # Establish tunnel     createTunnel() {         /usr/bin/ssh -R *:19999:localhost:22 userB@hostB     }          # Do nothing if tunnel is already established     /usr/bin/ssh -p 19999 userA@hostB true     if [[ $? -ne 0 ]]; then         createTunnel     fi      when I run it manually like `./tun.sh` it works, and I can see on HostB, that userA is logged in. If I run it again on HostA but from another console, it works as expected - it does not launch a second tunnel. Everything so far is good. I now edit my crontab to look like this: `crontab -l`               # m h  dom mon dow   command     */1 *   *   *   *   /home/userA/bin/tun.sh      It runs the script every minut. This should be fine, since the script terminates if the tunnel is already established. However, now userA does not get logged in as when I run it manually from the console. The test code in the top of the script confirms that the script is being called, and that it has permission to execute `/usr/bin/ssh`: `~/bin$ ls`               tun.sh  tun.stderr  tun.stdout      `~/bin$ cat tun.stderr`               OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009      `~/bin$ cat tun.stdout`               [empty]      For some reason `-V` writes to `stderr` and not `stdout`, but that is a detail. The main point is here that the script is being executed every minute. My question is: **why is the SSH tunnel not established?**


title: UEFI and Puppy Linux

text: I recently installed Puppy Linux on a USB stick using the Universal USB Installer, but I have not being able to boot from it. My notebook came with Windows 8 and had the secure boot activated at UEFI. I disabled the secure boot option, but I am still not able to boot from the USB stick (it is not being shown in the list of bootable devices). Interestingly, a live USB with certain Linux distros are recognized on my computer, such as Linux Mint Cinnamon and Ubuntu. But others, such as Puppy, Zorin, Elementary OS and Mint MATE are not working. Basically all advice I found online is to disable the secure boot option, which I already did. Is there anything else I can do in order to boot from my usb stick?


title: Port Forwarding Between 2 Internet Machines

text: Here's my scenario: ## Setup There are 3 machines: `A`: on the internet : has ip (`a.a.a.a`), has port `pa` open `B`: my server / gateway : has ip (`b.b.b.b`), has port `pb` open `C`: on the internet : has ip (`c.c.c.c`), has port `pc` open ## Constraints The owner of machine `A` offers a service via port `pa` that must be accessed on machine `C` via port `pc`. The problem is, the owner of `A` can only allow to directly connect with my server, machine `B` on port `pb`. Note that, _`A` and `C` are on the internet_, so in effect, I have to act as a gateway between two machines on the internet (the literature I've found in most firewall docs concerns acting as a gateway _between the internet and your local_ network). ## Requirements My task is to make sure I give machine `C` the service offered by `A` via my server `B`, in such a way that traffic from `A:pa` ends up on `C:pc` and traffic from `C:pc` ends up on `A:pa`. So, how can I achieve this, say using `iptables` or another Linux / Unix utility? Is it even possible? ## Hypothetical Solution: Here's an Idea I have in mind, but am not sure it's legit or makes sense:               iptables -t nat -A PREROUTING -p tcp --source a.a.a.a --source-port pa \     --destination b.b.b.b --destination-port pb -j DNAT --to-destination c.c.c.c:pc      and               iptables -t nat -A PREROUTING -p tcp --source c.c.c.c --source-port pc \     --destination b.b.b.b --destination-port pb -j DNAT --to-destination a.a.a.a:pa


title: Moving Horde, RoundCube and SquirrelMail address books

text: I have moved a domain of mine from one server to another. Both domains use Cpanel. I have moved all mails that were stored on the old server to the new one and this is fine now. Many users use webmail server with one of 3 mail systems: Horde, RoundCube and SquirrelMail. Even moving the /mail folder from one server to the other, all webmail systems have no contacts on their Address Books. My hosting company suggested to go, mail account by mail account and export every address book importing them on the new system, but this method is insane because the domain has hundreds of accounts and I would have to login on every account. Is there a method to move a directory from one server to another and get all moved at once? WHere Horde, SquirrelMail and RoundCube store their files for every account?


title: What are the fundamental differences between the mainstream *NIX shells?

text: What are the fundamental differences between the mainstream *NIX shells and what scenarios might prompt you to use one over the other? I understand that some of it probably comes down to user preference but I've only ever used bash and I'm interested to hear where another shell might be useful. Also, is there an impact on user-written shell scripts when running under one shell or another or is it simply a matter of changing the shell at the top of the file? My instinct says it's not that easy.


title: Canonical bash environment variable representing a user's email address

text: I'm writing a bash function which will send an email to the current user upon completion. I'm wondering if there's a canonical or normal way to get a user's email address. My current plan is to simply use `$EMAIL`, which will certainly work well enough, but I wasn't sure if there was a better or "right" way to refer to the current user's email address (assuming, of course, that it's set). Note that I'm _not_ trying to email the machine's local mail, but a remote address.


title: How to remove a group of no longer needed Debian packages?

text: When building software, I sometimes need to install libraries, binaries, etc. which are only required to build the package but then I forget about removing them, so I end having to cleanup several packages at once; even those that I don't want to remove. Parsing the log files to find the exact packages is suboptimal and a royal pain if the packages are old enough. Is there a way to facilitate this task?


title: Writing to /tmp is failing - returning error 22

text: I'm getting this weird behaviour where writing to /tmp is failing. Even try `touch /tmp/foo` as root fails with `OS error code 22: Invalid argument`. The permissions are set to 1777/drwxrwxrwt.


title: CentOS 5.5 SSH with Key for non ROOT user

text: I tried pretty much everything I could to make this work. I spent literally 6 hours on research and nothing helps to remove "Server refused our key" error. My username I tried to make is "Testuser" but I logged in SSH as root, should I also `chown Testuser:Testuser authorized_keys`? I originally tried this and everything alike: http://www.howtoforge.com/ssh_key_based_logins_putty_p3 Then I followed this and still does not work : http://www.walkernews.net/2009/03/22/how-to-fix- server-refused-our-key-error-that-caused-by-putty-generated-rsa-public-key/


title: libusb_init() returns -99

text: I have successfully built both `libfreenect` (driver for Xbox Kinect) and `libusb` (which is a dependency). However, if I try to open the Kinect using the `freenect_init(...)` function, it returns `-99`. I tracked down the error to the funtion `libusb_init(...)` which is returning this error, `LIBUSB_ERROR_OTHER`. As I use a minified custom kernel configuration (version: 2.6.37) I think I missed to enable an important config option. Kernel config is available on pastebin.com. The Kinect gets successfully recognized (reported in dmesg including correct product/vendor information). Does anyone has an idea how to get rid of this error? **UPDATE:** After setting the `LIBUSB_DEBUG` environment variable to `3` I got the following message: `[op_init] could not find usbfs`


title: Script to SCP files works manually but not through cron

text: I'm using CentOS 5.6. The below code might have some typos as I needed to change real info to fake info for security reasons: ### backup.sh               #!/bin/bash     set -vx     rm -v /server/temp_db.gz     rm -v /server/temp_ftp.tar     rm -v /server/temp_backup.tar     mysqldump --all-databases | gzip -9 > /server/temp_db.gz     echo "$(date +%H:%M:%S) - finished DB backup"     tar -Pcf /server/temp_ftp.tar /server/public_html/     echo "$(date +%H:%M:%S) - finished FTP backup"     tar -Pcf /server/temp_backup.tar /server/temp_db.gz /server/temp_ftp.tar     DATE=`date +%A-%b-%d-%Y_%H-%M-%S`     sleep 120     /myfolder/upload.sh $DATE      ### upload.sh               #!/usr/bin/expect -f          # connect via scp     spawn scp /backup/temp_backup.tar root@mybackup.com:/server/backup.tar     #######################     expect {       -re ".*es.*o.*" {         exp_send "yes\r"         exp_continue       }       -re ".*sword.*" {         exp_send "mypassword\r"       }     }     interact      I created 2 files (above):               cd /myfolder/     chmod +x backup.sh     chmod +x upload.sh     ./backup.sh      Everything works fine. The time when `temp_backup.tar` is created is only 2 seconds after the previous timestamp, and normally takes 10-20 seconds when the command is run manually:               rm -v /server/temp_db.gz     + rm -v /server/temp_db.gz     removed `/server/temp_db.gz'     rm -v /server/temp_ftp.tar     + rm -v /server/temp_ftp.tar     rm: cannot remove `/server/temp_ftp.tar': No such file or directory     rm -v /server/temp_backup.tar     + rm -v /server/temp_backup.tar     rm: cannot remove `/server/temp_backup.tar': No such file or directory     mysqldump --all-databases | gzip -9 > /server/temp_db.gz     + mysqldump --all-databases     + gzip -9          echo "$(date +%H:%M:%S) - finished DB backup"     date +%H:%M:%S     ++ date +%H:%M:%S     + echo '20:50:16 - finished DB backup'     20:50:16 - finished DB backup     tar -Pcf /server/temp_ftp.tar /server/public_html/     + tar -Pcf /server/temp_ftp.tar /server/public_html/     echo "$(date +%H:%M:%S) - finished FTP backup"     date +%H:%M:%S     ++ date +%H:%M:%S     + echo '20:50:19 - finished FTP backup'     20:50:19 - finished FTP backup     tar -Pcf /server/temp_backup.tar /server/temp_db.gz /server/temp_ftp.tar     + tar -Pcf /server/temp_backup.tar /server/temp_db.gz /server/temp_ftp.tar     DATE=`date +%A-%b-%d-%Y_%H-%M-%S`     date +%A-%b-%d-%Y_%H-%M-%S     ++ date +%A-%b-%d-%Y_%H-%M-%S     + DATE=Friday-Dec-16-2011_20-50-24     sleep 120     + sleep 120     /myfolder/upload.sh $DATE     + /myfolder/upload.sh Friday-Dec-16-2011_20-50-42     spawn scp /server/temp_backup.tar root@223.123.126.134:/backup/backup_Friday-Dec-16-2011_20-50-42.tar     Password:     temp_backup.tar                              100%  516MB  23.5MB/s   00:22      * * * Now I set up a cron task:               * */10 * * * /myfolder/backup.sh 2>&1 > /myfolder/backup.log      I checked that the cron task is run by `root`, same as the manual run, the owner of the files is `root:root` and permissions are `-rwxr-xr-x` on both files, but for some reason it still doesn't work. Note again the timestamp before creating `backup_temp.tar` and after -- only 2 seconds difference:               rm -v /server/temp_db.gz     + rm -v /server/temp_db.gz     removed `/server/temp_db.gz'     rm -v /server/temp_ftp.tar     + rm -v /server/temp_ftp.tar     removed `/server/temp_ftp.tar'     rm -v /server/temp_backup.tar     + rm -v /server/temp_backup.tar     removed `/server/temp_backup.tar'     mysqldump --all-databases | gzip -9 > /server/temp_db.gz     + mysqldump --all-databases     + gzip -9     echo "$(date +%H:%M:%S) - finished DB backup"     date +%H:%M:%S     ++ date +%H:%M:%S     + echo '20:41:05 - finished DB backup'     20:41:05 - finished DB backup     tar -Pcf /server/temp_ftp.tar /server//public_html/     + tar -Pcf /server/temp_ftp.tar /server/public_html/     echo "$(date +%H:%M:%S) - finished FTP backup"     date +%H:%M:%S     ++ date +%H:%M:%S     + echo '20:41:07 - finished FTP backup'     20:41:07 - finished FTP backup     tar -Pcf /server/temp_backup.tar /server/temp_db.gz /server/temp_ftp.tar     + tar -Pcf /server/temp_backup.tar /server/temp_db.gz /server/temp_ftp.tar     DATE=`date +%A-%b-%d-%Y_%H-%M-%S`     date +%A-%b-%d-%Y_%H-%M-%S     ++ date +%A-%b-%d-%Y_%H-%M-%S     + DATE=Friday-Dec-16-2011_20-41-09     sleep 120     + sleep 120     /myfolder/upload.sh $DATE     + /myfolder/upload.sh Friday-Dec-16-2011_20-39-08     spawn scp /server/temp_backup.tar root@231.122.139.9:/backup/backup_Friday-Dec-16-2011_20-39-08.tar^M     Password:


title: How do I recursively shred an entire directory tree?

text: I have a directory tree that I would like to shred with the Linux 'shred' utility. Unfortunately, shred has no `-R` option for recursive shredding. **How can I shred an entire directory tree recursively?**


title: How do I get this Bash-script to work?

text: > **Possible Duplicate:**   >  How to name a file in the deepest level of a directory tree How do I get this script to work? The goal is to find the directory at the deepest level in the directory tree and print the name of a file, a random file, maybe the first.               find -type d | declare COUNT=-1; declare P=""; while read LINE ;      do        echo $LINE        declare C        C=$(echo $LINE | cut -c3- | sed "s/\//\n\//g" | grep '/' -c)        echo $C        if [ $COUNT -gt $C ]        then            let COUNT=$C            let P=$LINE            echo "Done"        fi     done      Better solutions are also welcome but they should be one-liners.


title: Software for visually building regular expressions?

text: I frequently need to create regular expressions for use in scripts (mostly when used in `sed`), however, I find, sometimes the regular expressions get very complicated and difficult for me to understand and edit. Is there any software which allows one to visually creates the code for regular expressions, which I can then copy and paste into a script?


title: How to customize XFCE screenshot saving file name template?

text: When I press `Print Scrn` in XFCE and choose to save it, the automatically generated and offered file name is like `Screenshot - 141012 - 02:21:10.png` (`Screenshot - DDMMYY - HH:mm:SS.png`). I hate to use Windows-incompatible characters (like `:`) and sorting- unfriendly date formats in file names and moreover the name looks too long: `scrnYYYYMMDDHHmmSS.png` would be much better. Is it possible to set-up?


title: What command line to use to set up Double Commander's "Run in terminal" feature to use XFCE terminal?

text: Double Commander has a handy "Run in terminal" feature but it is configured to uses xterm by default. Needless to say many prefer to use their desktop environment native terminal client and so do I. The feature is configurable and the default command line to call the terminal application is               xterm -e sh -c      what to replae it with to use XFCE terminal? ![Double Commander behaviour configuration](http://i.stack.imgur.com/iS7vs.png)


title: Automated PAM module installation

text: I'm trying to set up an automated install process for a PAM module that provides LDAP-like HTTP authentication. Since this is an alternative authentication module, I would need to add something like this: `auth sufficient mypam.so authserver=https://someserver.com` Since my application is a daemon that 'listens' to user authentication, it doesn't really deserve it's own config file, so it would have to leach onto something else (like GDM, SSH, etc). I basically have two options here:   * Append or prepend to appropriate config files (and log all changes)   * Output the lines to add with suggestions for the sysadmin to manually edit **Which of these two options would a *nix admin prefer?** Are there any other approaches that I am missing that a *nix admin would prefer? Note: I am trying to market this to a sys-admin for widespread use in a corporate setting. This may also be marketed to end users, but in that case I would do the first option by default.


title: how to word wrap, align text like the output of man?

text: what is the command that word wraps and justifies a text file so that the output looks like that of a man page:                  All of these system  calls  are  used  to  wait  for  state        changes  in  a  child  of  the  calling process, and obtain        information about the child whose  state  has  changed.   A        state change is considered to be: the child terminated; the        child was stopped by a signal; or the child was resumed  by        a  signal.  In the case of a terminated child, performing a        wait allows the system to release the resources  associated        with the child; if a wait is not performed, then the termi-        nated child remains in a "zombie" state (see NOTES below).


title: Get rid of this button in KDE4?

text: Looks like mandatory, I run plasma-desktop, there's always a button on the right corner, is there anyway to remove that? It wasn't an removable "widget" ![enter image description here](http://i.stack.imgur.com/tjpYj.png)


title: Monitor if there's a fullscreen app starting?

text: I run workrave on my computer, when I play fullscreen games like warzone2100, it would like this program to be killed automatically and restart when the full-screen app quits. Any ideas?


title: How do you write test cases for a web server that uses posix sockets?

text: I know how to test it experimentally by running the program, but ideally I would like to test each function I write as I write it. Usually I can't test my functions until I write a whole bunch of them, and it makes it hard to find out what went wrong. Does Posix have some way of testing the socket's options, flags, settings, etc, so I can write a test case for a function such as this? What is the best way to test a function such as this?                /**      * Creates a listening socket, sets it up with setsockopt, bind, and listen.      * @param port the port of the listening socket.      * @return the file descriptor of the listening socket.      */     int SetUpListeningSocket(int port)     {         //Variables:         struct sockaddr_in server;         int s;              // setup socket address structure         memset(&server, 0, sizeof (server));         server.sin_family = AF_INET;         server.sin_port = htons(port);         server.sin_addr.s_addr = INADDR_ANY;              // create socket         s = socket(PF_INET, SOCK_STREAM, 0);         if (!s)         {         perror("socket");         exit(-1);         }              // set socket to immediately reuse port when the application closes         int opt = 1;         if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt)) < 0)         {         perror("setsockopt");         exit(-1);         }              // call bind to associate the socket with our local address and         // port         if (bind(s, (const struct sockaddr *) &server, sizeof (server)) < 0)         {         perror("bind");         exit(-1);         }              // convert the socket to listen for incoming connections         if (listen(s, SOMAXCONN) < 0)         {         perror("listen");         exit(-1);         }         return s;     }


title: Remapping gnome-terminal shortcut keys

text: According to the Gnome-Termianl Usage, I found that `ctrl`+`shift`+`up`/`down` can **scroll up/down** a line in the terminal. Now, I want to re-map the shortcut key, just like: `alt`+`j`/`k` to **scroll up/down** a line, that's the old habit of vimer. :) I tried searching the settings in **Edit** -> **Keyboard Shortcuts** of Terminal, but found nothing. And, the `keybindings` still cannot be found at `~/.gconf/apps/gnome- terminal/` also. I've tried to find the information about **readline** (`$ bind -p`), only terminal character shortcuts and command were found (like: C-d: delete a char, C-a: at the beginning of command , etc...), the scroll command still cannot be found. Can anyone help me? Thanks in advance. * * * The information of my computer is :               $ cat /etc/issue     Ubuntu 12.10 \n \l      By the way, I've used **AutoHotKey** to re-map the shortcuts in Windows.


title: Why is connecting to Oracle Express 11 is very slow on Fedora 17?

text: I installed `oracle-xe-11.2.0-1.0.x86_64.rpm` on Fedora 17-64-bit. I was wondering why it is very slow, for example when I want to connect to it using Oracle SQL Developer or JDBC in my web application. Are there any configuration for Fedora or Oracle Express 11 to improve my performance? I mention that my machine specification is good (8GB RAM , Core i5 CPU). I installed an Oracle Express on Windows using VirtualBox and when I wanted to connect to it from my Fedora it was slow but when I connected to it locally (in Windows) it connected very fast!


title: find length of longest line in all text files in a directory

text: I know how to get length of the longest line in a text file with `awk`               awk ' { if ( length > L ) { L=length} }END{ print L}' file.txt      but how can I get the length of the longest line of all files in a directory?


title: What does Chakra "optimize" about KDE?

text: The KDE about box in Chakra says that I'm running "Platform Version 4.9.97 optimized by The Chakra Project". What exactly does Chakra "optimize" about KDE? I'm considering switching away (mostly due to the lack of packages because of the relatively small community) and I'd like to know if I'd loose anything.


title: recommended procedure to create a user/group during RPM install

text: after trying hard to search for RPM best practices guides and finding virtually none, to my surprise, I resort to the community - I need to ensure that some users and groups exist after the installation, and that the users are members of the groups. Are there a recommended procedure(s) for this? In the existing rpm spec I see that the required users&groups are removed at the beginning of the %pre script prior to adding them with `useradd`. I am told that this is a common practice. Why is this? Is it better then testing for user existence with `id -u`? Some of our clients may want to manage their users themselves, so they would create the users before running our rpm. So to sum up all the above, it seems that the best approach is to test for user existence and to create it if does not exist. Any comments on that? Thanks. **EDIT** : RHEL 5.7


title: Find the Information of USB Devices In C++

text: I need to list existing USB hub and the devices connected in the hub using my C++ program. I can able to print the USB Hub and devices connected in hub from terminal using the commands               lsusb     lsusb -v       I want to use that feature in my C++ program. How I can do this programmatically. Is there any C++ classes available to use in my Qt application.


title: How to create a multiboot flash drive in Linux?

text: I like the way the yumi makes a multiboot flash drive in Windows. In Linux, can I complete the same task as easily as `yumi` does in Windows? With `yumi`, I just browse to selected iso (i.e. DVDwindows.iso) and I can prepare the multiboot flash drive ready in few moments.


title: Definitive way to configure network devices in Centos 6.2

text: What is the definitive way to configure network devices in Centos 6.2? Via network manager or editing `/etc/sysconfig/network-scripts`? I have a notebook with 1 ethernet port and a usb ethernet adapter plugged in. When I do `ip link show` I see `eth0` and `em1`. However when I go to `/etc/sysconfig/network-scripts`, there is an `ifcfg-eth0` file and `ifcfg- usb0`, but no `ifcfg-em1`. The network manager applet shows under Wired connections System eth0 and System usb0. I have set eth0 to 10.0.4.24 and usb0 to use dhcp under the network manager applet. When I remove usb ethernet device, `ip link show` only shows `em1`. Does this mean `em1` maps to `eth0`? However as `eth0` is no longer there (because the usb adapter has been removed), does that mean `usb0` also maps to `eth0`? My problem is that when I do an `ifconfig`, BOTH `em1` and `eth0` show an ip address of `10.0.4.24`. PS should this belong here or at serverfault? edit: added requested output:               # more 70-persistent-net.rules      # This file was automatically generated by the /lib/udev/write_net_rules     # program, run by the persistent-net-generator.rules rules file.     #     # You can modify it, as long as you keep each rule on a single     # line, and change only the value of the NAME= key.          # PCI device 0x8086:0x422b (iwlagn)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="24:77:03:74:85:98", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"          # USB device 0x0b95:0x7720 (usb)     SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:b6:50:b5:fc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"          ---------------------          # more ifcfg-eth0      DEVICE="eth0"     BOOTPROTO=none     #HWADDR="00:21:70:B9:4C:9F" # Commented by Clonezilla     NM_CONTROLLED="yes"     ONBOOT="yes"     TYPE="Ethernet"     DEFROUTE=yes     IPV4_FAILURE_FATAL=yes     IPV6INIT=no     NAME="System eth0"     UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03     IPADDR=10.0.4.24     PREFIX=24          -----------------------          # more ifcfg-usb0      DEVICE="usb0"     NM_CONTROLLED="yes"     ONBOOT="no"     TYPE=Ethernet     BOOTPROTO=dhcp     DEFROUTE=yes     IPV4_FAILURE_FATAL=yes     IPV6INIT=no     NAME="System usb0"     UUID=689ce77b-bfa1-c10b-19a2-eb3a89251128     HWADDR=02:80:37:EC:02:00     PEERDNS=yes     PEERROUTES=yes          -------------------------          # ifconfig     em1       Link encap:Ethernet  HWaddr D4:BE:D9:2B:D3:72                 inet addr:10.0.4.24  Bcast:10.0.4.255  Mask:255.255.255.0               inet6 addr: fe80::d6be:d9ff:fe2b:d372/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:120 errors:0 dropped:0 overruns:0 frame:0               TX packets:57 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:11475 (11.2 KiB)  TX bytes:10552 (10.3 KiB)               Interrupt:20 Memory:e6e00000-e6e20000           eth0      Link encap:Ethernet  HWaddr 00:50:B6:50:B5:FC                 inet addr:10.0.4.24  Bcast:10.0.4.255  Mask:255.255.255.0               inet6 addr: fe80::250:b6ff:fe50:b5fc/64 Scope:Link               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1               RX packets:1000 errors:0 dropped:0 overruns:0 frame:0               TX packets:473 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000                RX bytes:87868 (85.8 KiB)  TX bytes:56643 (55.3 KiB)      Note there is no entry in ifconfig or ip link for usb0


title: Unable to use busybox implementation of hwclock

text: I have a buildroot generated kernel (3.6.11) and root file system running on an x86 device. It uses busybox and I am trying to set the BIOS hardware clock using `hwclock`. I get this error whenever I invoke `hwclock` :               can't open '/dev/misc/rtc': No such file or directory      I understand this as I only have a `/dev/rtc` device file present on my system. However, using `strace` I see that `hwclock` has already tried to open `/dev/rtc` and fails with message               open("/dev/rtc",O_READONLY|O_LARGEFILE) = -1 ENODEV (No such device)      Upon inspecting the kernel configuration for the Real Time Clock under the Device Drivers section of the kernel configuration I can see that I have enabled the option for `/dev/rtcN` (character devices) and `/proc/driver/rtc` (procfs for rtc0). I also only have the driver PC-style 'CMOS' platform RTC driver selected. However under the help section here I read the following: > Say "yes" here to get direct support for the real time clock found in every > PC or ACPI-based system, and some other boards. Specifically the original > MC146818, compatibles like those in PC south bridges, the DS12887 or M48T86, > some multifunction or LPC bus chips, and so on. > > Your system will need to define the platform device used by this driver, > otherwise it won't be accessible I am very confused as to why I cannot open the `/dev/rtc' file. It is present and I get output when I invoke               cat /proc/driver/rtc      Is there something else I need to do to register the device ? I was thinking of perhaps changing the driver to become a module and do an `insmod` after boot up but I do not know if that is a good idea or not. Can anyone suggest how I can fix this or get more details about what has gone wrong? **EDIT** From online reading I performed `dmesg | grep -i rtc` and obtained the following output:               [ ... ] RTC time: 16:01:07, date 09/24/13     [ ... ] rtc_cmos 00:02: RTC can wake from S4     [ ... ] rtc_cmos 00:02: rtc core: registered rtc_cmos as rtc0     [ ... ] rtc0: alarms up to one year, y3k, 114 bytes nvram      Which makes me wonder why I have no `/dev/rtc0`. I am using a static device table in `buildroot` so is it possible I would need to alter this to provide a `/dev/rtc0` device node since I am not using `udev` ?


title: Preventing program from using internet

text: Is there a way to block certain programs from being able to connect to the internet in Debian (a firewall blocking outgoing connections), so for example, to block a windows program running in wine from being able to call home?


title: shell parameter substitution to rename files

text: I need to rename filenames which starts with "foo" into "boo" This is the script I used               #!/bin/sh               for f in *.jpg;     do          mv -- "{$f}" "${f/foo/boo}";               done      but when i run I get a bad substitution error. what is the problem in my code?


title: How can I act on the results of the "locate" command?

text: I'm trying to find where `check_dns` is defined in `nagios`' `commands.cfg` file, although there are quite a few files. I know I could run something like `find / -name "command.cfg" -exec grep check_dns {} \;` to search for matches, but if possible I would like to use `locate` since it is an indexed copy and much faster. When I run `locate commands.cfg` I get the following results:               /etc/nagios3/commands.cfg     /etc/nagiosgrapher/nagios3/commands.cfg     /usr/share/doc/nagios3-common/examples/commands.cfg     /usr/share/doc/nagios3-common/examples/template-object/commands.cfg     /usr/share/nagiosgrapher/debian/cfg/nagios3/commands.cfg     /var/lib/ucf/cache/:etc:nagiosgrapher:nagios3:commands.cfg      Is it possible to run locate and pipe it to an inline command like `xargs` or something so that I can `grep` each of the results? I realize this can be done with a for loop but I'm looking to pick up some bash-fu / shell-fu here more than how to do it for this specific case.


title: WakeOnLan error

text: I've been working on a wakeonlan script, which worked fine, until now. Then program wakeonlan, which is not made by me, isn't functioning properly. When I use **perl -w /usr/bin/wakeonlan** I get this as output:               Getopt/Std.pm did not return a true value at /usr/bin/wakeonlan line 10.     BEGIN failed--compilation aborted at /usr/bin/wakeonlan line 10.      The first 10 lines of **/usr/bin/wakeonlan** :               #!/usr/bin/perl     #     # $Id: wakeonlan,v 1.4.2.3 2005/01/27 16:03:54 jpo Exp $     #     #########################################################################                 use strict;     use Net::hostent;     use Socket;     use Getopt::Std;      I erased wakeonlan and installed it again, but it gives the same error. I was not able to find any clear solution on Google. Maybe some of you guys know what the problem can be?


title: Convert newline-delimited list with spaces into arguments

text: I'm trying to write a script that I can run from the context menu in Caja (a clone of Nautilus). Its purpose is to pass the files that are selected in the file manager to a given program (for example, 7zip). A list of selected files is provided in the system variable `$CAJA_SCRIPT_SELECTED_FILE_PATHS`, separated by newlines. I want to pass each line of this variable to the program as an argument, even if they contain spaces. After failing at quote-wrapping, I tried the following line:               echo "$CAJA_SCRIPT_SELECTED_FILE_PATHS" | xargs -d "\n" 7z a archive.7z      While it worked for 7zip, I changed the script so that the arguments are passed to a program I wrote and something went wrong, so I want a way to execute this in a terminal to get output from the program. I was using `xterm -hold -e`, but I haven't been able to make a command with a pipe in it execute this way because the shell will try to pipe output from xterm. I also tried shell redirection (by adding `> log.txt` to the end of the line), and it made a file for 7zip's usual output but a blank file for my program, which outputs messages just fine in the terminal. Finally, I want a POSIX-compliant (or otherwise standard) solution so that it will work the same way on BSD and Linux. EDIT: To clarify, I want to change some thing like this:               /path/with/a space     /another/path      Into what I would hypothetically get from something like this:               char *argv[]={"/path/with/a space", "/another/path"};      EDIT2: That's how it should be in the program recieving the arguments, not the shell!


title: Process Migration Scripting

text: I want to write some shell script which can perform the process migration from one node to another. Is it possible ? Can somebody please help me scripting this. What all should I know before coding it?