title: Understanding NTFS-3g Inode Use

text: I'm running a CentOS 4.6 final box with a second drive array (raid 1, the mount is `/mnt/raid`, as listed below in my nagios warning) that uses ntfs-3g as the file system. My nagios warnings just went off saying that I'm running out of inodes but still have 10% of the drive space available (I am aware this is common). However I'm possibly mis-understanding the problem since when I do a `df -hi`, my output seems to indicate I only have a pending drive space issue. Also, NTFS does not use inodes, so what gives? Here's my `df -hi` output               [root@images ~]# df -hi     Filesystem            Inodes   IUsed   IFree IUse% Mounted on     /dev/mapper/VolGroup00-LogVol00                             9.1M    190K    8.9M    3% /     /dev/hda1                26K      39     26K    1% /boot     none                    127K       1    127K    1% /dev/shm     /dev/sda1                52M    141K     52M    1% /mnt/raid      here's my `df -h` output:               [root@images ~]# df -h     Filesystem            Size  Used Avail Use% Mounted on     /dev/mapper/VolGroup00-LogVol00                            72G  6.2G   62G  10% /     /dev/hda1              99M   15M   80M  16% /boot     none                  506M     0  506M   0% /dev/shm     /dev/sda1             466G  415G   52G  90% /mnt/raid      here's my `fstab` file:               /dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1     LABEL=/boot             /boot                   ext3    defaults        1 2     none                    /dev/pts                devpts  gid=5,mode=620  0 0     none                    /dev/shm                tmpfs   defaults        0 0     none                    /proc                   proc    defaults        0 0     none                    /sys                    sysfs   defaults        0 0     /dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0     /dev/sda1               /mnt/raid               ntfs-3g  defaults        0 0     #/dev/md0                /mnt/raid/backup        ntfs-3g  defaults        0 0     /dev/sdd1               /extraid                ntfs-3g rw,umask=0000,defaults 0 0     /dev/hdc                /media/cdrom2           auto    pamconsole,exec,noauto,managed 0 0      And here's my Nagios warning:               DISK WARNING - free space: /mnt/raid 52452 MB (10% inode=99%):      The warning says free space, but 52GB is plenty at 10% available. What concerns me is the `inode=99%` part. Doesn't this mean Nagios is reporting that 99% of inodes on `/mnt/raid` are being used? `/mnt/raid` is NTFS, so I don't think it even uses inodes? Correct?


title: whats happening to my simple script?

text: #!/bin/bash     while read file1; do          while read file2 : do         if [ $file1 == $file2 ] ; then         $file1 >> /infanass/dev/admin/test/newlist.txt         fi         echo "$file1"         echo "$file2"      done < /infanass/dev/admin/test/file2.txt     done < /infanass/dev/admin/test/file1.txt      **Error :**                ./test.bsh: line 9: syntax error near unexpected token `done'      ./test.bsh: line 9: `    done 3</infanass/dev/admin/test/file2.txt'


title: iptables is not blocking

text: I have a script running every minute by a crontab. This script scans the system logs and grabs the IPs of every failed attempt to login on the server's dovecot, exim or ssh and add them to an ipset, blocking that IP forever. The problem is this: the script runs every minute and is doing well what it is supposed to do, that is, grab the IP of attackers and add them to ipset, but I still have log entries of the same IP trying to attack the system for an hour. In other words. Suppose someone tries to attack the system now. Within one minute the script will run and grab all IPs with more than 3 password failures and add them to an ipset. Even so, I have logs of IPs trying to brute force attack the site for hours and the connection is not interrupted. My supposition is this: ipset works by adding an IP to a table and that IP will be blocked the next time that IP comes to the server but the connection will not drop if the IP is already connected to the server trying to attack. Is this right? If it is, is there a way to interrupt a connection going on? NOTE: Just for the record: the commands I have used to add the ipset named blocking to iptables was like this:               iptables -A INPUT -p tcp --dport XX -m set --set blocking src -j DROP      where XX is the port I am blocking.


title: Is running programs as another user useful?

text: After watching a talk by Douglas Crockford on security where he talks about how browsers got the right answer to the question "Who's interest does the program represent?", I wondered if it was feasible and a good idea to run some programs as another user. I'm running Debian but I guess this could apply to any OS. I tend to trust anything coming from the stable, backports and testing repositories (please tell me if I shouldn't) but whenever I install something else, something that isn't on these repositories, I don't really trust it. And I have quite a few of those from Mathematics programs such as Maple to browsers such as Chrome to games such as Heroes of Newerth. Since that makes me unable to trust my own OS, I boot on a live CD every single time I want to use my credit card. So I was wondering if just running those programs as a specific user could be of any help. I'm fine with Chrome being able to see everything I do online but that's where it must stop. I'm fine with Heroes of Newerth seeing what mods I installed, updating its files and so on but I don't want it to be able to access the browser's cache or anything else. From my understanding of how this works, I'd be able to run each not-totally- trusted program as a separate user, giving them the read and write access to only the files they need. Is this feasible (like, will I be able to still control volume and other per- user things?)? And will it add the kind of security I want? Thank you in advance for your answers. P.S.: I've already found this: Execution of possibly harmful program on Linux But a virtual machine won't work for video games, I'm already doing the live CD thing but it's kind of annoying, the chroot thing seems overly complicated since I'd need to get the libraries etc. and the sandbox is just an upgraded chroot. And he says using users is useless because the files can be accessed if you don't set the proper rights. But I can just remove read access to anyone but me, can't I?


title: Continues Pinging to background, save logs and show statistics

text: I'm trying to make a script that save the `ping` logs to .txt or .log file. To monitor if my connection is intermittent or not, I'm using this script:               $nohup ping 8.8.8.8 > timeout.txt &      Then when I check if its pinging:               $tailf timeout.txt      It's working! But when I stop the process by using:               $kill (process)      timeout.txt file is stop pinging but didn't show the statistic logs if I had any timeout or packet loss. How to stop the `ping` and also showing the statistic?   Or do I have to add a script to my script?


title: How to display TCP handshake in Linux

text: Hi is there a way to display TCP handshake in Linux? Like for example this WIKI - TCP handshake Not exactly like the illustration but at least it would show client has sent SYN, ACK, FIN etc and the servers response as well.   Just take note I can't use wireshark, tcpdump or other packet capturing programs, just using internal Linux commands, processes or libraries. Thanks # Update I know this question is closed but I just want to update this coz I found out what I was looking for. Using this command:               /proc/net/ip_conntrack      its found here: TCP Connections   I need to improve my googling skills :)


title: Internal microphone doesn't work on Dell Vostro 3360

text: I've got Dell Vostro 3360 laptop, and internal mic doesn't work. I use 3.8 series kernel. When I try to record sound from mic I get only weird noise. All sliders in alsamixer are 100% and capture is ON. alsa-info.sh script output could be found here. I guess it could be fixed by specifying model for snd-hda-intel module but I've got no idea what model I should specify. Any idea?


title: Using sed to replace characters between two patterns

text: I'd like to replace all the newlines after a line containing a given pattern with a tab. Input file:               $ cat File1     NAME1     N1_info     NAME2     N2_info       I'm creating some flags at the ends of the future "tab"s:               sed '/^NAME/s/$/\*/g; /^NAME/!{s/^/+/g}' File1.txt > File2.txt          $ cat File2     NAME1*     +N1_info     NAME2*     +N2_info      Then I'm removing the characters between the "flags" in order to obtain the wished output. I tried two sed patterns (but none of them change my 'File2'):               head File2 | sed -e 's/\(\*\).*\(+\)/\1\t\2/g'     head File2 | sed -n '/\*/,/+/p'      This is the what the output should look like:               $ cat File3     NAME1   N1_info     NAME2   N2_info


title: Converting *.ram to *.avi

text: I just came across an old file witn a ram extension. I've tried viewing it ( just to see what it is ) and am having extreme difficulties. I've tried looking for spftware online and alll I find are Windows programs and some online conversion sites.I would like to have a local utility convert such files. Does anyone know something? How about for other weird file formats?


title: Generating a list of alternative packages with apt tools

text: Given a package how can I list all possible packages that are alternatives to this package? In the alternate, how can I tell if a package or one of it's alternates is installed? Using something in the apt family of tools, of course.


title: bash_completion

text: I have a simple script, which creates a symlink `IP_address` -> `config_file` (used for pxe boot). My script is called like this:               lnpxe CONFIG HOSTNAME      where `CONFIG` is one of my config files stored in `/home/tftp/config/` and `HOSTNAME` is any hostname. Now, I am trying to set up bash_completion for my script. When I type `lnpxe` and then press `TAB`, I would like to have my config files in `/home/tftp/config/` "suggested" to me and autocompleted. Similarly, for the second argument, I would like to have suggestions of available hosts from my `/etc/hosts` file (similar as ping or ssh do) Here is my `/etc/bash_completion.d/lnpxe` file which does NOT work as I would like to:               _lnpxe()     {         local cur prev         COMPREPLY=()         cur="${COMP_WORDS[COMP_CWORD]}"         prev="${COMP_WORDS[COMP_CWORD-1]}"              _filedir          }     complete -F _lnpxe -o filenames lnpxe      Could somebody please help ?


title: SELinux Write access for vsftpd and samba

text: This should be easy enough I think, but I'm new to SELinux. I have a CentOS 6 file server. I have some LVM file systems at /var/media and I want to use both Samba and FTP to share them with a Windows machine. I am using ACLs so that permissions work nicely in Windows (I have a two user network). I've found that Samba, though working, is slow for file transfers, so I wanted to try FTP. I'd like to keep using SELinux to keep things secure, but I'm running into trouble with accessing the files over FTP. I can read the files and write to my home directory. But I **cannot write to files in /var/media** (with the samba_share_t context). I thought that `allow_ftpd_use_cifs` was supposed to handle that. I can get it to work with `allow_ftpd_full_access`, but I'd prefer to avoid this. What am I missing? Here is the relevant info:               [mdurak@srv ~]$ ls -Z /var/media     drwxrwxr-x+ mdurak admins system_u:object_r:samba_share_t:s0 docs     drwxrwxr-x+ mdurak admins system_u:object_r:samba_share_t:s0 library     drwxrwxr-x+ mdurak admins system_u:object_r:samba_share_t:s0 photos     drwxrwxr-x+ mdurak admins system_u:object_r:samba_share_t:s0 projects          [mdurak@srv ~]$ sudo semanage boolean -l | grep ftp     ftp_home_dir                   (on   ,   on)  Allow ftp to read and write files in the user home directories     tftp_anon_write                (off  ,  off)  Allow tftp to modify public files used for public file transfer services.     allow_ftpd_full_access         (off  ,  off)  Allow ftp servers to login to local users and read/write all files on the system, governed by DAC.     allow_ftpd_use_cifs            (on   ,   on)  Allow ftp servers to use cifs used for public file transfer services.     allow_ftpd_use_nfs             (off  ,  off)  Allow ftp servers to use nfs used for public file transfer services.     allow_ftpd_anon_write          (on   ,   on)  Allow ftp servers to upload files,  used for public file transfer services. Directories must be labeled public_content_rw_t.     ftpd_use_passive_mode          (off  ,  off)  Allow ftp servers to use bind to all unreserved ports for passive mode     ftpd_connect_db                (off  ,  off)  Allow ftp servers to use connect to mysql database     httpd_enable_ftp_server        (off  ,  off)  Allow httpd to act as a FTP server by listening on the ftp port.          [mdurak@srv ~]$ sudo semanage boolean -l | grep samba     samba_domain_controller        (off  ,  off)  Allow samba to act as the domain controller, add users, groups and change passwords.     samba_portmapper               (off  ,  off)  Allow samba to act as a portmapper     samba_enable_home_dirs         (on   ,   on)  Allow samba to share users home directories.     samba_export_all_ro            (off  ,  off)  Allow samba to share any file/directory read only.     samba_export_all_rw            (off  ,  off)  Allow samba to share any file/directory read/write.     use_samba_home_dirs            (off  ,  off)  Support SAMBA home directories     samba_create_home_dirs         (off  ,  off)  Allow samba to create new home directories (e.g. via PAM)     cdrecord_read_content          (off  ,  off)  Allow cdrecord to read various content. nfs, samba, removable devices, user temp and untrusted content files     allow_smbd_anon_write          (off  ,  off)  Allow samba to modify public files used for public file transfer services.  Files/Directories must be labeled public_content_rw_t.     samba_share_fusefs             (off  ,  off)  Allow samba to export ntfs/fusefs volumes.     samba_share_nfs                (off  ,  off)  Allow samba to export NFS volumes.     samba_run_unconfined           (off  ,  off)  Allow samba to run unconfined scripts     sanlock_use_samba              (off  ,  off)  Allow sanlock to manage cifs files     virt_us      e_samba (off , off) Allow virt to manage cifs files /etc/vsftpd/vsftpd.conf               anonymous_enable=NO     local_enable=YES     write_enable=YES     local_umask=022     dirmessage_enable=YES     connect_from_port_20=YES     xferlog_std_format=YES     chroot_local_user=YES     chroot_list_enable=YES     # mdurak is in the chroot_list     chroot_list_file=/etc/vsftpd/chroot_list     listen=YES     pam_service_name=vsftpd     userlist_enable=YES     tcp_wrappers=YES     pasv_enable=YES     local_root=/var/media      Attempt in FTP to make the directory (there is also a denied message in the audit log so I know it's an SELinux problem).               Command:    CWD /var/media/library/music     Response:   250 Directory successfully changed.     Command:    MKD sdff     Response:   550 Create directory operation failed.     Command:    MKD /var/media/library/music/sdff     Response:   550 Create directory operation failed.


title: How to Select Tutorial Chapters in Uemacs

text: I finished installing uemacs 4.0.15.1 from github. I have some experience with GNU-emacs and I wanted to give this a try. I got stuck from the beginning. I opened (by pressing Esc+?) the uEmacs/PK 4.0 HELP and saw at the bottom of the window "Select topic from list and press < Help >". There's no way I can select the topic from the list, at least no way I'm aware of. I use Terminal 0.4.4 on Xfce, Slackware. If someone could shed light on this...


title: Debian-Windows dual boot: which one should I install first?

text: I have a fresh desktop with no OS that I want to run Windows 7 and Debian stable on. All guides for dual boot setups I found so far assume a pre- installed Windows (possibly because so many PCs come that way). Because of the bootloader, it does matter what is installed first.   * What is better, Windows or Linux first - and why?   * What’s easier to do?   * Especially with a Linux-first setup, I’d appreciate example of the steps that could be involved.


title: Recommended way of installing python packages on Arch

text: What's the recommended way of installing python packages on Arch? Searching for them on the AUR and installing them from there (or create a `PKGBUILD` file to make a package yourself) or using `pip`? I started off by installing stuff from pacman and the AUR and dont know if it would be wise to mix with `pip` packages.


title: Choice of editor when running under sudo

text: On an Ubuntu 12.04 machine I've used the alternatives system to set the **editor** to **vim.basic**. I get the correct editor when root but not when I sudo to root and run crontab, and I'm trying to understand why. A bit more detail. The alternative **editor** is currently set to **vim.basic** by manual mode (output trimmed):               % sudo update-alternatives --set editor /usr/bin/vim.basic     % update-alternatives --display editor     editor - manual mode       link currently points to /usr/bin/vim.basic     /bin/nano - priority 40       slave editor.1.gz: /usr/share/man/man1/nano.1.gz     /usr/bin/vim.basic - priority 30       slave editor.1.gz: /usr/share/man/man1/vim.1.gz       slave editor.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz       slave editor.it.1.gz: /usr/share/man/it/man1/vim.1.gz       slave editor.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz       slave editor.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz     Current 'best' version is '/bin/nano'.      If I sudo to root and edit crontab the editor is vim.basic:               % sudo -i     % crontab -e     # editor is vim; :help shows     # *help.txt*      For Vim version 7.3.  Last change: 2010 Jul 20      EDITOR and SHELL as root:               # env | grep -i editor     EDITOR=vim     # echo $0     -bash      However as a normal user if I sudo crontab the editor is nano:               % sudo crontab -e     # GNU nano 2.2.6      EDITOR and SHELL as normal user:               % env | grep -i editor     EDITOR=vim     % echo $0     zsh      Now I'm noticing that **nano** has a higher priority (40) than **vim.basic** (30), so I could change the priority of vim.basic. But that defeats the purpose of **manual mode**. **Update** I've noticed that using **sudo -E** gives the correct editor, implying problem is environment related. That is:               sudo crontab -e     # nano editor is used     sudo -E crontab -e  # vim editor is used


title: how to connect ssh 'with' specified port?

text: I know how to connect 'to' a certain port when ssh'ing.               ssh user@remotehostip -p XXX      but is there a way to establish a ssh 'with' a certain port? I mean, is there a way to specify the port which my local computer will be using?


title: What can you do to a file without triggering the "Change" Timestamp?

text: What can you do to a file without triggering the "Change" stat? For instance, it appears that simply changing a bit will trigger Change.


How can I install Openfiler on Vmware ESX 4.1? Is there a step-by-step guide?


title: setup fetchmail/exim4 to download from gmail account and forward to another email address

text: I'm trying to setup my debian server to download email from a gmail account (e.g. `forwarder@gmail.com`) and then forward it to a 3rd party email. The reason I can't just setup email forwarding within gmail is because I need the headers to reflect that the email is coming from `forwarder@gmail.com`. When I use gmail's forwarding, then it leaves the headers unchanged. I'm first trying to setup exim4 to just use gmail to send. I set it up as a smarthost via the instructions on the Debian wiki, but when I try to send a test email, it gives me the following errors in the exim4 log:               2011-06-26 06:34:37 1QapTx-0000rh-Cu <= root@ETC_MAILNAME U=root P=local S=360     2011-06-26 06:34:37 1QapTx-0000rh-Cu ** 3rdparty@email.com: Unrouteable address     2011-06-26 06:34:38 1QapTx-0000rj-R4 Error while reading message with no usable sender address (R=1QapTx-0000rh-Cu): at least one malformed recipient address: root@ETC_MAILNAME - malformed address: _MAILNAME may not follow root@ETC     2011-06-26 06:34:38 1QapTx-0000rh-Cu Process failed (1) when writing error message to root@ETC_MAILNAME (frozen)      Anyone have any idea what might be the issue? Edit: Running Debian 6.0 "squeeze" and Exim version 4.72 #1 built 12-May-2011 19:03:39 Here is /etc/exim4/exim4.conf:               # /etc/exim4/update-exim4.conf.conf     #     # Edit this file and /etc/mailname by hand and execute update-exim4.conf     # yourself or use 'dpkg-reconfigure exim4-config'     #     # Please note that this is _not_ a dpkg-conffile and that automatic changes     # to this file might happen. The code handling this will honor your local     # changes, so this is usually fine, but will break local schemes that mess     # around with multiple versions of the file.     #     # update-exim4.conf uses this file to determine variable values to generate     # exim configuration macros for the configuration file.     #     # Most settings found in here do have corresponding questions in the     # Debconf configuration, but not all of them.     #     # This is a Debian specific file          dc_eximconfig_configtype='smarthost'     dc_other_hostnames=''     dc_local_interfaces='127.0.0.1 ; ::1'     dc_readhost=''     dc_relay_domains=''     dc_minimaldns='false'     dc_relay_nets=''     dc_smarthost='smtp.gmail.com::587'     CFILEMODE='644'     dc_use_split_config='false'     dc_hide_mailname='false'     dc_mailname_in_oh='true'     dc_localdelivery='mail_spool'


title: what does this ssh command mean?

text: Its an answer I got from questioning about port forwarding but I'm not sure what it means..               $ ssh lab_desktop -L 2200:lab_server:22 -vvv      my wild guess: first get connect to lab_desktop and then again log into lab_server(port 22) and the received data from this connection will be forwarded to lab_desktop, port 2200. is my wild guess right?? but I still don't understand what that '-vvv' means... * * * update after applying answer: okay with creek's helpful answer&comments, I did what I can to make creek's answer work again, let me be clear with the terminologies `mypc` - the one that's doing all the typing `lab_desktop` - ssh server `lab_server` - final destination that I want to communicate with. This server will only allow connection from `lab_desktop`. And one more thing: it will only allow connections through port 122. okay since logging in to `lab_desktop` and `lab_server` requires username and password, I just made rsa authentication for `mypc`--`lab_desktop` and `lab_desktop`--`lab_server` so that I wouldn't confront the trouble of entering the password all the time and just to set aside the possibility of password entering making the ssh command more complex. After that I used the command: `ssh Black@lab_desktop -v -L 2200:lab_server:122` the below is the output               chulhyun@chulhyun-Inspiron-3420:~/.ssh$ ssh Black@$labcom -v -L 2200:143.248.146.204:122      OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: /etc/ssh/ssh_config line 19: Applying options for *     debug1: Connecting to 143.248.143.198 [143.248.143.198] port 22.     debug1: Connection established.     debug1: identity file /home/chulhyun/.ssh/id_rsa type -1     debug1: identity file /home/chulhyun/.ssh/id_rsa-cert type -1     debug1: identity file /home/chulhyun/.ssh/id_dsa type -1     debug1: identity file /home/chulhyun/.ssh/id_dsa-cert type -1     debug1: identity file /home/chulhyun/.ssh/id_ecdsa type -1     debug1: identity file /home/chulhyun/.ssh/id_ecdsa-cert type -1     debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1     debug1: match: OpenSSH_6.6.1 pat OpenSSH*     debug1: Enabling compatibility mode for protocol 2.0     debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4     debug1: SSH2_MSG_KEXINIT sent     debug1: SSH2_MSG_KEXINIT received     debug1: kex: server->client aes128-ctr hmac-md5 none     debug1: kex: client->server aes128-ctr hmac-md5 none     debug1: sending SSH2_MSG_KEX_ECDH_INIT     debug1: expecting SSH2_MSG_KEX_ECDH_REPLY     debug1: Server host key: ECDSA 79:64:5d:e7:ac:78:b7:52:3d:9a:6a:3b:c1:37:a0:2d     debug1: Host '143.248.143.198' is known and matches the ECDSA host key.     debug1: Found key in /home/chulhyun/.ssh/known_hosts:1     debug1: ssh_ecdsa_verify: signature correct     debug1: SSH2_MSG_NEWKEYS sent     debug1: expecting SSH2_MSG_NEWKEYS     debug1: SSH2_MSG_NEWKEYS received     debug1: Roaming not allowed by server     debug1: SSH2_MSG_SERVICE_REQUEST sent     debug1: SSH2_MSG_SERVICE_ACCEPT received     debug1: Authentications that can continue: publickey,password,keyboard-interactive     debug1: Next authentication method: publickey     debug1: Trying private key: /home/chulhyun/.ssh/id_rsa     debug1: read PEM private key done: type RSA     debug1: Authentication succeeded (publickey).     Authenticated to 143.248.143.198 ([143.248.143.198]:22).     debug1: Local connections to LOCALHOST:2200 forwarded to remote address 143.248.146.204:122     debug1: Local forwarding listening on ::1 port 2200.     debug1: channel 0: new [port listener]     debug1: Local forwarding listening on 127.0.0.1 port 2200.     debug1: channel 1: new [port listener]     debug1: channel 2: new [client-session]     debug1: Requesting no-more-sessions@openssh.com     debug1: Entering interactive session.     debug1: Sending environment.     debug1: Sending env LANG = ko_KR.UTF-8     Last login: Tue Jun 24 16:47:27 2014 from 143.248.244.12          Black@Black-PC ~     $      its long but I guess the only thing that I should be looking is the lines:               debug1: Local connections to LOCALHOST:2200 forwarded to remote address 143.248.146.204:122     debug1: Local forwarding listening on ::1 port 2200.      when I use my netstat to see if this is true(`netstat -tulpn | grep 2200`) the output is :               root@chulhyun-Inspiron-3420:/etc/ssh# netstat -tulpn | grep 2200     tcp        0      0 127.0.0.1:2200          0.0.0.0:*               LISTEN      14966/ssh            tcp6       0      0 ::1:2200                :::*                    LISTEN      14966/ssh       so I guess the ssh hopping is established after all.. The problem now is when I try to use the port 2200 in `mypc`. As Creek suggested, I need to exploit this port so I tried logging in with both my root account and user account but the result was a failure due to password..               chulhyun@chulhyun-Inspiron-3420:~$ su     password:      root@chulhyun-Inspiron-3420:/home/chulhyun# ssh root@localhost -p 2200     root@localhost's password:      Permission denied, please try again.     root@localhost's password:           root@chulhyun-Inspiron-3420:/home/chulhyun# exit     exit     chulhyun@chulhyun-Inspiron-3420:~$ ssh chulhyun@localhost -p 2200     chulhyun@localhost's password:      Permission denied, please try again.      The passwords are the right ones I'm sure of it. But I don't understand why it won't work... I come up to this point. Could you help be reach further? * * * update the new problem that I'm facing is discussed and solved at: Linux can't recognize the right password when ssh'ing?


title: Open Source OS alternative for Windows Server 2003

text: I know this is not a forum to ask for suggestions like this, but i am desperately looking for solution on the problem. **Problem** I am using Windows server 2003 SE. And as heard Microsoft will not provide support for windows server 2003 anymore. **Looking for** I want to migrate to a open source server OS which will be proper replacement for the server. Only one thing comes to my mind is Linux, but there are different distributions of Linux, like Red Hat, ubuntu, Cent OS, SlackWare, SUSE and many more. Among them few have only enterprise version of Linux Server. I am not quite sure to go with which open source server. If any other linux distribution is suitable, then also you please suggest. **More** The need is not for very big organization rather it's for mid-size company with around 1000 students. Along with Essential features of server i need to have LDAP, CVS and dhcp, file server, printer server and similar packages.


title: How to calculate the sum of the data that have the same ID in the first column?

text: I want to sum the values of the rows of my data that have the same ID in the first column. My data looks like data.txt               Id    a    b    c    d    e     1     1    2    3    4    5     1     2    3    4    5    6     1     3    4    5    6    7     2     4    5    6    7    8     2     5    6    7    8    9     2     6    7    8    9    10     3     7    8    9   10    11     3     8    9    10  11    12     3     9    10   11  12    13     3     10   11   12  13    14     4     11   12   13  14    15     4     12   13   14  15    16     5     13   14   15  16    17     5     14   15   16  17    18      Required results out.txt               Id    a     b   c   d   e     1     6     9   12  15  18     2     15    18  21  24  27     3     34    38  42  46  50     4     23    25  27  29  31     5     27    29  31  33  35


title: USB disk doesn't work on the new kernel

text: I just install the latest linux kernel (3.12.6) on my laptop(Lenovo). My system is Ubuntu 12.04. I just use the old configuration file in the old system which is "config-3.2.0-58-generic". Everything is well unless the usb disk dose not work when i plug it in. The mouse can not work either but light. The trackpoint and touchpad work well. There are some infos:               :dmesg|tail          [  524.745753] usb 1-1.3: new high-speed USB device number 5 using ehci-pci          :lsblk          NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT     sda      8:0    0 298.1G  0 disk      ├─sda1   8:1    0   1.5G  0 part      ├─sda2   8:2    0    81G  0 part      ├─sda3   8:3    0     1K  0 part      ├─sda4   8:4    0  15.6G  0 part      ├─sda5   8:5    0   160G  0 part      ├─sda6   8:6    0   1.9G  0 part [SWAP]     └─sda7   8:7    0  38.1G  0 part /     sr0     11:0    1  1024M  0 rom            :fdisk -l          Disk identifier: 0x509ebf17          Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *        2048     3074047     1536000    7  HPFS/NTFS/exFAT     /dev/sda2         3074048   172939263    84932608    7  HPFS/NTFS/exFAT     /dev/sda3       172941310   592371711   209715201    f  W95 Ext'd (LBA)     Partition 3 does not start on physical sector boundary.     /dev/sda4       592371712   625139711    16384000    7  HPFS/NTFS/exFAT     /dev/sda5       172941312   508483583   167771136    7  HPFS/NTFS/exFAT     /dev/sda6       588359680   592371711     2006016   82  Linux swap / Solaris     /dev/sda7       508485632   588349439    39931904   83  Linux               :mount     /dev/sda7 on / type ext4 (rw,errors=remount-ro)     proc on /proc type proc (rw,noexec,nosuid,nodev)     sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)     none on /sys/fs/fuse/connections type fusectl (rw)     none on /sys/kernel/debug type debugfs (rw)     none on /sys/kernel/security type securityfs (rw)     udev on /dev type devtmpfs (rw,mode=0755)     devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)     tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)     none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)     none on /run/shm type tmpfs (rw,nosuid,nodev)     binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc     (rw,noexec,nosuid,nodev)     gvfs-fuse-daemon on /home/fan/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=fan)     /dev/sda5 on /media/T type fuseblk  (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)      Seems like it is connecting to the computer. But nothing happen. The `/mnt` folder is empty.


title: How to use whitespace in procmailrc recipe destination path?

text: I use Mutt Maildir for storage mails. I created one mailbox like this `Stack Exchange/`. (whitespace between Stack and Exchange here) procmailrc recipe:               :0     * From: .*Stack\ Exchange     Stack Exchange/      But upper recipe destination setting failed. after test and watch the log file. I found procmail jumped through `Exchange/`, deliver email to `Stack` **file** , instead of `Stack` **maildir folder** , nor `Stack Exchange/` **maildir folder**. And I googled procmail settings, FAQ etc. not found relative problems. So, does anybody knows how to escape whitespace here ?


title: In makefile when do we use .o files?

text: In the following make file, what is the significance of adding .o files instead of .c files?               CC=gcc     CFLAGS=-I.          hellomake: hellomake.o hellofunc.o          $(CC) -o hellomake hellomake.o hellofunc.o -I.


title: Curl command help

text: I'm trying to connect to a internal tool UI, then login and later logout. The homepage is having 3 drop-down options and 2 tabs where we need to enter the IP & Port and then connect. Once connected, I need to login and verify whether logged in and then logout. I'm unable to get the name of the tab where I need to insert the IP & Port. However the id for that field is "my-4". I need help for below questions : *) How can I use the id field and enter my IP? *) How to I connect first? (Eg. homepage is http://xx.xx.xx.xx/tool/ and once connected, my page will be http://xx.xx.xx.xx/tool/authorise ) The code is in Javascript and hence I'm getting bit confused as I had earlier worked on HTML based.


title: Pidgin & Lync - Some buddies are not recognized

text: I'm running RHEL 6 and using Pidgin to connect to the corporate Lync server. Overall it works quite well. My problem is that, apparently randomly, some of my 'buddies' are not properly looked up from the Lync server. In most cases I can add a new buddy by using their email address. Pidgin then goes and looks up all kinds of details, including name and status. For a small handful of people who I attempt to add as a buddy, none of that happens. I get no status or name, and the person is just listed in my buddy list as 'sip:their_email@our_company.com'. I can delete the buddy and re-add always with the same result. I'm just wondering if anyone else has seen this and/or has any suggestions.


title: How can I automatically chown a file to the user who made the modification?

text: I've set up a shared directory structure for users accessing a common set of files. Files created by a user are owned by that user (the group is inherited from the parent directory), so the team knows who to ask about new files. However, files modified by a user are not updated to reflect that user, so the team has no idea who created edits to a file. I would like files edited by a user to automatically be chown'ed to that user. The assets are already revision controlled, but I want the team to be able to tell who is making local edits to this shared sandbox, in between check-ins. In an ideal world, people remember to commit or clean up all changes, but nobody's perfect! **EDIT** By "already revision controlled," I mean it's an svn checkout. We're not using filesystem tricks to implement our own type of revision control. For this particular case (I realize it wouldn't make sense in most cases), sharing the checkout, rather than everyone committing from their own sandbox and publishing changes, is the most productive.


title: Editing config file via a bash script

text: I've been trying to write a simple bash script which I'll be using to install an application and update it's config file. I'm having hard time to have get it's config file modified.               # DBHost=localhost     DBName=test     # DBPassword=      any suggestions how I can get above modified as below?               DBHost=localhost     DBName=database     DBPassword=password


title: VFS: Cannot open root device “nfs” or unknown-block(0,255)

text: I am trying to setup a diskless client which will mount over nfs to the server. When I try to boot the client I get the following error message:               VFS: Cannot open root device "nfs" or unknown-block(0,255) Please append a correct "root=" boot option Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)      I've set up my kernel parameters as follows:               kernel=192.79.143.131:/linuxboot,192.168.100.14      (they are tftpboot parameters, which work)               Linux PPC load: root=/dev/nfs rw nfsroot=192.79.143.131:/diskless/client01 ip=dhcp      The kernel is found via tftpboot, so I know the 'kernel' parameter above works. The kernel is loaded and start executing, but hits the above error eventually. The mount point is properly exported from the server, as I can mount it manually from other machines. I've read several threads about this topic (at least very similar), but none, as far as I've seen so far, has addressed mounting a nfs drive. I've only seen topics talking about local hard drives.


title: How to turn off/speed up desktop switching in Ubuntu 13.10?

text: In my standard Ubuntu desktop I defined four workspaces. When I switch between them (e.g. use a key shortcut), I see the new workspace move in while the old workspace moves out of the screen. So far so good, nothing wrong here. But from time to time, when the system is loaded, this 'switching' takes many seconds. So how can I speed up this visual effect, or disable this visual effect completely (I still want workspaces!)? I might have installed several tweaking tools, but I cannot find the tool which I used to enable this effect in the first place. How can I find out? How to speed up/turn off this effect?


title: Why doesn't my laptop fan ever spin down?

text: My laptop fan is always active, even if CPU usage is really low (less than 5%). I have a Vaio laptop with Linux and Windows, but this problem only happens with Linux.


title: How to autologin with XDM?

text: How to autologin a specified user with `xdm`? I know it's possible with other display managers but I wasn't able to figure out how `xdm` has to be configured to autologin a certain user. Is it possible? Or should I rather remove `xdm` and simply use an initscript with `startx`?


title: Control cpu freq depending on ac/battery state

text: How can I make my linux system (ubuntu) automatically choose the performance governor when it works with ac and switch automatically to ondemand when it is on battery (and vice versa)? Is it also possible to switch to the lowest CPU frequency if the battery state drops below a certain value? I am looking for a solution which is independent of the used desktop environment. **Edit** The solution may interfer with another cpu scaling mechanism installed in ubuntu by default. For example there is a file `/etc/init.d/ondemand` which sets the CPU to ondemand... Are there other pitfalls like this one?


title: How to script /etc/issue?

text: I would like to pipe my tty number through figlet (ASCII generator) for the `/etc/issue` (message shown before login). Obviously this means I can't just update it from `/etc/rc.local`. On my system (Arch), `agetty` is responsible for parsing the file.


title: how to chown mounted device?

text: When I plug in my external hard-drive when running KDE, it prompts me to mount the device (by clicking an icon, no sudo involved), and once I've done that I am the owner of the files. This is great. When using other window managers (awesome, fluxbox, etc), I have to mount manually (`sudo mount...`) and thus root becomes the owner. `sudo chown -R myname /mount_point` just gives me "operation not permitted" errors. How can I make myself as user the owner of the file system on the external drive? I use this drive for backups and having to do that as root is tedious (and I wouldn't be surprised if it's dangerous as well).


title: Getting sudo to work for an alias

text: I installed Sublime Text 3 in Fedora 20 which has got GNOME, as I couldn't get it being _called_ from terminal I created a `.bash_aliases` file which a line like this:               alias sublime='sublime_text'      And so also added the sublime_text file location to the PATH by editing `.bashrc` file adding:               export PATH=$PATH:/usr/local/share/applications/sublime-text-3/      However, when I want to edit any file for which I might get **_sudo privilege_** first I want to do:               sudo sublime sudoLikelyFile      or               sudo sublime_text sudoLikelyFile      However I'm getting:               sudo: sublime: command not found      How can I work around for this?


title: Why can't I get the exit values of a command in this bash script?

text: So I was writing this little nautilus script for transcoding video into mp3:               #! /bin/bash -x          if [ -z "$1" ]         then         zenity --warning --text="Error - No file selected !"         exit 1     fi          BASEFILENAME=${1%.*}          exec ffmpeg -i "$1" -ab 256k "$BASEFILENAME.mp3" &&          if [ "$?" -eq 0 ]         then         zenity --info --text="Converting successful"         exit     fi      The problem is, though the ffmpeg command is executed successfully the `if [ "$?" -eq 0 ]` seems not to get triggered. Why is that? Is the `&&` wrong or is it something else?


title: How to remotely detect another machine's utorrent version with nmap?

text: How can I use `nmap` to find out the utorrent version installed on a PC by scanning it from another PC on the same subnet?


title: PHP package won't install correctly

text: Yesterday I did `apt-get upgrade` on my Debian/testing and broke a php5 package. I even tried to remove & purge with `apt` and `dpkg clean apt cache`. When installed again clean, it fails with following error message:               Setting up libapache2-mod-php5 (5.3.6-12) ...     readlink: invalid option -- 'm'     BusyBox v1.17.1 (Debian 1:1.17.1-10) multi-call binary.          Usage: readlink [-fnv] FILE          Display the value of a symlink          Options:             -f      Canonicalize by following all symlinks             -n      Don't add newline             -v      Verbose          ucf: Unable to determine The new file     dpkg: error processing libapache2-mod-php5 (--configure):     subprocess installed post-installation script returned error exit status 1      Any ideas how to solve this Debian way?


title: Why put some config info in conf/httpd.conf and some in files in the conf.d folder?

text: The main apache config file is in `/etc/httpd/conf/httpd.conf` on my CentOS system an in there is a line:               Include conf.d/*.conf      Inside conf.d is mostly files that do something like this:               LoadModule auth_kerb_module modules/mod_auth_kerb.so      But there are also other sites that are setup in there to and have their own config files. Was this not well thought out or am I missing something?


title: Recommended mailing list manager for use with Postfix

text: I have a small VPS (256MB RAM, 12% cap CPU) with Postfix installed that I use to host my mail domains. I want to run a mailing list manager, but would like to avoid Mailman because of its big fingerprint. Plus, I sysadmin a couple of them and would like to try new things :-) Any recommendation?


title: Help Shell script to pass variables to rsync

text: I'm trying to create a simple wrapper shell script for rsync. When I send file names to my script, rsync can never seem to identify the correct location. The file names have spaces in them. I've tried a dozen different variations using quotes, double quotes, backslashed quotes, and using the rsync -s --protect- args flag. I'm finally out of ideas. Here is a simplified version of my script.               #!/bin/bash     # Example usage:     #    pull.sh "file 1" "file 2"          LOCATION="/media/WD100"     all_files=""     for file in "$@"; do             all_files="$all_files:\"$LOCATION/$file\" "     done     # Pull the given files from homeserver to my current directory.     rsync --progress --inplace --append-verify -ave ssh username@homeserver"$all_files" .      Should I be writing this differently? How do make this script work? **UPDATE:** I changed my script to try to reflect Chazelas's answer, but it still seems not to work. Here is my new code:               #!/bin/bash     # Example usage:     #    pull.sh "file 1" "file 2"          LOCATION="/media/WD100"     all_files=""     for file in "$@"; do         all_files="$all_files\"$LOCATION/$file\" "     done     rsync --progress --inplace --append-verify -0 --files-from=<(printf '%s\0' "$all_files") -ave ssh username@homeserver: .      Running it gives me the standard "usage" output, with this error at the end.               rsync error: syntax or usage error (code 1) at options.c(1657) [server=3.0.9]     rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]     rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receiver=3.0.9]


title: What is the difference between LILO and GRUB?

text: I am running a web server under Debian and I currently have GRUB installed. Should I consider using LILO instead of GRUB? And what are the advantages of each?


title: Mint update manager not updating

text: After running update manager these are the error messages I get...               E: Encountered a section with no Package: header     E: Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_main_i18n_Translation-en     E: The package lists or status file could not be parsed or opened.     E: _cache->open() failed, please report.      Software manager has stopped working also I am using Linux Mint Maya. What is wrong?


title: How can we use the command 'top‘ to monitor the total CPU usage and each processor usage simultaneously?

text: You know that we can use the command `top` to monitor the real-time CPU usage and toggle the result display to the per-processor view by pressing key `1`. The disadvantage of it is you can only monitor either the whole CPU usage or each processor usage. That is, you can't see them simultaneously. Does anyone know this? I know that we can use alternative commands such as `mpstat` or `sar` to do the job. But unfortunately, neither of them is available on our system and no chance can we install them.


title: Linux window movement (delay)

text: I use linux at home and windows for work. One thing about most linux desktop environment that bothers me is the window movement. I'm using cinnamon right now. When I grab the window to put it in the other side of the screen for example..... it seems like I'm trying to move a brick with a elastic cord. Anyone knows how to make the window movement more instantaneous ? thanks


title: What is the default encryption type of the ssh-keygen?

text: When generating private/public keys with `ssh-keygen` what types of keys will it generate if I wont pass `-t` option followed with the encryption type like `rsa`?


title: xte and keyboard mapping

text: I'm trying to fake `xinput` events with `xte`:               xte "str $(echo '<ABC@gmail.com>')"      But, I get:               WQBC@g;qil<co;X      That's really weird, I'm using US keyboard and mapping, but `xte` gives this very different result. **UPDATE** Output from `xte "str '<ABC@gmail.com>'"` `4WQBC@g;qil<co;X4`


title: sudo cannot open /etc/sudoers

text: `sudo` does not work. I have installed Arch Linux onto a USB key formatted with BTRFS. The output of `sudo` is:               $ sudo     sudo: unable to stat /etc/sudoers: Permission denied     sudo: no valid sudoers sources found, quitting     sudo: unable to initialize policy plugin          $ ls -l /etc/sudoers     -r--r----- 1 root root 2849 May 18 15:00 /etc/sudoers          $ lsattr /etc/sudoers     --------------- /etc/sudoers          $ ls -ld /etc     drwxr-xr-x 1 root root 2476 May 25 13:45 /etc          $ ls -ld /     drwx------ 1 root root 142 May 25 06:51 /          $ ls -l $(which sudo)     ---s--x--x 2 root root 123995 May 25 13:10 /usr/bin/sudo          $ strace -u ross sudo true 2>&1 | egrep '(sudo|set.*[ug].*id)'     execve("/usr/bin/sudo", ["sudo", "true"], [/* 30 vars */]) = 0     read(3, "31799 (sudo) R 31796 31796 31754"..., 1024) = 223     lstat64("/etc/sudo.conf", 0xbfcddeb0)   = -1 ENOENT (No such file or directory)     stat64("/usr/lib/sudoers.so", {st_mode=S_IFREG|0755, st_size=235092, ...}) = 0     open("/usr/lib/sudoers.so", O_RDONLY|O_CLOEXEC) = 3     stat64("/usr/lib/sudoers.so", {st_mode=S_IFREG|0755, st_size=235092, ...}) = 0     setresuid32(0, -1, -1)                  = 0     setresgid32(-1, 0, -1)                  = 0     setresuid32(-1, 1, -1)                  = 0     lstat64("/etc/sudoers", 0xbfcddd60)     = -1 EACCES (Permission denied)     setresuid32(-1, 0, -1)                  = 0     write(2, "sudo", 4sudo)                     = 4     write(2, "unable to stat /etc/sudoers", 27unable to stat /etc/sudoers) = 27     setresuid32(-1, 1, -1)                  = 0     setresgid32(-1, -1, -1)                 = 0     setresuid32(-1, 0, -1)                  = 0     setresuid32(-1, 0, -1)                  = 0     setresgid32(-1, 1000, -1)               = 0     write(2, "sudo", 4sudo)                     = 4     write(2, "no valid sudoers sources found, "..., 40no valid sudoers sources found, quitting) = 40     write(2, "sudo", 4sudo)                     = 4               $ ltrace -u ross sudo true 2>&1 | egrep '(sudo|stat|set.*[ug].*id)'     bindtextdomain("sudo", "/usr/share/locale")      = "/usr/share/locale"     textdomain("sudo")                               = "sudo"     fopen("/proc/31813/stat", "r")                   = 0x9e51d40     __xstat(3, "/dev/console", 0xbffd6074)           = 0     __xstat(3, "/dev/wscons", 0xbffd6074)            = -1     __xstat(3, "/dev/pts/4", 0xbffd6074)             = 0     __lxstat64(3, "/etc/sudo.conf", 0xbffd9040)      = -1     strlen("sudo")                                   = 4     memcpy(0x09e51e71, "sudo", 4)                    = 0x09e51e71     __xstat64(3, "/usr/lib/sudoers.so", 0xbffd810c)  = 0     dlopen("/usr/lib/sudoers.so", 257 <unfinished ...>     dlsym(0x09e51ef8, "sudoers_policy")              = 0xb75af520     __xstat64(3, "/usr/lib/sudoers.so", 0xbffd810c)  = 0     dlopen("/usr/lib/sudoers.so", 257)               = 0x09e51ef8     dlsym(0x09e51ef8, "sudoers_io")                  = 0xb75af560     fputs("sudo", 0xb7760920sudo)                        = 1     fputs("unable to stat /etc/sudoers", 0xb7760920unable to stat /etc/sudoers) = 1     fputs("sudo", 0xb7760920sudo)                        = 1     fputs("no valid sudoers sources found, "..., 0xb7760920no valid sudoers sources found, quitting) = 1     fputs("sudo", 0xb7760920sudo)                        = 1     +++ exited (status 1) +++


title: How can I add a program to my start menu?

text: I use suse 12 with very few programs but when I install Komodo it doesn't add itself to my start menu? Why is some program in my start menu and others not?


title: Installing mysql-workbench from the testing ppa (Jessie) in Wheezy

text: I would like to install some packages from the testing branch without switching to it if possible. The big packages are things like `xfce4` and `mysql-workbench`. I've done this by making a testing.list file containing the deb sources for jessie/testing. Sadly, whenever I try to install a big package from the testing branch the following happends:                 sem@debian:~$ sudo apt-get install mysql-workbench/testing      Results in               Reading package lists... Done     Building dependency tree            Reading state information... Done     Selected version '6.1.7+dfsg-1' (Debian:testing [amd64]) for 'mysql-workbench'     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help to resolve the situation:          The following packages have unmet dependencies:      mysql-workbench : Depends: libpango-1.0-0 (>= 1.18.0) but it is not going to be installed                        Depends: libpangocairo-1.0-0 (>= 1.14.0) but it is not going to be installed                        Depends: libstdc++6 (>= 4.9) but 4.7.2-5 is to be installed                        Depends: python:any (>= 2.6.6-7~)                        Depends: mysql-workbench-data (= 6.1.7+dfsg-1) but 5.2.40+dfsg-2 is to be installed                        Depends: python-pyodbc (>= 2.1.8) but 2.1.7-1+b1 is to be installed     E: Unable to correct problems, you have held broken packages.      I tried generic solutions like `sudo apt-get -f install` but no luck. Can anyone help?


title: cat /dev/null emptied my log file but size did not change

text: I'm quite new to Unix. Using Solaris 10 I faced the below issue. There is a large log file with size 9.5G. I tried to empty the file using the below command.               # cat /dev/null file_log.txt      By doing this I regained space on the file system but the size of the file still shows the same and is increasing. I figured a process is still running into the log file. Is there a way to correct the file size? Is this going to effect my file system?


title: Rsync filter: copying one pattern only

text: I am trying to create a directory that will house all and only my PDFs compiled from LaTeX. I like keeping each project in a separate folder, all housed in a big folder called `LaTeX`. So I tried running:               rsync -avn *.pdf ~/LaTeX/ ~/Output/      which should find all the pdfs in `~/LaTeX/` and transfer them to the output folder. This doesn't work. It tells me it's found no matches for "`*.pdf`". If I leave out this filter, the command lists all the files in all the project folders under LaTeX. So it's a problem with the *.pdf filter. I tried replacing `~/` with the full path to my home directory, but that didn't have an effect. I'm, using zsh. I tried doing the same thing in bash and even _with_ the filter that listed every single file in every subdirectory... What's going on here? Why isn't rsync understanding my pdf only filter? * * * OK. So update: No I'm trying               rsync -avn --include="*/" --include="*.pdf" LaTeX/ Output/      And this gives me the whole file list. I guess because everything matches the first pattern...


title: Auto-run script when Wifi card is plugged in (udev)

text: I've been trying to use `udev` to make a Debian system run a bash script when a wireless card is connected. So far I created this file `/etc/udev/rules.d/wifi-detect.rules`:               ACTION=="add", ATTRS{idVendor}=="0cf3", ATTRS{idProduct}=="9271", RUN+="/root/test.sh"      And for now, I'm trying to make `test.sh` with this contents work:               #!/bin/bash     /bin/echo "test!" > /test.txt      But for some reason, nothing seems to happen when I connect the wireless card, no `test.txt` file is created. My `lsusb` on the card:               Bus 001 Device 015: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n      Running `udevadm monitor –env` this is what happens when I connect the card:               KERNEL[1017.642278] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3 (usb)     KERNEL[1017.644676] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0 (usb)     KERNEL[1017.645035] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/firmware/1-1.3 (firmware)     KERNEL[1017.708056] remove   /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/firmware/1-1.3 (firmware)     UDEV  [1017.714772] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3 (usb)     UDEV  [1017.733002] remove   /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/firmware/1-1.3 (firmware)     UDEV  [1017.772669] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/firmware/1-1.3 (firmware)     UDEV  [1017.798707] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0 (usb)     KERNEL[1018.456804] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/ieee80211/phy8 (ieee80211)     KERNEL[1018.465994] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/net/wlan0 (net)     KERNEL[1018.479878] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/leds/ath9k_htc-phy8 (leds)     KERNEL[1018.483074] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/usb_device/usbdev1.20 (usb_device)     UDEV  [1018.600456] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/leds/ath9k_htc-phy8 (leds)     UDEV  [1018.604376] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/ieee80211/phy8 (ieee80211)     UDEV  [1018.626243] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/usb_device/usbdev1.20 (usb_device)     KERNEL[1018.659318] move     /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/net/wlan1 (net)     UDEV  [1018.758843] add      /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/net/wlan1 (net)     UDEV  [1018.932207] move     /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/net/wlan1 (net)      I've tried a lot of examples around but I can't make it work. I hope someone can help me out with this one ;) Thank you! * * * # EDIT: To simplify thing, I changed my rule to:               ACTION=="add", ATTRS{idVendor}=="0cf3", ATTRS{idProduct}=="9271", RUN+="/bin/echo 'test' > /test.txt"      I managed to set `udevadm control --log-priority=info` as @user1146332 suggested and I got this interesting log:               Sep  9 16:27:53 iklive-rpi1 udevd[1537]: RUN '/bin/echo 'test' > /test.txt' /etc/udev/rules.d/wifi-detect.rules:1     Sep  9 16:27:53 iklive-rpi1 udevd[1544]: starting 'firmware.agent'     Sep  9 16:27:53 iklive-rpi1 udevd[126]: seq 663 queued, 'remove' 'firmware'     Sep  9 16:27:53 iklive-rpi1 udevd[126]: seq 663 forked new worker [1547]     Sep  9 16:27:53 iklive-rpi1 udevd[1537]: 'firmware.agent' [1544] exit with return code 0     Sep  9 16:27:53 iklive-rpi1 udevd[1548]: starting '/bin/echo 'test' > /test.txt'     Sep  9 16:27:53 iklive-rpi1 udevd[1547]: seq 663 running     Sep  9 16:27:53 iklive-rpi1 udevd[1547]: no db file to read /run/udev/data/+firmware:1-1.3.4: No such file or directory     Sep  9 16:27:53 iklive-rpi1 udevd[1547]: passed -1 bytes to netlink monitor 0x1af5ee0     Sep  9 16:27:53 iklive-rpi1 udevd[126]: seq 663 done with 0     Sep  9 16:27:53 iklive-rpi1 udevd[1547]: seq 663 processed with 0     Sep  9 16:27:53 iklive-rpi1 udevd[1537]: '/bin/echo 'test' > /test.txt'(out) 'test > /test.txt'     Sep  9 16:27:53 iklive-rpi1 udevd[1537]: '/bin/echo 'test' > /test.txt' [1548] exit with return code 0      So... Isn't the `return code 0` the exit code for successful completion? If so why I don't get any file on the system? * * * # EDIT 2: I managed to get this working using the tip by @htor. My current rule:               ACTION=="add", ATTRS{idVendor}=="0cf3", ATTRS{idProduct}=="9271", RUN+="/bin/sh -c '/bin/echo test >> /test.txt'"      But by some reason the command is executed like 8 times, is there a way to avoid this? I think is is happening because when the wireless card drivers are being load they need to virtually unmount and mount the card. Tips?


title: Do shells support recursion?

text: I'm trying to write recursive functions in my shell scripts. Consider the following code:               function printA {         if [[ "$1" = 0 ]]; then             return         else             echo "a$(printA $(("$1" - 1)))"         fi     }          printA 10          function factorial {              if [[ "$1" = 0 ]]; then             return 1         else             return $(( "$1" * $(factorial $(( $1 - 1 )) ) ))         fi     }          echo $(factorial 5)       The code fails on:   * `bash` (3.0) > recur.sh: line 5: "10" - 1: syntax error: operand expected (error token is > ""10" - 1") > > a > > recur.sh: line 16: "1" * : syntax error: operand expected (error token is > ""1" * ") > > recur.sh: line 16: "2" * : syntax error: operand expected (error token is > ""2" * ") > > recur.sh: line 16: "3" * : syntax error: operand expected (error token is > ""3" * ") > > recur.sh: line 16: "4" * : syntax error: operand expected (error token is > ""4" * ") > > recur.sh: line 16: "5" * : syntax error: operand expected (error token is > ""5" * ")   * `zsh` (4.2.1) > printA:1: bad math expression: illegal character: " > > a > > factorial:5: bad math expression: illegal character: " However it partly succeds using `ksh88`. Only the second function fails: > aaaaaaaaa > > recur.sh[5]: 1 * : more tokens expected > > recur.sh[5]: 2 * : more tokens expected > > recur.sh[5]: 3 * : more tokens expected > > recur.sh[5]: 4 * : more tokens expected > > recur.sh[5]: 5 * : more tokens expected   * Am I doing anything wrong?   * Is there another recursive syntax supported by bash and zsh?   * Why does the second function (`factorial`) fail in `ksh`? **PS** : I know, recursion is Evil, performs badly, I should use a regular loop instead, bla bla bla. I am not discussing whether recursion is good or bad, but whether common shells support it. I am not foolish enough to send recursive functions in production when simple iterative loops would do the trick :)


title: Hide Vim fold characters

text: When using Vim to write prose my folds look like this:               + # Section A expanded     | Lorem ipsum dolor sit amet, consectetur adipisicing elit,      | sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.      | Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris      | nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in      | reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla      | pariatur. Excepteur sint occaecat cupidatat non proident, sunt in      | culpa qui officia deserunt mollit anim id est laborum."          + # Section B folded     + # Section C folded      I like the `+` markers, but I find the `|` distracting. Is is possible to remove the pipes? I'd like things to look like this:               + # Section A expanded      Lorem ipsum dolor sit amet, consectetur adipisicing elit,       sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.       Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris       nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in       reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla       pariatur. Excepteur sint occaecat cupidatat non proident, sunt in       culpa qui officia deserunt mollit anim id est laborum."          + # Section B folded     + # Section C folded


title: Mint 13: Is it possible to skip standard login password dialog in presence of a pendrive with the key

text: To meet my security needs I set up quite long user password on my notebook. But when I am at home or other secure location, typing it down is cumbersome. It would be nice to let the gdm (or: mdm, since I am using Mint 13 with Mate) search for a specific file (on a pendrive), and when it is present, treat is as a security token and log in me automaticaly with it. I use encrypted home folders.


title: Is it possible to select tabs as tabs with mouse in urxvt?

text: I am running urxvt on Arch Linux. I can select the output with mouse for copy / paste. The problem occurs when output contains tabulators. All tabulators are selected and copied as spaces. That makes it really difficult to preserve the structure of some outputs when copying them. Is there any way to fix this behaviour? EDIT: I am using zsh if that has any effect on the issue.


title: Switching users without the - symbol

text: I had to switch to a different user earlier for something that I was working on. I have originally done: `su support` While I was successfully able to switch to support, I found I was unable to make directories. So i exited out of support and this time I typed: `su - support` At that point, I was able to continue to make the directory. My question is: Why was I able to log in with the first command but unable to make directories? And also, if this be the case, what is the overall difference between using the "-" symbol and not using it? If needed, the distro I am using is `Redhat`.


title: IPsec doesn't read configuration when the tunnel is deleted

text: I've created a tunnel between two sites using IPsec. I've made an error in the configuration, the address of the destination was false, so I deleted this tunnel. But after deleting, ipsec tries to establish the connection with the other site. What I get from `ipsec statusall`:               Connections:     Security Associations (1 up, 0 connecting):        TEST4[1]: CONNECTING, x.x.x.x[%any]...y.y.y.y[%any]        TEST4[1]: IKE SPIs: eb1655dd8f51750d_i* 0000000000000000_r        TEST4[1]: Tasks active: IKE_VENDOR IKE_INIT IKE_NATD IKE_CERT_PRE IKE_AUTHENTICATE IKE_CERT_POST IKE_CONFIG CHILD_CREATE IKE_AUTH_LIFETIME       and from the log file I get:               peer not responding, trying again (52/0)     charon: 04[IKE] initiating IKE_SA TEST4[1] to y.y.y.y     charon: 04[ENC] generating IKE_SA_INIT request 0 [ SA KE No N(NATD_S_IP) N(NATD_D_IP) ]     charon: 04[NET] sending packet: from x.x.x.x[500] to y.y.y.y[500]     charon: 03[IKE] retransmit 1 of request with message ID 0     charon: 03[NET] sending packet: from x.x.x.x[500] to y.y.y.y[500]     charon: 01[IKE] retransmit 2 of request with message ID 0     charon: 01[NET] sending packet: from x.x.x.x[500] to y.y.y.y[500]     charon: 14[IKE] retransmit 3 of request with message ID 0     charon: 14[NET] sending packet: from x.x.x.x[500] to y.y.y.y[500]     charon: 05[IKE] retransmit 4 of request with message ID 0     charon: 05[NET] sending packet: from x.x.x.x[500] to y.y.y.y[500]     charon: 02[IKE] retransmit 5 of request with message ID 0     charon: 02[NET] sending packet: from x.x.x.x[500] to y.y.y.y[500]      How can I reconfigure ipsec to be aware of the new configuration when I delete the tunnel so that it doesn't keep on trying to establish the connection even though there is no tunnel?


title: How to associate a script at boot time to a specific run level?

text: I am trying to understand how run levels work. I understand the meaning of the 7 run levels and I understand that they were usually configured by `/etc/inittab`, which used to call `/etc/init.d/rc`, which itself called the various scripts to configure the different run levels and how they should behave. Right now I am on an Ubuntu Server machine (12.04) and I see that the `inittab` file is not used anymore and that instead, scripts are found in the `/etc/init` directory. Now suppose that I want to execute a script at boot time (for example to launch an application). Usually I would do this editing the `/etc/init.d/rc.local` file. And here comes my question: if I edit this file, will this script run for **every** run level? If I want the script to work only at run level 5 for example, should I put this script into the `/etc/rc5.d/` folder instead? Or is there another way to do this?


title: Rsync from multiple folders to one

text: Is it safe to have multiple folders Rsync simultaneously into one? Each of the source folders contains a subset of the destination folder, and everybody just syncs into a master destination folder. I realize that if any two create the same file, their files will overwrite each other, but what I'm wondering is if this simultaneous sync could cause some file structure confusion in the master destination as there are many processes syncing to it at the same time. Does anybody know anything about this or have any experience with doing this?


title: What is the best way to create remote tunnel?

text: I have 3 Linux servers:   * 10.0.0.0/24 - (10.0.0.10) Linux server inside my LAN.    * 20.0.0.0/24 - (20.0.0.10) Linux server with HTTP Apache server    * 50.50.50.50/32 - Server on Amazon AWS which see both 10.x and 20.x LANs. 10.x cannot see 20.x and 20.x cannot see 10.x   What is the best way (and how can I do it) to se 50.50.50.50 server on AWS to create tunnel from 10.x to 20.x 20.0.0.10 runs HTTPd server on "DMZ" LAN. I need to see 20.0.0.10:80 from my 10.0.0.0/24 servers.   The 2 networks 10.x and 20.x is on the same Cisco ASA firewall/router, but I cannot route because of License issues, so i want to bypass this by external server which can see 20.x network. I want to be able to go to 50.50.50.50:80 from 10.x servers and see 20.0.0.10:80 content.


title: Lightweight Linux to host VM

text: We're looking for a rather lightweight, but at the same time easy to configure Linux distribution, which would have just one job - to host a VM - one at a time (others would be just stored there). At first i thought that ESXi would be perfect, but it has 2 drawbacks - it seems it doesn't support wireless NICs (our network is wireless) and you can't use VM locally. Advantage is VM could be accessed via local network. Any suggestions? Is there a huge performance difference between for example Linux Mint as host and Gentoo as a host?


title: Skip routing via `lo` interface for outgoing packets

text: ## Introduction I have following load balancing configuration:               10.0.1.31 - lb     10.0.1.35 - virtual IP     10.0.1.32 - node1 (tomcat + mysql)     10.0.1.33 - node2 (tomcat + mysql)      I'm using `keepalived` which is redirecting packets to active nodes - shared ip address is 10.0.1.35. lb has required config:               echo "net.ipv4.ip_nonlocal_bind = 1" >> /etc/sysctl.conf      node1 and node2 to handle properly incoming packets needs to have 10.0.1.35 on `lo`               [root@lb-node1 ~]# ip addr list dev lo     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN         link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00        inet 127.0.0.1/8 scope host lo        inet 10.0.1.35/32 scope global lo        inet6 ::1/128 scope host         valid_lft forever preferred_lft forever      ## Problem Due to the fact that we have 10.0.1.35 on the `lo` if the locale tomcat is trying to connect to mysql via lb - connection is established to local instance. I would like skip `lo` for outgoing packets ## Test From node1 which has disabled mysql service and 10.0.1.35 ip on `lo` interface I'm trying to connect to mysql on the node2. Unfortunately the result is                  [root@lb-node1 ~]# telnet 10.0.1.35 3306        Trying 10.0.1.35...        telnet: connect to address 10.0.1.35: Connection refused       of course if I remove 10.0.1.35 IP from lo interface I'm able to connect to mysql instance on node2 ## Solution(?) I was trying do add routes with appropriate metrics but it doesn't help :/                   [root@lb-node1 ~]# route -n         Kernel IP routing table         Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         10.0.1.0        0.0.0.0         255.255.255.255 UH    0      0        0 eth0         10.0.1.0        0.0.0.0         255.255.255.255 UH    100    0        0 lo         169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0         0.0.0.0         10.0.1.1        0.0.0.0         UG    0      0        0 eth0      ## @Patrick Solution               vip=10.0.1.35          ip route add local $vip dev lo table 10 proto kernel scope host     ip rule add to $vip lookup 10 prio 1     ip route del local $vip dev lo table local     ip rule add to $vip iif lo lookup main prio 0      ## @Patrick Solution Issue **Initial state** VIP + your ip route configuration, mysql is working on both nodes * * *               P Virtual Server version 1.2.1 (size=4096)     Prot LocalAddress:Port Scheduler Flags       -> RemoteAddress:Port           Forward Weight ActiveConn InActConn     TCP  10.0.1.35:http rr persistent 6     TCP  10.0.1.35:mysql rr persistent 6       -> 10.0.1.32:mysql              Route   10     0          0       -> 10.0.1.33:mysql              Route   10     0          2     UDP  10.0.1.35:snmptrap rr persistent 6       -> 10.0.1.32:snmptrap           Route   10     0          0       -> 10.0.1.33:snmptrap           Route   10     0          1                         root@lb-node1 ~]# mysql -h 10.0.1.35 -u test -p     Enter password:      Welcome to the MariaDB monitor.  Commands end with ; or \g.     Your MariaDB connection id is 126     Server version: 5.5.36-MariaDB-wsrep-log MariaDB Server, wsrep_25.9.r3961          Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.          MariaDB [(none)]> SHOW VARIABLES WHERE Variable_name = 'hostname';     +---------------+----------+     | Variable_name | Value    |     +---------------+----------+     | hostname      | lb-node2 |     +---------------+----------+     1 row in set (0.00 sec)          MariaDB [(none)]>                [root@lb-node2 ~]# mysql -h 10.0.1.35 -u test -p     Enter password:      Welcome to the MariaDB monitor.  Commands end with ; or \g.     Your MariaDB connection id is 133     Server version: 5.5.36-MariaDB-wsrep-log MariaDB Server, wsrep_25.9.r3961          Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.          ariaDB [(none)]> ;     ERROR: No query specified          MariaDB [(none)]> SHOW VARIABLES WHERE Variable_name = 'hostname';     +---------------+----------+     | Variable_name | Value    |     +---------------+----------+     | hostname      | lb-node2 |     +---------------+----------+     1 row in set (0.00 sec)          MariaDB [(none)]>       As you can see everything is working correctly. ## **Issue** But when I shut down currently active mysql server:               [root@lb-node2 ~]# service mysql stop     Shutting down MySQL.... SUCCESS!      [root@lb-node2 ~]#                     Every 2.0s: ipvsadm -l                                                                                Fri May  9 10:20:49 2014          IP Virtual Server version 1.2.1 (size=4096)     Prot LocalAddress:Port Scheduler Flags       -> RemoteAddress:Port           Forward Weight ActiveConn InActConn     TCP  10.0.1.35:http rr persistent 6     TCP  10.0.1.35:mysql rr persistent 6       -> 10.0.1.32:mysql              Route   10     0          0     UDP  10.0.1.35:snmptrap rr persistent 6       -> 10.0.1.32:snmptrap           Route   10     0          0       -> 10.0.1.33:snmptrap           Route   10     0          1      I cannot connect to mysql from both nodes               [root@lb-node2 ~]# mysql -h 10.0.1.35 -u test -p     Enter password:           .....       It seems to me that node1 is not accepting incoming packets, because load balancer is correctly redirecting packets               [root@lb-node1 ~]# tcpdump -i eth0 'port 3306' and src 10.0.1.33 or dst 10.0.1.33     tcpdump: verbose output suppressed, use -v or -vv for full protocol decode     listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes     10:35:26.915640 ARP, Reply 10.0.1.35 is-at 52:54:00:30:a3:4b (oui Unknown), length 28     10:35:26.915987 IP 10.0.1.33.38517 > 10.0.1.35.mysql: Flags [S], seq 2024730796, win 14600, options [mss 1460,sackOK,TS val 1298907 ecr 0,nop,wscale 7], length 0     10:35:27.914788 IP 10.0.1.33.38517 > 10.0.1.35.mysql: Flags [S], seq 2024730796, win 14600, options [mss 1460,sackOK,TS val 1299907 ecr 0,nop,wscale 7], length 0     10:35:29.914784 IP 10.0.1.33.38517 > 10.0.1.35.mysql: Flags [S], seq 2024730796, win 14600, options [mss 1460,sackOK,TS val 1301907 ecr 0,nop,wscale 7], length 0      What is strange because still I have VIP on lo               [root@lb-node1 ~]# ip addr list dev lo     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo         inet 10.0.1.35/32 scope global lo         inet6 ::1/128 scope host             valid_lft forever preferred_lft forever                    [root@lb-node1 ~]# ip route     10.0.1.0/24 dev eth0  proto kernel  scope link  src 10.0.1.32      169.254.0.0/16 dev eth0  scope link  metric 1002      default via 10.0.1.1 dev eth0


title: ssh: execute a command before login

text: I am looking for a way to execute a local command when logging into a remote machine via SSH. (I want to stay logged in after the command has finished.) In other words, I want to specify the command on my command line. It should be executed on the remote machine and then I should get the shell, as if I had logged in normally. For instance, let's say, I want to mount `/home` on the remote machine before I get the shell. I would do something like this (which does not work well)               ssh mymachine.example.com 'mount /home ; /bin/bash'      In effect, I am looking for a way how to condense the following two commands into one:               ssh mymachine.example.com 'mount /home'     ssh mymachine.example.com      Does anybody have any idea how to do it? **IMPORTANT** : I don't want to store the command-to-be-executed on the remote machine. It must be stored locally (perhaps it contains my password to de- crypt the encrypted home.)


title: How to combine Bash's process substitution with HERE-document?

text: In Bash version 4.2.47(1)-release when I try to catenate formatted text that comes from a HERE-dcoument like so:               cat <(fmt --width=10 <<FOOBAR     (I want the surrounding parentheses to be part of the HERE-document)     (Even the preceding unbalanced parenthesis should be part of it.     FOOBAR     ) # I want this paranthesis to end the process substitution.      I get the following error:               bash: bad substitution: no closing `)' in <(fmt --width=10 <<FOOBAR     (I want the surrounding parentheses to be part of the HERE-document)     (Even the preceding unbalanced parenthesis should be part of it.     FOOBAR     )      Also I do not want to quote the HERE-document, i.e. write `<'FOOBAR'`, because I still want to have variables being substituted within it.


title: Can't connect to WiFi

text: I recently installed Arch but didn't set it up yet. In particular, I can't connect to WiFi, although it's visible (in Arch). When I click on it, nothing happens. What might be the issue?               $ ip addr     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo            valid_lft forever preferred_lft forever         inet6 ::1/128 scope host             valid_lft forever preferred_lft forever     2: enp5s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000         link/ether 28:d2:44:16:42:e5 brd ff:ff:ff:ff:ff:ff     3: wlp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000         link/ether 68:17:29:70:56:cf brd ff:ff:ff:ff:ff:ff         inet6 fe80::6a17:29ff:fe70:56cf/64 scope link             valid_lft forever preferred_lft forever


title: KVM and Swap space

text: suppose the following scenario: a host with 2 GiB runs a few guests using KVM. Each guest does usually not need much memory, they are given 256 MiB each and run services that mostly twiddle their thumbs. However, occasionally the guests need more memory. Right now, each guest has little RAM but its own swap space. I noticed that a small portion of swap is used. I never had problems with that konfiguration, but just out of curiosity: What is the optimal swap allocation strategy?   1. Assign each guest its own swap space from their respective disks, and assign the guests only little memory from the host. (This is what I am doing now.)   2. Assign the host a larger amount of swap space and none to the guests, and assign more memory to the guests. Would memory ballooning help to improve memory performance?


title: visit all directories under version control

text: Is there a `find` incantation that would allow me to visit all directories under SVN version control? I am trying to use the `execdir` switch to add to the `svn:ignore` property in each one of these directories. Something like:               find . -type d -execdir svn propset svn:ignore -F <((svn propget svn:ignore; echo "new ignore pattern") | sort -u) .' \;      but I can't get to limit `find` to only SVN directories.


title: Why BitchX is called BitchX?

text: Well, the title is pretty much self-explanatory, but for sake of completeness, I'm curious to know the reason for the name of `BitchX`. I searched on internet for etymology but it was a fail. I hope this question is not drastically off-topic.


title: I've installed a Public Key, but my login doesn't ask for the passphrase

text: I'm following this tutorial SSH Tutorial for Linux I've manually transfered the public key to the remote server and I ran these commands also because it wasn't asking me for my passphrase. `chmod 700 ~/.ssh` &   `chmod 600 ~/.ssh/authorized_keys` But still it doesn't ask me for my passphrase. I tried the newer automatic way to install the public key `ssh-copy-id -p 2222 yourusername@your.website.com` and got this error message: > Bad port 'umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> > ~/.ssh/authorized_keys && (test -x /sbin/restorecon && /sbin/restorecon > ~/.ssh ~/.ssh/authorized_keys >/dev/null 2>&1 || true)' **Is this error because I've already transferred it manually?** I ran `ssh` login with `-v` these are the mentions of `public key`:**               debug1: Authentications that can continue: publickey,password,keyboard-interactive     debug1: Next authentication method: publickey     debug1: Offering DSA public key: /home/localusername/.ssh/id_dsa     debug1: Authentications that can continue: publickey,password,keyboard-interactive     debug1: Trying private key: /home/localusername/.ssh/id_rsa     debug1: Trying private key: /home/localusername/.ssh/id_ecdsa     debug1: Next authentication method: keyboard-interactive      **I'll note this is prior to logging in.**


title: How to calculate the volume of data transferred between two Unix machines

text: I have two Linux machines that keep pinging each other. With each ping request they attach a data packet in the response. The frequency of the pings can not be determined. How do I determine how many GB's of data they transfer to each other via the Network ?


title: How to identify which xterm a shell or process is running in?

text: I usually use long running X sessions with several virtual desktops and many many xterms. I also use job control in the shell (zsh). Sometimes I wish I could identify an xterm a shell or process is running in (or even suspended in) with a simple command. For example, you edit a file with vim and vim warns you that it is already opened with another vim instance which is still running. But now you have forgotten in which xterm this vim with process-id XYZ was started and suspended. Killing it does not work, because it is suspended. Resuming it via a signal and then killing could work, but it may screw up an in-foreground running process and perhaps you don't want to kill the vim instance because it has several windows set up ... Currently I am using awesomewm, but I am also interested in solutions for other wms.


title: Understanding ifconfig stats

text: Please help me understand `ifconfig` stats, in particular over what time period are they? From the example below the combined receiving bytes for both interfaces is 7.7 GiB. Is that since midnight? since the last reboot? since ...? Also eth1 is showing ~500k dropped packets, about 15% of the total received in the same line. This looks bad to me, is it?               [~] # ifconfig     bond0     Link encap:Ethernet  HWaddr 00:08:9B:D3:02:6A               inet addr:123.123.123.123  Bcast:192.168.255.255  Mask:255.255.255.0               inet6 addr: fe80::208:9bff:fed3:26a/64 Scope:Link               UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1               RX packets:30550094 errors:0 dropped:498787 overruns:0 frame:0               TX packets:32564187 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:0               RX bytes:8321227191 (7.7 GiB)  TX bytes:16056647508 (14.9 GiB)          eth0      Link encap:Ethernet  HWaddr 00:08:9B:D3:02:6A               UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1               RX packets:27193387 errors:0 dropped:0 overruns:0 frame:0               TX packets:18205770 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:7754199970 (7.2 GiB)  TX bytes:9436506547 (8.7 GiB)               Interrupt:16 Memory:fbc00000-fbc20000          eth1      Link encap:Ethernet  HWaddr 00:08:9B:D3:02:6B               UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1               RX packets:3356710 errors:0 dropped:498455 overruns:0 frame:0               TX packets:14358417 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000               RX bytes:567027413 (540.7 MiB)  TX bytes:6620140961 (6.1 GiB)               Interrupt:20 Memory:fbd00000-fbd20000     ...snip...


title: Is it possible to know when you're at the first bash prompt of a terminal?

text: This is sort of a contiunation of my last question: printing saving the last bash input command Now I want to know if it's possible to know when you're at the first bash prompt of a terminal. So I'm displaying the last command run above the current prompt. And I'm thinking it would be cool if when you're at a fresh terminal, to display the last N commands. I guess I could just echo the last commands inside my `.bashrc`, but that doesn't seem like a good idea. And also it'd be cool to get the last N commands shown when the scrollback is cleared (via `clear`). Is any of that (reasonably) possible?


title: What is meant by mounting a device in Linux?

text: I've heard the term "mounting" when referring to devices in Linux. What is its actual meaning? How it handling now unlike older versions? I haven't done that manually via the command-line. Can you give the steps (commands) for mounting a simple device in Linux?


title: Why does 'set' syntax not work for syntax highlighting in vim?

text: On searching how to set syntax highlighting on in vim, I found this page which says that vimrc should have the following line               syntax on      **Why is it not something like`set syntax on`?** Like we have `set nu`, `set ai` etc. With `set syntax on`, I get this error               $ vi       syntax=     Error detected while processing /home/lazer/.vimrc:     line   30:     E518: Unknown option: on     Hit ENTER or type command to continue      and with `set syntax`, I get this               $ vi       syntax=     Hit ENTER or type command to continue


title: Kernel debugging

text: I would like to study the flow of some linux device drivers and some minimal flow of kernel (threading cum context switching and interrupt management). How can I debug the linux kernel? What are the basic steps for doing that? Recently i successfully compiled and integrated new kernel (2.6.34.7) into my machine running the 2.6.29 kernel.


title: Why I cannot disconnect internet

text: When I run the command               nmcli dev disconnect iface eth0      to disconnect the internet connection, it is disconnected and and after a few sconds the KDE network icon changes to ![enter image description here](http://i.stack.imgur.com/RSBAs.jpg) and internet is connected (because I'm posting this question). I'm using Ubuntu 14.04 64bit


title: Python compile error on openSUSE: no module named wx

text: I'm new to Linux. After installing openSUSE I'm trying to make my VPN software running. I've followed the site's direction: > Unpack the general package [Other / Source code], install OpenVPN and > resolvconf and start it like this: `sudo python mullvad.py`. But when I type that in terminal, I get this error: `no module named wx`. I have already spent a lot of time figuring out how to compile it, to no avail. Before I turn to another Linux distribution or go back to Windows, I would be grateful if anyone could answer these questions: What is `wx module` and how can I add it? And, is the software compilable in openSUSE at all?


title: How do I prevent GRUB from using/starting any graphical UI?

text: I have a problem with an older Laptop (Fujitsu Siemens LifeBook S6010, to be precise) and an Ubuntu (10.10, Xubuntu desktop) installation (fresh install). During installation the graphics hardware was mis-detected and it now is completely impossible to boot the system into GUI. Any attempt to invoke graphics mode will freeze the machine. Therefore I'd like to boot the machine into text mode to see if I can fix the graphics issue — probably material for another question, if and when I get there. However, I was unsuccessful at telling GRUB (1.98) to _not use any graphics, at all_. I can get to the GRUB menu and edit one of the available boot configurations, but whatever I tried to express "text only", everything failed (i.e. machine still invokes graphics during boot and promptly becomes unusable). I have no easy other way to get into the machine (it cannot not boot from CD or USB, for example). So: What do I need to do to tell GRUB _at the boot menu_ to stop it from using any fancy stuff and get me to a text console?


title: Displaying all sysvinit init scripts

text: Is there some tool that displays all available init scripts (on Debian), short of one having to remember a location like `/etc/init.d`, not to mention that not everything in there is an init script?


title: Aliases vs functions vs scripts

text: This site says, "Shell functions are faster [than aliases]. Aliases are looked up after functions and thus resolving is slower. While aliases are easier to understand, shell functions are preferred over aliases for almost every purpose." Given that (true or not), how do shell functions compare to standalone shell scripts? Does one have particular advantages over the other, or better suited for certain types of tasks?


title: How is file ownership affected across different systems?

text: As I understand Unix file systems, any file on a unix system must belong to a group and a user of the said system. A file cannot belong to a group or user that does not exist on the system. From that assumption, there are a few questions that come to mind. What happens to the group and user attributes when media is transferred between computers, be it via a flash drive, a CDROM or a network share. To whom does the file belong in the new system? Can you limit the data to only work on your system? (Not talking about encryption here, just basics.) Also, when you transfer data between two computers, are there ways to ensure that the group and user attributes stay intact (what belongs to root will belong to root on the new system and the same with the normal user).


title: What does genfstab's -p option do?

text: While following this guide to installing Arch Linux the reader is instructed to execute the following command:               genfstab -U -p /mnt >> /mnt/etc/fstab      It is stated the the `-U` option uses UUID's over labels, but what does the `-p` option do? I have Googled it and can only find a page on fstab itself, not its generator. Arch includes no manpage on the subject... if anyone knows where docs on `genfstab` are, can they please provide a link? If not, can someone tell me what the options are or what the options do (primarily the `-p` switch)?


title: tar list files only

text: Fun fact: If you use _Archive Manager_ and extract a .tar.gz so that you have "Keep directory structure" unticked, you will get a _tarbomb_. `tar -ztf` lists all the files and directories in a tar file. Is there a way to list all the files in a tar file, **without** the directory structure?


title: Last data traffic time for a TCP socket

text: Is it possible, to find out when was the last time there was any traffic on an opened TCP socket? Keepalive and timeout timers are based on this statistic, so I guess it has to be stored somewhere. OS is Ubuntu 14.04


title: find command: -or option doesn't work

text: I want to execute a command for an each file that matches a pattern. But the command that seems to be right, doesn't work for me, I have no idea why.               $ find . -type f -name '*.c' -or -name '*.h' -or -name '*.cpp' -exec ls {} \;     $ ls     script.sh  test.c  test.h


title: lilo, install in target-mbr from another system

text: I have a embedded system (short ES) on a cf-card (short CFC). I plugged the CFC into the cardreader of my notebook. Sure the devices of my notebook are not the same then in the ES. Now the mainboard of the changed and the CF-card is connected to another controler (other /dev/hdX). So I am not able to boot the ES from the CFC, because of other kernel parameters (hdd device). I mounted the CFC on the notebook and changed the lilo.conf but now I am not able to reinstall the new config into the CFCs MBR. I tried parameter -M but lilo checks that the device-names in the lilo.conf on the CFC are not the same that on my notebook. e.g. I try to install on /dev/sdc (the CFC on my notebook) but the root- parameter in lilo.conf is (dev/hda) because the system is running on the ES, not my notebook. So, how can I tell lilo to install in a MBR with parameters of my target system (ES)??


title: Making the Spotify Linux client (for Debian) run on RHEL

text: I'm trying to convince the Spotify Linux client to run from my home directory on a RHEL 6 machine (I don't have root privs, and running the Windows client through Wine results in audio stutter since the only audio driver available is the PulseAudio driver). I've extracted the data from the deb file and put them in my custom software prefix `~/sw/`. The binary finds all the necessary libraries but doesn't start cleanly. When I invoke the binary, an error dialog saying "Failed loading skin" pops up, and the following is written to the terminal:               14:27:25.770 I [breakpad.cpp:36] Registered Breakpad for product: spotify          14:27:25.925 I [translate.cpp:117] Reloading all languages     14:27:25.925 E [core-utilities:862] Loading of skin file(core.splang) failed ''(basepath: )     14:27:25.925 E [core-utilities:862] Loading of skin file(desktop.splang) failed ''(basepath: )     14:27:25.925 E [core-utilities:862] Loading of skin file(spider.splang) failed ''(basepath: )     14:27:25.926 I [breakpad.cpp:94] Searching for crashdumps: /ltg/arnskj/.cache/spotify/*.dmp          14:27:25.951 E [core-utilities:862] Loading of skin file(skin.xml) failed ''(basepath: )      All three splang files and skin.xml are present in `~/sw/share/spotify/theme/default` but it obviously doesn't find them (the Debian package installs them to `/usr/share/spotify/...`). Is there some way I can convince Qt to check additional directories when doing this? Or, as a last resort, does anyone know which Qt function is doing this, so that I can try to fudge it with a shim in $LD_PRELOAD (nasty, I know, but it might work).


title: Converting DOS text files to Unix

text: I have a bunch of PHP scripts that are in DOS format (`vi` displayed `[noeol] [dos]` in the status line) and as expected they weren't usable. I ran `dos2unix` over them to fix the line endins:               dos2unix index.php      but when I open the files in `vi` I still see `[noeol]` on the status line. Upon checking them in vi's hex editor mode (`:%!xxd`) I don't see anything that jumps out at me. In the original files the line ends looked like: `0x0D 0x0A` If after running through `dos2unix` they look like: `0x0A` I also checked to ensure that the last line of the file has a proper end of line and that's there too (`0x0A`). What else could be causing this, should I worry? I'm running CentOS 5.6 x64.


title: mount become corrupted over time

text: I have an external USB ntfs file system mounted to a linux server (4TB drive). Another server remotely RSYNCs a backup to this drive through the linux server. After a couple of days of this backup CRONing successfully, I will tail a backup that's occurring and notice that it is trying to sync a lot of files that are already synced! Then, on the destination server I will log in and see if I can "ls" this mounted drive and I get this error:               ls: cannot access archive: Input/output error mount linux      I've made the mount-point immutable, so that anytime the mount isn't working, no files will get written to the root partition of the server. So, I don't know where rsync thinks its syncing to, but it doesn't seem to realize that the drive isn't properly mounted. After this, I umount that drive then do a "mount -a". Then, the next cron backup goes successfully, but after a couple of days, the problem recurs. It seems like, the destination server thinks the drive is mounted fine, but actually it is mounted in some corrupt way (over time). Unmounting and mounting again make the problem go away for a while, but how do I go about figuring out how to fix this permanently? By the way, I have another 4TB USB NTFS external hard drive (same brand: same everything) mounted for another user, with a cron backup going, and it never has this issue. They are mounted the same way except having different UUIDs and userIDs in fstab entry. How can trouble shoot this. The mount seems to become ineffective over time. I wish it would unmount itself when it becomes in this state (so that the backup script could mount it cleanly next cron). Maybe I should umount it at the end of the backup script, so that it gets freshly mounted each try, rather than it thinking it is mounted fine when it actually is corruptly mounted. Please advise. **Update 1:** I'm reading this right now (seems related): http://ask.metafilter.com/36580/Why-wont-my-USB-hard-drive-stay-mounted- without-constant-disk-access **Update 2:** I'm still having this issue. I created a file called mountStamps.txt on the root of the external hard drive's file system and added this chron job:               0,30 * * * * date >> /mnt/mountpoint/mountStamps.txt      However, even while the mount is in this bad state it is able to write to this file located on the root of the external hard drive's files system. And while these I/O errors are occurring, I can often ls to see the root of that file system, but when I go any deeper I get i/o errors. So the is drive mounted enough to see the root of its filesystem, but going deeper cause I/0 errors. Of course, as I mentioned, if I umount and mount again, the errors go away for a while, but return at some point there after.