shell commands to check & create dir

I am writing a Ruby script inside which I would like to invoke/execute some **shell commands**. The shell commands I would like to run should check if a directory named ' **tmp** ' under `/var/lib/mysql/` exists or not.   * if it exists, remove all the files (including sub-dirs & files) inside `/var/lib/mysql/tmp/`.    * If it does not exist, just create it. ( **P.S.** only root user can access `/var/lib/mysql/`) I know `mkdir` will create directory, but I am not sure **how to make a command to check if the directory exists or not**. As a whole, I would like to have some shell commands to achieve the scenario described above, and **the more elegant way the better** , as I will run the shell commands in a ruby script. Anyone can Help me ?


How to retrieve information about locked accounts

Is it possible to retrieve info regarding to locked unix accouts? I am interested in seeing information about what date and time the lockout happend and from what hostname (pc name). I would like to see something similar to the `who` command.


trying to setup cntlm on ubuntu for NTLM authentication

I am trying to setup cntlm on ubuntu13 for NTLM authentication. I used apt-get install to setup ctlm. My cntlm.conf file in the etc directory is copied below - the username/domain and password are correct (I have tested them with a different application). **cntlm.conf**                   # Cntlm Authentication Proxy Configuration              Username        account         Domain          xxxxxx.com         Password        password              # Workstation   netbios_hostname             Proxy                xxx.xxx.xxx.xxx:3128         ###Proxy                10.0.0.42:8080              NoProxy         localhost, 127.0.0.*, 10.*, 192.168.*, 0.0.*              Listen          3128              #SOCKS5Proxy    8010         #SOCKS5User     dave:password              #Auth           NTLM2         #Flags          0x06820000              #Gateway        yes              #Allow          127.0.0.1         #Deny           0/0              #ISAScannerSize     1024         #ISAScannerAgent    Wget/         #ISAScannerAgent    APT-HTTP/         #ISAScannerAgent    Yum/              #Header         User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)         #Tunnel         11443:remote.com:443      **Error Message in /var/log/syslog:**               Proxy returning invalid challenge!      cntlm is running on port 3129 (squid running on port 3128). I pointed IE to use the proxy on the IP address and port number for cntlm (I tried with squid as well) - however, the connection times out. Any suggestions on troubleshooting this will be appreciated.


RELATED,ESTABLISHED state in iptables

What do the words 'RELATED' and 'ESTABLISHED' individually signify in RELATED,ESTABLISHED state in iptables?


Apply astyle on commited files using SVN hooks

I would like to apply some styling to code whenever someone commits to an SVN repository, for this I use `astyle` on the commited changes with an svn `pre- commit` hook. I can get the file names like this, but when I apply astyle, it seems the program cannot get the data from within the files:               for FILE in $($SVNLOOK changed -t "$TXN" "$REPOS" | cut -b 5-); do              # echo $REPOS/$FILE 1>&2             # prints the files' paths             astyle --style=gnu -n $FILE     done          # commit the changes from astyle here      Any idea how can I achieve this?


`ln -s` creates a symlink inside an existing folder instead of failing?

`$mkdir lnTest1 lnTest2` `$ln -s lnTest1 "lnTest2"` There is NO slash at the end of "lnTest2"!!               $ls lnT* -Rl |sed "s'$USER''g"     lnTest1:     total 0          lnTest2:     total 0     lrwxrwxrwx 1   7 Jun 22 22:48 lnTest1 -> lnTest1


log_success_msg: not found while booting with in initramfs

I use the log_success_msg in a script which is into the init-bottom directory of my customized initramfs. I get the following error message:               /scripts/init-bottom/__rootaufs.sh: line 154: log_success_msg: not found      This function is described into my initramfs-tools manpage. Additional information: Debian Wheezy and initramfs-tools Version 0.109.1 What do I miss. Should I call something to enable the log_success_msg function (and other similar functions) ?


using SUID bit to drop privileges

So this is a description of the system I'm working on :   * a "manager" process spawns all the other applications.   * The manager application runs as `root` user.   * so now, any process that it spawns also inherit `root` user privileges. The third point is clearly makes my application (let's call it 'player') a security risk so one solution would be to create a separate user and group, say 'worker' and then spawn the 'player' process as that user. The specific implementation is as follows :   * `chown` the binary (player.out) to the `worker` user and group `chown worker:worker player.out`   * set the SUID bit on it with `chmod a+s player.out`.      * this ensures that the process is started with (atleast) it's EUID set to 'worker'.   * inside the application main use `setregid()` and `setreuid` to set the RUID to the same value as the EUID :              if(setregid(getegid(), getegid()) != 0) {}     if(setreuid(geteuid(), geteuid()) != 0) {}      My question is in two parts :   1. Processes with SUID bit set are usually owned by `root` and are called setuid-applications to denote (possibly) that their permissions are elevated to root user irrespective of which user invoked the program.      * is there any special name for binaries that use the SUID bit to automatically _drop_ priveleges?   2. Is there any other, better way to ensure that the 'player' application drops priveleges? **Edit** : I should clarify that I have no control over the "manager" process that spawns the other processes. I only have control over my `player` application.


Yum and recommended/suggested packages

I'd like to install a software package on my _Fedora_ System, but it has a lot of unreasonable dependencies (which I know for sure they are not actually required). I used to work on _Debian_ , where _apt-get_ allows you to systematically exclude **recommended** and **suggested** packages, installing only the strictly required dependencies. Is there a way to do so with _Yum_?


How to configure gpg2 to pass smartcard PIN unless pinentry programm?

My configuration:   * Centos 6.5   * gnugp2-2.0.14-6.el6_4.x86_64   * gnupg2-smime-2.0.14-6.el6_4.x86_64 I configured `gpg2` to use my signature key in smartcard gnupg V2.0. I imported my gpg signature key to the rpm store. I need to sign an rpm package using `rpm --addsign myApp.rpm`. It works fine, but `rpm` prompts once for the smartcard PIN, and `gpg2` (with `pinentry` programm) prompts three times for the smartcard PIN. I expected that `rpm --addsign` passes the PIN (get in first prompt) to `gpg2` and `gpg2` doesn't ask again for the PIN. Is it possible to have only _one_ prompt to sign the rpm package with `gpg2`?


Using mutt and not revealing IP address

Here is `mutt` setup: I use `offlineimap` to fetch the mail and use `msmtp` to send the mail. My concern is that when using this (`msmtp`), it appends my IP address in the header in every email that is sent. Since `msmtp` doesn't support a `SOCKS` proxy, I can't use a SSH tunnel to my VPS. Is there anyway I can configure this setup to not reveal my IP address by using some sort of a tunnel to my VPS so that its IP is revealed and not mine? I searched a lot but the closest I could find was a SSH tunnel but I guess that was for the case if I was using `mutt`'s inbuilt `SMTP` support and not a MTA such as `msmtp`.


How to split stdout to go to several output files?

Say, I have a command `command` which prints huge number of lines to stdout:               line1     line2     .....     lineN      I want to save the output to disk, but not as a single file, but as a sequence of files each having 1000 lines of stdout:               file0001.txt:     -------------     line1     ....     line1000          file0002.txt:     -------------     line1001     ....     line2000          etc      I've tried to google the answer, but every time google points me to `tee` command, which is useless in this situation. Probably, I'm entering wrong queries.


How to disable "Shake password dialog when authentication fails" of Gnome Screensaver?

Is there any way to disable the animation which occurs when attempting to unlock gnome Screensaver and failing? Currently the password dialog shakes back and forth and for some reason on some laptops, this animation causes the entire system to be unresponsive for about 5 - 7 seconds. Can be very frustrating because it increases the chances of a second, third, etc mistyped passsword. I'm currently on Fedora 11 but this issue also occurs in Ubuntu. The Ubuntu change log calls this feature "Shake the dialog when authentication fails"               gnome-screensaver (0.0.17-0ubuntu1) dapper; urgency=low            …           * New upstream release:         - 0.0.16:           - Shake the dialog when authentication fails           …           -- Daniel Holbach <daniel.holbach@ubuntu.com>  Mon, 24 Oct 2005 21:14:22 +0200


Detecting images containing only black pixels

I am looking for a method for detecting if an image contains only black pixels. When I say method I mean an existing command line tool. I could write up something myself but I'm sure something probably exists already.


Why does cd default to ~?

When you type `cd`, it basically does the same thing as `cd ~`. Why? I'm wondering if it's just a hard-coded behavior or if bash is expanding the command or something.


What is the meaning of this test expression []?

I've seen someone use command:                ps -ef | grep [h]ttpd  and Output is:               apache   25125 31006  0 21:54 ?        00:00:00 /usr/sbin/httpd     apache   26869 31006  0 22:04 ?        00:00:00 /usr/sbin/httpd     apache   27349 31006  0 22:07 ?        00:00:00 /usr/sbin/httpd     apache   27696 31006  0 22:09 ?        00:00:00 /usr/sbin/httpd     apache   28534 31006  0 22:14 ?        00:00:00 /usr/sbin/httpd     root     31006     1  0 16:16 ?        00:00:00 /usr/sbin/httpd     apache   31011 31006  0 16:16 ?        00:00:00 /usr/sbin/httpd      2 brackets surrounding the letter "h" where the `grep` to do?


What does this process STAT indicates?

![enter image description here](http://i.stack.imgur.com/7M4pP.png) If you check the `STAT column` in above image you will see `Ss S S< SN and R+` What does this indicates ? `Process states`. If yes,Then what is the significance of `'Ss S< SN and R+'`?


gvim colors the same as is the terminal

Is there a command I can put in the `.vimrc` to make gvim look like vim's setup in the terminal? Same back ground, syntax highlighting, colors, and font. To add to my question, is there a may for gvim to follow vim's vimrc? That is, there layouts and actions are identical?


Apache ownership and permissions for wordpress

I'm new to running a VPS, but I managed to get the whole system setup and secured without any issues :) My question concerns Apache and the different ways it can operate. For this particular machine I am the only user, and I will be using the box mainly to run WordPress on a LAMP Stack with Ubuntu 12.04.3 LTS. I have Apache installed and it is running as the `www-data` user. For the purposes of this example, lets call my user `foo`. If I just set up a base configuration of WordPress, the system won't be able to write to the directories, for reasons I still don't quite understand, because `www-data` is the Apache user, and isn't `foo`, the owner of the files. From what I understand, I **don't** want to make my files owned by `www-data` as this can be very dangerous and insecure. However, might it be a good idea to make my files group writable, or is that not the best option either? If someone could shed a little light on the workings of Apache for a newbie like myself, that would mean a lot, as well as the best configuration to put my server in so that the files are writable by my user but can be accessed by applications such as WordPress.


git push fails with remote: error: hook declined to update refs/heads/master

I'm recently trying to start my own project on a community git repo, and I've been having some complications. I'm new to git, but here's what I've been trying to do to just test it. I run the following commands and they all run ok.               git config --global user.name "MYNAME"     git config --global user.email "MYEMAIL"     mkdir testproject     cd testproject     git init     touch README     git add README     git commit -m 'first commit'     git remote add origin git@git.xxxxx.org:community/testproject.git      and all of the above commands run with no error. However, when I the run the next command I get a huge error.               git push -u origin master      and the error is.               Counting objects: 3, done.     Writing objects: 100% (3/3), 204 bytes | 0 bytes/s, done.     Total 3 (delta 0), reused 0 (delta 0)     Username for 'http://git.xxxxxx.org': MYEMAIL     Password for 'http://MYEMAIL.com@git.xxxxxx.org':      remote: /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.1.0 in any of the sources (Bundler::GemNotFound)     remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!'     remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize'     remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'     remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'     remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'     remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in `requested_specs'     remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:13:in `setup'     remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'     remote:         from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'     remote:         from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'     remote:         from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'     remote: error: hook declined to update refs/heads/master     To http://git.xxxxxx.org/community/testproject.git      ! [remote rejected] master -> master (hook declined)     error: failed to push some refs to 'http://git.xxxxxx.org/community/testprojact.git'      I'm not really sure what to do from here, but any help is much appreciated. Also, I'm running Arch if it matters. **Edit:** I've tried re-installing rake and it didn't work. My current version of rake was 10.1.1, so I tried removing it and replacing it with version 10.1.0 and that also didn't fix it. However when I was installing rake, I got an error:               WARNING:  You don't have /home/josh/.gem/ruby/2.0.0/bin in your PATH,               gem executables will not run.      Could this be contributing to the problem?


What is transaction check in Yum installation

What is the "Transaction Test" that will be done during installation using yum? Please explain with details..


Ubuntu Kernel Compilation?

I'm trying to compile and install kernel 3.13.1 on ubuntu 13.10 using following commands:               sudo apt-get install gcc      sudo apt-get install libncurses5-dev      cd Downloads/      sudo tar -xvf linux-3.0.tar.bz2 -C /usr/src/      cd /usr/src/linux-3.0/      sudo make menuconfig      sudo make oldconfig      sudo make       After the last command it gets compiled, but when I try to install that using the command:               sudo make modules_install install       is gives an error saying: > file 'include/config/auto.cnfig.cmd' has modification time 3.6e+04 sec in > future   >  cannot stat /usr/src/linux/modules.builtin no such file or directory exist Can anyone help me out installing that?


How to make sudo use root password for some commands and user password for others

I know in `/etc/sudoers`, one can put _Defaults rootpw_ , but then `sudo` asks for the root password for all commands. Is there any way I can have `sudo` ask for the root password for some commands and the user password for others?


OS errors : kernel: EDAC k8 MC0: extended error code: ECC chipkill x4

We noticed the server crashes with below errors. Not sure it is related to any defected piece of the hardware or totally not related to Server detail:Red Hat Enterprise Linux ES release 4 (Nahant Update 6) [root@athena log]# uname -a Linux athena.nsdecatur.local 2.6.9-67.0.7.ELsmp #1 SMP Wed Feb 27 04:47:23 EST 2008 x86_64 x86_64 x86_64 GNU/Linux # messages               Sep 17 15:08:16 athena kernel: EDAC k8 MC0: general bus error: participating processor(local node response), time-out(no timeout) memory transaction type(generic read), mem or i/o(mem access), cache level(generic)     Sep 17 15:08:16 athena kernel: MC0: CE page 0x2c2766, offset 0xb10, grain 8, syndrome 0xac08, row 1, channel 0, label "": k8_edac     Sep 17 15:08:16 athena kernel: MC0: CE - no information available: k8_edac Error Overflow set     Sep 17 15:08:16 athena kernel: EDAC k8 MC0: extended error code: ECC chipkill x4 error     Sep 17 15:08:17 athena su(pam_unix)[19579]: session opened for user oracle by (uid=0)     Sep 17 15:08:17 athena su(pam_unix)[19579]: session closed for user oracle     Sep 17 15:08:17 athena su(pam_unix)[19634]: session opened for user oracle by (uid=0)     Sep 17 15:08:17 athena su(pam_unix)[19634]: session closed for user oracle     Sep 17 15:08:18 athena kernel: EDAC k8 MC0: general bus error: participating processor(local node origin), time-out(no timeout) memory transaction type(generic read), mem or i/o(mem access), cache level(generic)     Sep 17 15:08:18 athena kernel: MC0: CE page 0x39c857, offset 0xd50, grain 8, syndrome 0x1cc8, row 1, channel 0, label "": k8_edac     Sep 17 15:08:18 athena kernel: MC0: CE - no information available: k8_edac Error Overflow set     Sep 17 15:08:18 athena kernel: EDAC k8 MC0: extended error code: ECC chipkill x4 error     Sep 17 15:08:18 athena su(pam_unix)[19715]: session opened for user oracle by (uid=0)     Sep 17 15:08:18 athena su(pam_unix)[19715]: session closed for user oracle     Sep 17 15:08:18 athena su(pam_unix)[19758]: session opened for user oracle by (uid=0)     Sep 17 15:08:19 athena su(pam_unix)[19758]: session closed for user oracle     Sep 17 15:08:20 athena su(pam_unix)[19807]: session opened for user oracle by (uid=0)     Sep 17 15:08:20 athena su(pam_unix)[19807]: session closed for user oracle     Sep 17 15:08:20 athena su(pam_unix)[19850]: session opened for user oracle by (uid=0)     Sep 17 15:08:20 athena su(pam_unix)[19850]: session closed for user oracle     Sep 17 15:08:20 athena kernel: EDAC k8 MC0: general bus error: participating processor(local node origin), time-out(no timeout) memory transaction type(generic read), mem or i/o(mem access), cache level(generic)     Sep 17 15:08:20 athena kernel: MC0: CE page 0x39c857, offset 0xd50, grain 8, syndrome 0x1cc8, row 1, channel 0, label "": k8_edac     Sep 17 15:08:20 athena kernel: EDAC k8 MC0: extended error code: ECC chipkill x4 error     Sep 17 15:08:21 athena su(pam_unix)[19899]: session opened for user oracle by (uid=0)     Sep 17 15:08:21 athena kernel: EDAC k8 MC0: general bus error: participating processor(local node origin), time-out(no timeout) memory transaction type(generic read), mem or i/o(mem access), cache level(generic)     Sep 17 15:23:54 athena syslogd 1.4.1: restart.     Sep 17 15:23:54 athena syslog: syslogd startup succeeded     Sep 17 15:23:54 athena kernel: klogd 1.4.1, log source = /proc/kmsg started.


Is VMWARE_BALLOON (Linux kernel option) intended for guests or hosts?

The kernel configuration option: > >     VMware Balloon Driver (VMWARE_BALLOON) [N/m/y/?] (NEW) ? >   >     CONFIG_VMWARE_BALLOON: >   > > This is VMware physical memory management driver which acts like a "balloon" > that can be inflated to reclaim physical pages by reserving them in the > guest and invalidating them in the monitor, freeing up the underlying > machine pages so they can be allocated to other guests. The balloon can also > be deflated to allow the guest to use more physical memory. > > If unsure, say N. > > To compile this driver as a module, choose M here: the module will be called > vmw_balloon. >   >   >     Symbol: VMWARE_BALLOON [=n] >     Type  : tristate >     Prompt: VMware Balloon Driver >       Defined at drivers/misc/Kconfig:428 >       Depends on: X86 [=y]   >       Location: >         -> Device Drivers >           -> Misc devices >   It's not fully clear, but it sounds like this should be set in the kernel of the guest OS, and not the host. Is this right?


How can I move files from my host system to Whonix-Workstation?

I'm not sure if using the guest additions is safe, but it seems to be the only way to transfer files. I cannot even get copy/paste to work between host and workstation.


Merging two different files with conditions

I have two different files as shown below. Content of `a.txt`:               HDR|1||||||||||                    DTL|@|||||||||||                  TLR|||||||||||||                   HDR|1||||||||||||                 DTL|||||||||||||                   TLR|||||||||||||           Content of `b.txt`:               HDR|2||||||||||       DTL|||||||||||||     TLR|||||||||||||     HDR|2||||||||||||      DTL|last||||||||||||     TLR|||||||||||||      Here I have to take out all the lines till 1st "TLR" in a.txt and b.txt and merge into 1.txt ,same way take out all the lines After 1st "TLR" in a.txt and b.txt and merge into 2.txt output should be: Content of `1.txt`:               HDR|1||||||||||      DTL|@|||||||||||      TLR|||||||||||||     HDR|2||||||||||      DTL||||||||||||      TLR|||||||||||||        Content of `2.txt`:               HDR|1||||||||||      DTL||||||||||||      TLR|||||||||||||     HDR|2||||||||||      DTL|last|||||||||||      TLR|||||||||||||        How can we accomplish this using UNIX Script?


Using bzgrep recursively

I wanted to use `bzgrep` to find to text in bzip2 files. I expected `bzgrep` to work as `grep`, but on bz2 files. So I tried `bzgrep -r "mypattern" .` to find text in my bz2 files. Instead of the expected result I get the same result as `grep` : It found the text only in `.txt` files. Any idea how to use `bzgrep` recursively ? I am using `grep (GNU grep) 2.18`


What are the requierements to sniff UDP packets in a Wireless Ad-Hoc network?

In a wireless Ad-Hoc network, I have two computers which communicates in UDP together from 192.168.1.3 to 192.168.1.5 I have a third computer (192.168.1.6) which wants to listen to the packets which are not addressed to it. I can see the packets with `tcpdump` (which sets the wireless card in promiscuous mode). To redirect the packets, I am using :               iptables -t nat -I PREROUTING -s 192.168.1.3 -j DNAT --to-destination 192.168.1.5      Is it the only rule I need to use? Why isn't it working? Did I miss other requirements?


Editing files in debian before installation

I am having problems installing debian on virtualbox. The installation step fails when trying to configure packet manager. The guy in the following post had them solved by editing a certain file during one of the installation phases. http://askubuntu.com/questions/146574/configuring-the-package-manage-failed- installation-on-11-10?newreg=3029c47198d34bb7be96025ffe0b3e32 I am completely new to Linux, command lines in general and have no idea how to: "Edit /usr/lib/apt-setup/generators/50mirror.ubuntu and comment out the two lines with db_metaget and db_subst statements after the comment "Text is variable for Debian"." could someone show some basic commands that would do it? :) I've already navigated to /usr/lib/apt-setup/generators/ and found the 50mirror file. How should I proceed? How do I close the shell and return to the installation afterwards? UPDATE: for anyone, trying to install linux on VirtualBox, install VirtualBox using administrator privileges. Then launch it with them as well. Worked for me :)


Courier-MTA not listening, how to increase debugging information?

i Follow tutorial from https://wiki.archlinux.org/index.php/Courier_MTA based on systemctl status command, the server is working fine               # systemctl status courier     courier.service - Courier Daemon        Loaded: loaded (/usr/lib/systemd/system/courier.service; disabled)        Active: active (running) since Tue 2013-08-27 15:40:16 WIT; 35s ago       Process: 509 ExecStop=/usr/sbin/courier stop (code=exited, status=0/SUCCESS)       Process: 511 ExecStart=/usr/sbin/courier start (code=exited, status=0/SUCCESS)      Main PID: 516 (courierd)        CGroup: name=systemd:/system/courier.service                ├─516 /usr/lib/courier/courierd                ├─517 /usr/lib/courier/courierd                ├─518 ./courieruucp                ├─519 ./courierlocal                ├─520 ./courierfax                ├─521 ./courieresmtp                └─522 ./courierdsn          Aug 27 15:40:16 gravity courierd[517]: Started ./courieruucp, pid=518, maxdels=4, maxhost=4, maxrcpt=16     Aug 27 15:40:16 gravity courierd[517]: Started ./courierlocal, pid=519, maxdels=10, maxhost=4, maxrcpt=1     Aug 27 15:40:16 gravity courierd[517]: Started ./courierfax, pid=520, maxdels=1, maxhost=1, maxrcpt=1     Aug 27 15:40:16 gravity courierd[517]: Started ./courieresmtp, pid=521, maxdels=40, maxhost=4, maxrcpt=100     Aug 27 15:40:16 gravity courierd[517]: Started ./courierdsn, pid=522, maxdels=4, maxhost=1, maxrcpt=1     Aug 27 15:40:16 gravity courierd[517]: queuelo=200, queuehi=400     Aug 27 15:40:16 gravity courierd[517]: Purging /var/spool/courier/msgq     Aug 27 15:40:16 gravity courierd[517]: Purging /var/spool/courier/msgs     Aug 27 15:40:16 gravity courierd[517]: Waiting.  shutdown time=Tue Aug 27 16:40:16 2013, wakeup time=Tue Aug 27 15:50:44 2013, queuedeliverin...rogress=0     Aug 27 15:40:16 gravity courieruucp[518]: ERROR: no uucp user found, outbound UUCP is DISABLED!      but the server was not listening at all               $ sudo netstat -ant | grep :25     $ sudo netstat -ant | grep :143      the start configuration               # grep START= /etc/courier/*     /etc/courier/esmtpd:ESMTPDSTART=YES     /etc/courier/esmtpd-msa:ESMTPDSTART=YES     /etc/courier/esmtpd-ssl:ESMTPDSSLSTART=NO     /etc/courier/imapd:IMAPDSTART=YES     /etc/courier/imapd-ssl:IMAPDSSLSTART=NO     /etc/courier/pop3d:POP3DSTART=YES     /etc/courier/pop3d-ssl:POP3DSSLSTART=NO      the log:               Aug 27 15:40:16 gravity courierd: Loading STATIC transport module libraries.     Aug 27 15:40:16 gravity courierd: Courier 0.71 Copyright 1999-2012 Double Precision, Inc.     Aug 27 15:40:16 gravity courierd: Installing [0/0]     Aug 27 15:40:16 gravity courierd: Installing uucp     Aug 27 15:40:16 gravity courierd: Installed: module.uucp - Courier 0.71 Copyright 1999-2012 Double Precision, Inc.     Aug 27 15:40:16 gravity courierd: Installing local     Aug 27 15:40:16 gravity courierd: Installed: module.local - Courier 0.71 Copyright 1999-2012 Double Precision, Inc.     Aug 27 15:40:16 gravity courierd: Installing fax     Aug 27 15:40:16 gravity courierd: Installed: module.fax - Courier 0.71 Copyright 1999-2012 Double Precision, Inc.     Aug 27 15:40:16 gravity courierd: Installing esmtp     Aug 27 15:40:16 gravity courierd: Installed: module.esmtp - Courier 0.71 Copyright 1999-2012 Double Precision, Inc.     Aug 27 15:40:16 gravity courierd: Installing dsn     Aug 27 15:40:16 gravity courierd: Installed: module.dsn - Courier 0.71 Copyright 1999-2012 Double Precision, Inc.     Aug 27 15:40:16 gravity courierd: Initializing uucp     Aug 27 15:40:16 gravity courierd: Initializing local     Aug 27 15:40:16 gravity courierd: Initializing fax     Aug 27 15:40:16 gravity courierd: Initializing esmtp     Aug 27 15:40:16 gravity courierd: Initializing dsn     Aug 27 15:40:16 gravity courierd: Started ./courieruucp, pid=518, maxdels=4, maxhost=4, maxrcpt=16     Aug 27 15:40:16 gravity courierd: Started ./courierlocal, pid=519, maxdels=10, maxhost=4, maxrcpt=1     Aug 27 15:40:16 gravity courierd: Started ./courierfax, pid=520, maxdels=1, maxhost=1, maxrcpt=1     Aug 27 15:40:16 gravity courierd: Started ./courieresmtp, pid=521, maxdels=40, maxhost=4, maxrcpt=100     Aug 27 15:40:16 gravity courierd: Started ./courierdsn, pid=522, maxdels=4, maxhost=1, maxrcpt=1     Aug 27 15:40:16 gravity courierd: queuelo=200, queuehi=400     Aug 27 15:40:16 gravity courierd: Purging /var/spool/courier/msgq     Aug 27 15:40:16 gravity courierd: Purging /var/spool/courier/msgs     Aug 27 15:40:16 gravity courierd: Waiting.  shutdown time=Tue Aug 27 16:40:16 2013, wakeup time=Tue Aug 27 15:50:44 2013, queuedelivering=1, inprogress=0     Aug 27 15:40:16 gravity courieruucp: ERROR: no uucp user found, outbound UUCP is DISABLED!      how to increase debugging information?


KVM can't access iso o raw images outside /var/lib/libvirt/images

I'm using Linux Mint Debian Edition (Up. 8) when tryng to start a virtual machine from libvirt (either from commandline or using virt-manager to local qemu-kvm) I get this error when I use an image that is not loaded in the default datastore: if I copy the same image (in this example an .iso file) to the /var/lib/libvirt/images folder it works. I've tried to chown and chmod it to every possible owner and mode but it just won't work. SELinux is not in place in this distro so I don't know where's the point, in logs I can see just permission denied and I'm quite stuck.               Impossibile completare l'installazione: 'internal error: process exited while connecting to monitor: qemu-system-x86_64: -drive file=/home/penzo/Scaricati/elementaryos-stable-amd64.20130810.iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw: could not open disk image /home/penzo/Scaricati/elementaryos-stable-amd64.20130810.iso: Could not open '/home/penzo/Scaricati/elementaryos-stable-amd64.20130810.iso': Permission denied     '          Traceback (most recent call last):       File "/usr/share/virt-manager/virtManager/asyncjob.py", line 96, in cb_wrapper         callback(asyncjob, *args, **kwargs)       File "/usr/share/virt-manager/virtManager/create.py", line 1949, in do_install         guest.start_install(False, meter=meter)       File "/usr/lib/pymodules/python2.7/virtinst/Guest.py", line 1249, in start_install         noboot)       File "/usr/lib/pymodules/python2.7/virtinst/Guest.py", line 1317, in _create_guest         dom = self.conn.createLinux(start_xml or final_xml, 0)       File "/usr/lib/python2.7/dist-packages/libvirt.py", line 2897, in createLinux         if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)     libvirtError: internal error: process exited while connecting to monitor: qemu-system-x86_64: -drive file=/home/penzo/Scaricati/elementaryos-stable-amd64.20130810.iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw: could not open disk image /home/penzo/Scaricati/elementaryos-stable-amd64.20130810.iso: Could not open '/home/penzo/Scaricati/elementaryos-stable-amd64.20130810.iso': Permission denied      any clues?


Help with PKGBUILD

As I would expect, there are a lot of Arch Linux users in here, and I think one of you can help me before upload my first PKGBUILD. The package I want to build is from a git repo. I've read the wiki guidelines but the CVS page is not very complete... When I makepkg, the procces seem to go straight, but in some point, it gets stuck. I don't know how to proceed. Could you help me?               # Maintainer: Tomas Sironi <sironitomas at gmail dot com>          pkgname=mutter-meego-git     pkgver=20101015     pkgrel=1     pkgdesc=""     arch=('i686' 'x86_64')     url="http://http://git.gitorious.org/meego-netbook-ux/mutter-meego/"     license=('GPL')     groups=()     depends=()     makedepends=('git')     optdepends=()     provides=('mutter-meego')     conflicts=('mutter-meego')          _gitroot="git://gitorious.org/meego-netbook-ux/mutter-meego.git"     _gitname="mutter-meego-git"          replaces=()     backup=()     options=()     install=     #~ source=($pkgname-$pkgver.tar.gz)     noextract=()     md5sums=() #generate with 'makepkg -g'          build() {         export INCLUDE="/usr/include"              msg "Connecting to the GIT server..."         if [ -d ${_gitname}/.git ]; then             cd ${_gitname}             git pull         else             git clone ${_gitroot} ${_gitname}             cd ${_gitname}         fi              ./configure.ac -prefix /usr \                     -libdir /usr/lib         make || return 1         make INSTALL_ROOT=$pkgdir install || return 1     }          package() {       cd $srcdir/$pkgname-$pkgver       make DESTDIR=$pkgdir install     }


File protection in Unix

Is there a way to protect a file in such a way that even `root` cannot delete it or rewrite it after creating it? I have a file which is created by `root` under `/var/log/` and I want to restrict all users (including `root`) so that they can just read this particular file after it has been created.


How to bind v4l2 USB cameras to the same device names even after reboot?

I have 3 USB cameras on single PC, one camera will be unused and can be ignored. I need to force two identical cameras to be mapped to constant device names (like `/dev/video1` and `/dev/video2` ). The cameras should not change their order (say camera 1 mounted as `video1` and camera 2 as `video2` after disconnect they should be in same order not camera1 --> `/dev/video2`, camera2 --> `/dev/video1`. How to make this setup work? I will feed camera output to _Gstreamer_. Cameras are using _v4l2_ and _uvc_ driver interface. Linux distro in question is _Archlinux_ , cameras - some Logitech webcams.


Encrypting loopback images without using a loopback device

I'm trying to design a firmware update system for an embedded Linux system. My plan is to send an image that can be mounted on the target system, so I don't need to unpack the entire file. I also want to encrypt the image, and optionally compress it as well. Since the build system for creating this image is going to be deployed on several computers I also want the build system to require minimal amount of setup, i.e., avoid avoid requiring root privileges. I've created a working model where I mount an image file using `losetup` as such:               dd if=/dev/zero of=image_file bs=1M count=10     losetup -e aes loop0 image_file     mkfs.ext2 /dev/loop0     losetup -d loop0     mount -t ext2 -o loop,encryption=aes image_file some_working_folder/     # Add files to some_working_folder     umount some_working_folder     # Send encrypted image to the target system      Now, since this is a bit cumbersome to set up on some machines, and I want to avoid creating fixed sized images. So I want to replace the `losetup` commands with something else. I found the command `virt-make-fs`, which can create a mountable image with the `ext2` filesystem. So now I only need to encrypt the image file in a way that is decryptable by the linux kernel. I've tried to use OpenSSL, but I haven't been able to find the correct algorithm, or maybe I'm missing something. Does anybody know how to do this? Basically I want something like the script below.               tar -cf archive.tar some files     virt-make-fs archive.tar image.ext2     # the below command need to be fixed/replaced     openssl enc -aes192 -in image.ext2 -out image.ext2.aes      On the target system I want be able to use the following command, or at least something similar.               # The next command should be done on the target     mount -t ext2 -o loop,encryption=aes image.ext2.aes /mnt/upgrade     # work with files in /mnt/upgrade      So, just to clarify: How can I create an encrypted mountable image file without being root? Feel free to comment if I'm trying to reinvent the wheel, or if there is some other well established solution for this problem. Even though there are better solutions, I'm still interested in the command to solve the encryption problem. * * * Edit: As been pointed out cryptoloop is unsecure, see http://lwn.net/Articles/67216/. So I will probably look around for another solution as well. I've found to util `aespipe`, which I might be able to use. * * * Edit 2: I've dug into the source code in the AES module of the Linux kernel, and I've concluded that it is probably the hashing of the password that is causing the problem. Both `aespipe` and the AES module are using an AES-256-CBC encryption. As far as I can see the linux kernel uses the given password as key, and `aespipe` hashes the incoming password. Since the "no root" part is very important to me I've started looking for other solutions, and my current plan is to use something like the following on the development computer:               tar -cf - file0 file1 ... | gzip -c | aespipe -e aes256 > arhive_file      And then on the target system run               rm -rf /tmp/update ; mkdir -p /tmp/update     aespipe -d -e aes256 < archive.mbl | gzip -cd | tar -C /tmp/update -xf -


Testing if a process is running via if and -z

I'm have a process on my system which is notorious for crashing, and is kind of mission critical, my network manager. In any case, I need to write a loop which tests if it's running and starts it if it isn't. This is what I've come up with thus far:               #!/bin/bash          while [ true ]; do          if [ -z $(ps aux | grep "[n]m-applet") ]; then             echo "Bugger died, resurrecting..."             nm-applet >/dev/null 2>/dev/null &             disown $!         fi              sleep 3     done       Unfortunately, this isn't quite doing the trick, as it seems to be starting the process even when not necessary, and after the first run, I get the following error output:               line 4: [: too many arguments      What am I doing wrong here?


How do I remove all sub-directories from within a directory?

This question is kind of a phase II to the first question I posted at here I have a directory that contains a bunch of sub-directories, .zip files, and other random files not contained within a sub-directory. I'd like a command line script to remove all sub-directories from within the parent directory, but keep all zip files and loose files that don't belong to any sub-directories. All of the sub-directories have content, so I believe I'd need to force their deletion with the -f command. So basically, a command that looks inside the parent directory (or the current directory), deletes all folders from within it, but keeps all other content and files that are not a folder or contained within a folder. I understand that deleting items from the command line requires special care, but I have already taken all necessary precautions to back up remotely.


How can I check how much space I am allowed to use on a linux server?

I have some giant files I'd like to back up by putting them on a server I am allowed to use for such things. However, I am uncertain about how much space I am allowed to use. Is there any way of checking this after I have sshed to said server?


what is a Kernel?

I'm learning Unix from the Unix Architecture book by Maurice J Bach. So if my question seems too stupid, please do bear with it. I read a few related questions but I would like a more simple explanation, with an example. My confusion is with the concept of kernel. What is a kernel? I understand it's the operating system and it is a process. But when my teacher teaches he says a system call(), results in a process going from user mode to kernel mode. What actually happens in a system call? Does the user process go to sleep and the operating system execute it on behalf of user process and returns the value to the user process or does the user process execute in kernel mode? If the latter is correct, what does it mean?


Efficiently remove file(s) from large .tgz

Assume i have an gzip compressed tar-ball compressedArchive.tgz (+100 files, totaling +5gb). What would be the fastest way to remove all entries matching a given filename pattern for example prefix*.jpg and then store the remains in a gzip:ed tar- ball again? Replacing the old archive or creating a new one is not important, whichever is fastest.


What is the difference between Halt and Shutdown commands?

What is the difference between the `halt` and `shutdown` commands?


Arg list too long error while using find

I have the `find` command as follows:               find /jobs/logs/* -prune -name '*.log' -type f -mtime +1 |         while read LOGFILE         do             echo $LOGFILE         done      This is failing due to the following error:               /usr/bin/find: arg list too long      Can anyone suggest a way to fix this? (This is a continuation of my previous question.)


USB audio only outputs white noise

I am running OpenBSD/i386 5.1 on a 5 year old laptop. The speakers and headphone port work, but the headphone port is a little loose so I am trying to install an external USB sound card (Fiio E17 USB DAC). No problems using it on Windows. The device is detected and I created a node for it in `/dev` with `sh /dev/MAKEDEV audio1`, then linked the rest of the devices to point to the new sound card. So far so good, I am able to run `cat /dev/urandom > /dev/audio` and I hear white noise. However, I am not able to run any other audio through it. My `tail /var/log/messages` after plugging the device in:               Aug 30 10:03:55 s96j /bsd: uhidev0 at uhub1     Aug 30 10:03:55 s96j /bsd:  port 1 configuration 1 interface 0 "FiiO FiiO USB DAC-E17" rev 1.10/0.01 addr 2     Aug 30 10:03:55 s96j /bsd: uhidev0: iclass 3/0     Aug 30 10:03:55 s96j /bsd: uhid0 at uhidev0: input=18, output=27, feature=0     Aug 30 10:03:55 s96j /bsd: uaudio0 at uhub1     Aug 30 10:03:55 s96j /bsd:  port 1 configuration 1 interface 1 "FiiO FiiO USB DAC-E17" rev 1.10/0.01 addr 2     Aug 30 10:03:56 s96j /bsd: uaudio0: ignored setting with type 8193 format     Aug 30 10:03:56 s96j /bsd: uaudio0: audio rev 1.00, 2 mixer controls     Aug 30 10:03:56 s96j /bsd: audio1 at uaudio0      My list of relevant devices from `/dev`:               lrwxr-xr-x  1 root  wheel         6 Aug 30 09:44 audio -> audio1     crw-rw-rw-  1 root  wheel   42, 128 Aug 30 10:07 audio0     crw-rw-rw-  1 root  wheel   42, 129 Aug 30 10:15 audio1     crw-rw-rw-  1 root  wheel   42, 130 Aug 30 06:40 audio2     lrwxr-xr-x  1 root  wheel         9 Aug 30 09:44 audioctl -> audioctl1     crw-rw-rw-  1 root  wheel   42, 192 Aug 30 06:40 audioctl0     crw-rw-rw-  1 root  wheel   42, 193 Aug 30 09:44 audioctl1     crw-rw-rw-  1 root  wheel   42, 194 Aug 30 06:40 audioctl2     lrwxr-xr-x  1 root  wheel         6 Aug 30 09:45 mixer -> mixer1     crw-rw-rw-  1 root  wheel   42,  16 Aug 30 06:40 mixer0     crw-rw-rw-  1 root  wheel   42,  17 Aug 30 09:44 mixer1     crw-rw-rw-  1 root  wheel   42,  18 Aug 30 06:40 mixer2     lrwxr-xr-x  1 root  wheel         6 Aug 30 09:45 sound -> sound1     crw-rw-rw-  1 root  wheel   42,   0 Aug 30 06:40 sound0     crw-rw-rw-  1 root  wheel   42,   1 Aug 30 09:44 sound1     crw-rw-rw-  1 root  wheel   42,   2 Aug 30 06:40 sound2      A simple test from the FAQ to determine if data is passing over the device:               # cat > /dev/audio < /dev/zero &     [1] 21098     # audioctl play.{seek,samples,errors}     play.seek=61712     play.samples=1146080     play.errors=0     # audioctl play.{seek,samples,errors}     play.seek=52896     play.samples=1542800     play.errors=0     # audioctl play.{seek,samples,errors}     play.seek=61712     play.samples=1957152     play.errors=0      My `audioctl -a`:               name=USB audio     version=     config=uaudio     encodings=slinear_le:16:2:1,slinear_le:24:3:1     properties=independent     full_duplex=0     fullduplex=0     blocksize=8816     hiwat=7     lowat=1     output_muted=0     monitor_gain=0     mode=     play.rate=44100     play.sample_rate=44100     play.channels=2     play.precision=16     play.bps=2     play.msb=1     play.encoding=slinear_le     play.gain=127     play.balance=32     play.port=0x0     play.avail_ports=0x0     play.seek=8816     play.samples=131988     play.eof=0     play.pause=0     play.error=1     play.waiting=0     play.open=0     play.active=0     play.buffer_size=65536     play.block_size=8816     play.errors=2267     record.rate=44100     record.sample_rate=44100     record.channels=2     record.precision=16     record.bps=2     record.msb=1     record.encoding=slinear_le     record.gain=127     record.balance=32     record.port=0x0     record.avail_ports=0x0     record.seek=0     record.samples=0     record.eof=0     record.pause=0     record.error=0     record.waiting=0     record.open=0     record.active=0     record.buffer_size=65536     record.block_size=8816     record.errors=0      And lastly, my `mixerctl -a`:               outputs.aux.mute=off     outputs.aux=255,255      Again I am able to `cat /dev/urandom > /dev/audio` and get white noise, but nothing else I've tried lets me output other sounds or music. I also tried `cat sample.au > /dev/audio` but that was silent as well. Any suggestions or help would be greatly appreciated! Worst case, hopefully someone can use the steps I outlined here to troubleshoot their own sound devices.


Two EFI disks with Grub2

I bought two SSD disks and as usual I though that installing Windows on a completely separate disk would be the easiest solution, but I can't find any tutorials for dual booting with grub2 (efi). All tutorials assume one EFI boot partition. Using just:               menuentry "Windows 7" {             set root=(hd1,1)             chainloader +1     }      Gives me invalid EFI path. What is the correct configuration?


Error "parted: invalid token: 1" When Using Parted To Format A Partition?

Screenshot: http://imgur.com/DQnhwG2   ![ss of term](http://i.stack.imgur.com/t2ZUL.png) I'm trying to format an existing ext2 partition as ntfs (or any filesystem) using the mkfs command in Parted, but when I specify the partition to format I get:               parted: invalid token: 1      "1" being the partition number I specified. I'm not sure what's wrong. The goal here is to find the correct command. I'm not interested in work-arounds using a different program. I'm just doing this to learn the ins/outs of Parted. I've already read the manuals, and a ton of blog posts. The command I used was:               $ mkfs 1 ntfs      Details:   * Ubuntu 12.04 - Desktop X86-64   * Parted 2.3   * There is no valuable data on the machine. It's just a vm running Ubuntu with 2 virtual hard drives attached. Sda: Ubuntu Sdb: The drive for testing Parted


Re-enable route cache

In my kernel log I found:               lo: 5 rebuilds is over limit, route caching disabled      I know what triggers route cache rebuilds (too long hash bucket chains), but what exactly gets disabled? Which device? How can I check if it is still disabled? How can I re-enable it? After this strange message I started having problems with other network devices like this:               unregister_netdevice: waiting for TUNNEL_03 to become free. Usage count = 2       And routing cache seems to be guilty here


What are the numbers after the version in the output of apt-cache policy?

This is the output of `apt-cache policy firefox`               firefox:       Installed: 26.0~linuxmint1+lmde       Candidate: 26.0~linuxmint1+lmde       Version table:      *** 26.0~linuxmint1+lmde 0             500 http://packages.linuxmint.com/ debian/import amd64 Packages             100 /var/lib/dpkg/status      The version is shown as `26.0~linuxmint1+lmde`, what is the `0` that comes after it? I have tried with various packages and there is always a `0` after the package version. Presumably, this can also take other values but I haven't seen it. I read through both the `man` and `info` pages of `apt-cache` and could not find anything relevant. The only explanation of `policy` is:                  policy [pkg...]            policy is meant to help debug issues relating to the preferences            file. With no arguments it will print out the priorities of each            source. Otherwise it prints out detailed information about the            priority selection of the named package.


Auto mounting other partitions in Arch Linux

Im using Arch Linux. Is there a way to automount other NTFS or Ext partitions automatically without writing about them in `/etc/fstab`?


How to find Heap memory of a running process?

I would like to know how to find the heap memory of a process that is running in the background. Is there any command that allows such?


Where did this copy of my home directory come from?

I was working on a project to control my digital camera using Ubuntu and gphoto2. At one point I noticed a new "~" directory in my project folder, /home/greg/project/~. When I enter this new "~" directory, it takes me backwards to my home directory /home/greg/ (as you might expect). I don't know exactly how this happened, but my suspicion is that when I ran gphoto2 on the command line and specified an output file, I typed "~/filename.jpg" expecting the file would show up in my home directory, but instead bash put a new "~" directory in the working directory. I'm wasn't aware something like that could be done (if that's what happened). More important than how it got there is how I should get rid of it. I can't remove the directory, because as far as I can tell it _is_ my home directory. It doesn't appear to be a sym-link, (at least not according to ls -l), but I'm not sure what that would even really mean.


Does the unix calendar program `pal` support line breaks?

The unix program `pal` is one of a variety of command-line calendar programs. Based on the `man` page, each line refers to an event, and it does not mention event descriptions that span multiple lines at all. I am trying to insert a multiline event description, and tried with `Line1\nLine2`, as well as `Line1\rLine2`, both of which were printed literally by `pal`. Does anyone know if there's a way to get multi-line event descriptions?


What's using all of the memory in my VM? It's not the disk cache

I have an issue where when I try to build a really large project, my machine starts swapping (several GB) even though there's plenty of memory (14 GB in fact). When I run `free`, it shows that it's not the disk cache:               $ free -m                  total       used       free     shared    buffers     cached     Mem:         12900       6350       6549          0          7         77     -/+ buffers/cache:       6266       6633     Swap:         9211        233       8978      So 6.3 GB of memory is actually in use, but if I look at top, sorted by % memory usage, nothing is using any memory:                 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                    38669 blong     20   0 1282m 378m  42m S    2  2.9   0:50.79 firefox                                                     1327 root      20   0  365m 126m 4056 S    4  1.0  40:23.94 Xorg                                                        2540 blong     20   0 1578m  67m  10m S    2  0.5  21:33.35 gnome-shell                                                13943 blong     20   0  579m  12m 5604 S    2  0.1   1:07.01 gnome-terminal                                             30093 blong     20   0  540m 8664 5572 S    0  0.1   0:03.96 icemon                                                      2558 blong     20   0  362m 5964 1808 S    0  0.0   5:17.44 vmtoolsd                                                    2526 blong     20   0  672m 5056 2000 S    0  0.0   0:26.81 gnome-settings-                                             2546 blong     20   0  354m 3484 2244 S    0  0.0   5:08.96 pulseaudio      Am I missing something? Restarting the VM fixes this, but I'd prefer to figure out what's actually happening.


Tmux key-bind like to use the windows/super for my meta key in Tmux Without X

I have RaspberryPI with no GUI==(no x.org) I like to bind the useless window/super key to be my prefix. Using Arch for ARM runs great. If think this is going to take more then simple mod in the tmux.conf file. After some Googling found post with a command: dumpkeys | grep -E "keycode *125|126" That command give me a blank line.


switch window manager when logging in in text mode

Suppose I don't start the display manager on boot and login through the terminal. How would I switch my window manager? With gdm or gdm3, you use a scroll box to select it.


linux shell: find -exec in find -exec

I want to execute `chmod 555` on all files and directories I get with the following command (it returns the directory test and all files and directories in it):               find ~/.config/google-chrome -type d -name test -exec find {} \;


How to do a regex search in a UTF-16LE file while in a UTF-8 locale?

EDIT: Due to a comment _Warren Young_ made, it made me realize that I was not clear on one quite relevant point. My search string is already in UTF-16LE order (not in Unicode Codepoint order, which is UTF-16BE), so perhaps the Unicode issue is somewhat moot, Perhaps my issue is a question of how do I grep for bytes (not chars) in groups of _2-bytes_ , ie. so that UTF-16LE `\x09\x0A` is not treated as TAB,newline, but just as 2 bytes which happen to be UTF-16LE `ऊ`? ... Note: I do not need to be concerned about UTF-16 surrogate pairs, so 2-byte blocks is fine. Here is sample pattern for this 3-character string `ऊपर`:   * `\x09\x0A\x09\x2A\x09\x30` but it returns nothing, though the string is in the file. _(here is the original post)_   When searching a UTF-16LE file with a pattern in `\x00\x01\x...etc` format, I have encountered problems for some values. I've been using `sed` (and experimented with `grep`), but being in the UTF-8 locale they recognize some UTF-16LE values as ASCII characters. I'm locked-in to using UTF-16, so recoding to UTF-8 is not an option. eg. In this text `ऊ` (UNICODE 090A), though it is a single character, `ऊ` is perceived as two ASCII chars `\x09` and `\x0A`. `grep` has a `-P` (perl) option which can search for `\x00\x...` patterns, but I'm getting the same ASCII interpretation. Is there some way to use `grep -P` to search in a UTF-16 mode, or perhaps better, how can this be done is perl or some other script. `grep` seems to be the most appealing because of its compactness, but whatever gets the job done will overrride that preference. PS; My `ऊ` example uses a literal string, but my actual usage needs a regex style search. So this perl example is not quite what I'm after, though it does process the file as UTF-16... I'd prefer to not have to open and close the file... I think `perl` has more compact ways for basic things like a regex search. I'm after something with that type of compact syntax.


remove duplicate files in 2 directories

I have two folders (w/ subfolders) containing files that both contain essentially the same content. Example:   * `/folder/files/data/new`   * `/folder/files/data/old` Is there way to delete all files in /new that are already in /old by _strictly filename_ (NOT date modified) to prevent me from re-reading duplicate files.


Help with a find command

I have a bunch of directories. Inside these directories is a cover letter and a zip archive of work. I wanted to run a quick and easy query to open up all the cover letters so I can decide if it's worth looking at the work folder.               find . | grep cover\.pdf | xargs open    #OS X has open linked to "open" the file      This doesn't work. I've also muddied around with various `print0`, `xargs -0` variations with little success. What's the proper way to do this?


Lock some accounts during some time periods

Is it possible to lock some accounts in order to be accessible only during specific time periods? For instance the account joe should only be accessible during office hours.


Any other way to define an environment variable?

I'm quite new to Linux. Debian Wheezy is now running on my Laptop (64 bits). I recently installed Oracle 11g R2 database for evaluation purpose, and defined environment variables (such as `ORACLE_SID`) through a script `/etc/profile.d/oracle.sh`. This works fine, but for the "oracle" user. I change user by `su - oracle`.   The value of `ORACLE_SI`D is different from the one specified in the `/etc/profile.d/oracle.sh` file. As the oracle user has no file (such as `.bash_profile`, `.profile` etc.) in its home directory, where can this value come from? What is the overloading sequence of environment variables?


Start the script with sudo not working

I am trying to start the virtual machine (ORACLE VIRTUALBOX) using this script (script name: `start_vm001.sh`).               START_VM=`/usr/bin/VBoxHeadless --startvm testvm001`     EXECUTE_VM=`exec /sbin/start-stop-daemon --start --chuid 1001 \     --exec "$START_VM" -- $START_VM`     echo $EXECUTE_VM                    $ ./start_vm001.sh, # it worked     $ sudo ./start_vm001.sh # it not worked          ERROR OUTPUT: sbin/start-stop-daemon: unable to stat Oracle VM VirtualBox      Headless Interface 4.1.12_Ubuntu (C) 2008-2013 Oracle Corporation All rights      reserved. Invalid machine name or UUID! (No such file or directory)      How to run the script using sudo?


git commit error - cannot run vim: No such file or directory

$ git commit       error: cannot run vim: No such file or directory     error: There was a problem with the editor 'vim'.     Please supply the message using either -m or -F option.      How can I overcome the error and define the editor?


Book on Linux kernel driver development

What good books are there out there for Linux kernel driver development? Preferably targeting a rather new kernel release. Which one is best in you opinion?   * Essential Linux Device Drivers   * Linux Device Drivers


How do I rename lots of files on a directory without changing their extensions?

I have a problem! I have a bunch of image files with extensions. Jpg and. Png. I wrote a script that renames the files, changing their names in a pattern followed by a number like this: ... arquivo_1.jpg arquivo_2.jpg ... And following this sequence, but it needs to know the extension, in this case I used the extension. Jpg. I was wondering how do I optimize the script so that it renames but keeping the original extension of the file and keep doing the sequence I described above. Can someone help me?


Is it safe to disable OOM killer in a web server/reverse proxy?

I have Linux machine dedicated to serving static contents and PHP pages with Apache. Apache also work as a reverse proxy in a subdomain. I moved the PostgreSQL database to another Linux machine. Is it safe to disable the OOM killer in the kernel?


Does AIX really beat Red Hat Enterprise Linux?

Our company plan to upgrade our servers, and at the same, we would use AIX over Red Hat Enterprise Linux. I asked my boss the reason of choosing AIX, he said it is because AIX is more powerful. I wonder if it is true. Does AIX really out perform RHEL in terms of data processing? Only text data, no graphic processing. They are AIX 7.1 and RHEL is "Red Hat Enterprise Linux AS release 3 (Taroon Update 2)". Assume we would use the same machine for comparison.


Serial Over Lan redirection stops at OS boot

I'm trying to create a monitoring system for a remote machine using an IPMI Serial Over Lan (SOL) console. The remote OS is RHEL 6, the mobo manufacturer is Supermicro. I've successfully enabled SOL redirection in the BIOS. This allows me to see the BIOS and kernel parts of bootup through an attached SOL console over IPMI. Next, I followed the steps mentioned in many online articles to get my OS ( runlevel 3, just text terminal ) to redirect too. The result is almost always the same : After making the changes to /etc/grub.conf, /etc/inittab, and /etc/securetty, i can see the grub menu through the SOL console (yay!), but as soon as the OS starts booting, my SOL terminal receives 1 gibberish character, and nothing more. Some thoughts:   1. I'm not exaclty sure which serial port my BIOS are trying to redirect stuff into (ttyS0, ttyS1). Most of the examples use ttyS1, and since the grub menu gets redirected there, i'm pretty confident thats 'correct'   2. I know the 'terminal types' and baud rates have to match between the BIOS and OS settings. I am consistently using 115200 for baud, but i'm less confident I'm choosing the right terminal type. The terminal type in BIOS is "ANSI", and this gives the coloration i want for the BIOS over SOL. However, for the OS settings, most of the examples use 'linux'; i'm not sure if that's compatible with my ANSI setting. I've tried VT100 for both BIOS and OS, and I still never see anything past the Grub menu (plus, i lose color info for my BIOS over SOL). Any help is greatly appreciated.


Eval emacs init.el from CLI

I want to eval my ~/.emacs.d/init.el file periodically from CLI (cron) since it generates other files that I use in my projects according to some extra data. Something like "emacs -q -eval-file ~/.emacs.d/init.el", or something like this. How can I do it ? Thanks


Virtualbox 64bit image on 64bit computer without virtualization support

I have a 64 bit image for VirtualBox (.vmdk file), and I don't have a 32 bit version. My computer doesn't support hardware virtualization. Logically VirtualBox says: > This kernel requires an x86-64 CPU, but only detected an i686 CPU. Unable to > boot - please a kernel appropriate for your CPU. If I don't have a 32 bit version, does that simply mean I am screwed?


Bash vs ksh pipes

I am stuck with some problems with my scripts in ksh. FWIW the problem which I am unable to overcome is that when I use a structure such as this               command | while read VAR1      do        many.commands using $VAR1     done      I often get that my scripts do not perform the loop for every line piped to the while. To test this I then change the structure to               command > /tmp/tempfile     cat -n /tmp/tempfile >&2     cat /tmp/tempfile | while read VAR1     etc      This proves that there is many lines in the output. Further I then add an extra line immediately after the do, like               echo DEBUGGING: $VAR1  >&2      Which proves that the loop runs only once. I am really stumped. One workaround which is not always viable, is to do               for X in $(cat /tmp/tempfile )     do     ...     done      This then works correctly but besides the fact that I hate this for structure, It means you expand the entire input data on the command-line (which has hard limits) It appears that bash is better than ksh at handling this kind of thing. In particular it seems that this may be related to read calls failing but not retrying if the loop takes a long time to run. However it seems that bash does not have a built-in "read", which means much of my scripts will need to be re-written. I OFTEN use large structures like               command1 | command2 | while read SOMEVAR; do awk -F: "... long awk program" | sed "long sed program" ; done | sort -u | tail -1 | read FINAL_ANSWER      The problem is that bash uses /usr/bin/read which as expected throws away the result of FINAL_ANSWER as fast as it gets it. The obvious workaround is to replace               | read FINAL_ANSWER      with               > /tmp/final_answer && FINAL_ANSWER="$(cat /tmp/final_answer)"      So.... Any scripting gurus on here able to shed some more light on this? I deliberately did not post my real scripts here both because they are part of a sensitive solution developed for a customer, and because I don't want the actual detail of the scripts to confuse the issue. I use the "while read" format OFTEN. It usually works. I've in fact never had a problem with it in 25 years of shell scripting. Now I'm having problems. Very frustrating. Perplexing. Initially I thought the while read is only receiving, or passing along, the first line of input. But then I discovered a situation where, when I run the script over and over, it runs further and further into the input. Specifically I have something line this               command | while read NEXT_ONE DONEFLAG     do        if [ $DONEFLAG = "yes" ]        then            echo Already completed work for $NEXT_ONE        else            dowork $NEXT_ONE && set_flag $NEXT_ONE        fi     done      It turns out that on each run of the script, it performs `dowork` once. It doesn't really matter what `dowork` is, so long as it takes more than a few seconds. Some kind of shell pipe timeout occurs and the rest of the input then disappears. Google tells me that dtksh may solve this issue (Apparently it will retry the read/write or something, I didn't read enough) I see that dtksh exists in /usr/st/bin/dtksh Who is this? I don't like using shells that I don't know, but it might be worth while to split small portions of scripts into sub-scripts with /usr/dt/bin/dtksh as interpreter. Any advice? EDIT: Providing an example of why I can not use bash as a drop-in replacement for ksh as interpreter:               sol10-primary> # cat test.sh     #!/bin/ksh     echo hello| read VAR1     echo $VAR1     sol10-primary> # ./test.sh     hello     sol10-primary> # sed 's/ksh/bash/' <test.sh >test2.sh     sol10-primary> # chmod +x test2.sh     sol10-primary> # ./test2.sh          sol10-primary> #


Fedora Upgrade Error

I was trying to upgrade to Fedora 16 (I had f14) using _preupgrade_. However, it fails at the end (after saying: _preparing transaction from installation source_ ) and gives the following error: _A fatal error occurred when installing the file system package. This could indicate errors when reading the installation media.Installation cannot continue._


Search commands in history with discontinuous keywords

I was wondering how to search commands in history without knowing the first few letters of the command? When searching using `Ctrl`-`R` in bash, ~~one has to give the first few letter of the command. What if I only know some characters in the middle, or some at the beginning and some in the middle? For example, to search`cat myfile`, I only know there is `at` in it, or `c` at the beginning and `my` in the middle somewhere.~~ keywords have to be continously positioned. For example, in `cat myfile`, I would like to search for both`c` and `my`, but Ctrl+R will not allow to specify both simultaneously. Thanks!


Problematic quotations

#!/bin/ksh     typeset FILE_SIZE1=$(stat -f '%z' test.txt);     typeset -r BK_STATARGS="-f '%z'"     typeset FILE_SIZE2=$(stat ${BK_STATARGS} test.txt);     echo without arg var ${FILE_SIZE1}     echo with arg var... ${FILE_SIZE2}      Yields....               without arg var 216     with arg var... '216'      Maybe I'm missing the obvious but I can't figure out a fix. I've tried all sorts of things.


Force fsck check after reboot with single command

I'm looking for systemd's equivalent to the `shutdown -F` command. I know that I can force fsck by adding `fsck.mode=force` to kernel options or tweak mount count for disks. I have tried `touch /forcefsck` but it doesn't work with latest systemd versions.


unpack and patch source rpm (rpmbuild -bp) safely

I want to unpack source RPM and apply patches to the upstream source. What is _almost_ OK for me is               rpm -i mypkg-*.src.rpm     cd ~/rpmbuild     rpmbuild -bp SPECS/mypkg.spec     # frolic in BUILD/mypkg      My problem is that `rpm -i` always deploys the sources in ~/rpmbuild. And since I want to do it in a middle of automated test (which is running under root), I'd rather do this at least in my own temporary tree. I have tried `\--prefix=mypath` with RPM, but it seems that RPM ignored that ( _after_ hassling me about the path being relative ... nice job ;)). Other thing that came to my mind was creating a temporary user and `su` but that's ugly, adds overhead of creating/removing the user and is not non- intrusive anyway. So what are my other, way better options?


How to check whether a command such as curl completed without error?

I am using curl to upload a file to a server via an HTTP post.               curl -X POST -d@myfile.txt server-URL      When I manually execute this command on the command line, I get a response from the server like `"Upload successful"`. However, how if I want to execute this curl command via a script, how can I find out if my POST request was successful?


tail -f equivalent

I am seeing several seconds delay with the tail command. I found the cause for it has something to do with nfs services. I am using arch linux and yet to find out how to disable all these services I have searched and had some indication that other tools will not be effected such as cat so what can give equivalent results to tail -f


od emulation for directories

I was wondering why od(1) used to work in UNIX but doesn't work in GNU/Linux. There is a nice answer on serverfault. The next question is, are you aware of any tools that can emulate od behavior to support dumping directory data in GNU/Linux?


crontab, instance, memory issues+spamming

I have a cronjob that runs php5 wp-cron.php every minute to update my website. However something happened and i had 30+ instance of it (31 is marked on this one dump of `ps aux`). It ate up my ram, caused additional instance to terminate do to lack of memory and caused me not to be able to ssh into the box. I can't understand why instances were living >30mins, one usually takes a few seconds. The day it happened i had no jobs planned (although maybe wp cache usesd it? but i never had a problem before) What can i do to prevent a cronjob from spamming and destroying my memory? Is there a way i can say do not start if an instance is alive? and if an instance is alive for more then 5mins kill it? Is there a way i can protect myself from something similar from happening?


Is it possible to use pendrive as key for Linux system

I want to give high security for my linux box. So i planed to use my pen drive as key for my linux box. How can i do it ?


Screen keeps dimming on Power (Dis-)Connect

I would like to disable the automatic screen dimming when I plug in our out my power adapter. Every time my laptop switches between battery/ac, my screen dims even though I have disabled it in every place I could think of. gnome-power-manager does not seem to be involved, as killing it makes no difference. However, here are some of my settings: In my gconf, under the key `/apps/gnome-power-manager/backlight`, I set:   * `battery_reduce`: false   * `enable`: false   * `brightness_ac`: 100   * `brightness_battery`: 100   * `brightness_dim_battery`: 100   * `idle_dim_time`: 3600 Even under `/apps/gnome-power-manager/lowpower`, I unticked all options. Where else can I control screen dimming?


Samba's "inherit permissions" does not inherit modes for other

I have a share with "inherit permissions = yes". I have a directory in the share with mode rwxrwsr-x. If I create a subdirectory, the modes are rwxrws---. The same happens with a parent directory with mode rwxrwxr-x (resulting in rwxrwx---). The permissions of the newly created subdirectory are independent of the OS used to create them and apparently independent of the umask when using smbfs (mount.cifs). The following is an excerpt from **smb.conf** and contains everything related to permissions, modes, etc. of the share.                   force group = +mi         inherit permissions = yes         inherit owner = yes         nt acl support = no      I added "nt acl support = no" for testing purposes and it does not seem to make a difference. Does "inherit permissions" not work for non-user, non-group modes?


Ctrl-space not getting through ssh

I am on windows 8 using GIT bash to access a remote server via `ssh`. When I press `Ctrl`+`Space` in emacs running locally in console (`emacs -nw`), everything works as expected. However, when going over `ssh`, `Ctrl`+`Space` simply inserts a space, while other commands like `Ctrl`+`X` work fine. Why doesn't `Ctrl`+`Space` get through? I have considered switching to a different terminal, but I am also curios as to why this is happening.


Who is file owner if the file is created using sudo command?

I logged in using my username `ravbholua`: ravbholua@ravbholua-Aspire-5315:~$ echo $LOGNAME ravbholua I create file named `a1`:               ravbholua@ravbholua-Aspire-5315:~$ echo>a1     ravbholua@ravbholua-Aspire-5315:~$ ll a1     -rw-rw-r-- 1 ravbholua ravbholua 1 Oct  8 09:57 a1      As expected the above file has me (`ravbholua`) as owner. Next I create a2 using sudo with `echo` command:               ravbholua@ravbholua-Aspire-5315:~$ sudo echo>a2     ravbholua@ravbholua-Aspire-5315:~$ ll a2     -rw-rw-r-- 1 ravbholua ravbholua 1 Oct  8 09:57 a2      The owner is me only, i.e. `ravbholua`. Now I create a3 using sudo again but with `vim` command:               ravbholua@ravbholua-Aspire-5315:~$ sudo vim a3     ravbholua@ravbholua-Aspire-5315:~$ ll a3     -rw-r--r-- 1 root root 10 Oct  8 09:57 a3      Oh! how come the owner changes now. It's not me but root. Why such variation with `echo` and `vim`! It's a surprise that with _change of commands_ how can the owner of the created file changes.


Get the PID of file creation

I am writing a bash script that creates 5 files with the extension ".P" and write a line of "something" into them. "P" represents a number and it's the PID of the process that creates the file. How can you do that? I am creating my file and writing into it like this: `echo "something" > file_name`


The right way to wrap block of lines in custom text in vim

I would like to be able to select several lines using `vim` when editing an HTML file, then enter some hotkey and get these lines wrapped in a django comment block. For example, I have:               one line     another line      I want to get:               {% comment %}     one line     another line     {% endcomment %}


How to create ico file with more then one image

I can use imagemagic to convert png to ico but (I think, not sure) it will create one image ico file for the size I specify.               convert favicon.png --resize 32 favicon.ico      And ico file can contain 2 or 3 images for 16x16 32x32 and 64x64 pixels. Is it posible to create such icon maybe with image magic of other tool?


Java process, swap (/proc Solaris10) memory highly utilized

How can I analyze high swap memory utilization of Solaris 10 for Java processes?


Recommended fstab settings

I made a new partition for my home drive by following this guide I have no idea what the fstab setting it suggests mean: > UUID=???????? /home ext3 nodev,nosuid 0 2 I used an install CD and used "try it without install", so that I could run with my drive unmounted. I used GParted to resize the partition, and make a new one in the unused space. I then looked up the UUID as the guide said (and used ext4 instead), and everything worked fine. However I'd like to understand what the "nodev,nosuid 0 2" settings are. Are these the recommended settings? Is this the only valid setting? Does it matter in any way?


CUPS error log contains "No such interface `org.freedesktop.ColorManager'"

On my Ubuntu 13.04 laptop, CUPS writes this message into `/var/log/cups/error_log` for each printer on restart:               W [25/Jun/2013:10:00:26 +0100] AddProfile failed: org.freedesktop.DBus.Error.UnknownMethod:No such interface `org.freedesktop.ColorManager' on object at path /org/freedesktop/ColorManager/devices/cups_Brother_HL_2150N_series      I'm not having any problems printing, but I'd like to know why the message appears and what I can do about it. Ideally I'd like to fix the problem without blindly installing drivers and packages; I want to understand precisely why the message appears.


Connecting a wireless webcam and wireless dongle

I must create a wireless connection between a USB wireless dongle (DLink wireless-N USB Mini Adapter DWA-140) and a wireless webcam (DLink DCS-932L). I.e. point to point connection without Internet. I have to use Linux without a GUI (only commands). What do I need to do, to get this to work?


Why cannot a user change group ownership of his own files?

Why cannot a user change the group permissions of files which he owns. Let's suppose I have user `martin`:               $ ls -lAd /home/martin/     drwx------ 8 martin martin 4096 Apr 20 01:06 /home/martin/      For some reason, I want user `paul` to be able to access my home.               $ chgrp paul /home/martin/     chgrp: changing group of `/home/martin/': Operation not permitted      Is there a security reason why a user cannot change the group ownership of his own files? I am using Debian 7 (wheezy).


Another package being selected instead of what I am trying

I am trying to install dhcp3-server,but it is instead selecting isc-dhcp- server and its not working as per my expectations. Please help.                Reading package lists... Done      Building dependency tree             Reading state information... Done      Note, selecting 'isc-dhcp-server' instead of 'dhcp3-server'      I am following How To Set Up A DHCP Server For Your LAN on the HowtoForge site. There is nothing like dhcp3 in /etc/init.d


In the usage string of my custom shell script, shall I also display --help and --version?

I'm currently developing a shell script, called `up`, which shows a usage string on the commandline when called with `\--help`. The output looks like this:               $ up --help     usage: up [-n levels][--help][--versions][basename]...      This looks okay but I'm wondering if I actually need to show the `\--help` and `\--version` options because they are a widely accepted standard and only seem to add noise to the usage string.


KVM guest as default gateway for bridged network

I currently have two vm's both on kvm (virt-manager), both running on separate virtual interfaces (`virbr0` and `virbr1`). The IP of `virbr0` is 192.168.122.0; the IP of `virbr1` is 192.168.123.0. Both VMs can talk to each other. I am trying to make all traffic go through the VM on `virbr0` (122.0) before going to `virbr1` (123.0) from the host machine. Deleting the routing table for 123.0 and adding a new entry with the 122.0 VM as a gateway does not work, and the VMs lose connection after the route is deleted. Any ideas how the traffic can be forwarded to 122.0 before hitting 123.0?


How do I Nohup an interactive shell-script?

My Script is having 2 command-line arguments and then just couple of questions, after these questions the script will run for itself, I'm able to pass the command-line argument by just doing,               -bash-3.2$ nohup ./Script.sh 21 7     nohup: appending output to `nohup.out'          -bash-3.2$      Anyway to add the answers of these to-be-asked-questions with nohup?


Where can I find hplip debug documentation?

I need to monitor HP printer state (ink, paper, etc). Hplip has hp-info tool with debug-mode and very verbose output. But I can't find any documentation with explanation of its data. For example:               hp-info[31896]: debug: printer_status=1     hp-info[31896]: debug: device_status=2     hp-info[31896]: debug: cover_status=4     hp-info[31896]: debug: detected_error_state=64 (0x40)     hp-info[31896]: debug: Printer status=1000


Do spellcheckers exist that are aware of Markdown?

I would like to run a spellchecker over my articles before I publish them. I think `aspell` is ok, but it should not try to check code blocks:               asdfasdfa adsfa sdfa text to check adsfasd f          ```     a wild code block appeared!     thisHas quiteOften() some strings.that should NOT get changed     ```          and also `inlined code` should not get checked      **Do command line based spellcheckers exist for Linux that are aware of Markdown and hence ignore code blocks?** I need to be able to run this in batch mode for multiple files. (Bonus points if you know one that really understands LaTeX - no, `aspell -t` does not completely work)


How to get the Job ID?

As we know, the shell enables the user to run background processes using `&` at the command line's end. Each background process is identified by a job ID and, of course, by it's PID. When I'm executing a new job, the output is something like `[1] 1234` (the second number is the process ID). Trying to invoke commands like `stop 1` and `stop %1` causes a failure message: `stop: Unknown job: 1` Understanding that the `stop` command causes a job to be suspended, I was wondering **how to get the job ID** and do it right. If the only way to kill a job is by it's process ID, **what is the purpose of the job ID**?


How to open multiple LUKS volumes with key entered in initramfs?

I have a Debian 7.4 (stable) based server configured to use an encrypted (RAID1 + LVM) root partition (/boot is un-encrypted regular partition) to which I installed dropbear SSH server so I can remotely enter the LUKS encryption passphrase. In addition to the root partition/volume I have other RAID1+cryptsetup+LVM volumes that I would like to be able to open with the same passphrase. I googled and found out I can use the script /lib/cryptsetup/scripts/decrypt_keyctl to cache passphrases and open multiple volumes with the same passphrase. But how do I use this script with the passphrase entered in initramfs stage?


Behavior of rsyslog writing to a pipe

I configure `rsyslog` with an additional entry, like this:               *.* |/var/log/logpipes/pipe1      and have my own evaluation program for the messages received. This works so far, but I am unsure, how `rsyslog` behaves if my pipe reader crashes. Would this block all other logging activities as well? I have logfiles too and plan to use `rsyslog-pgsql` and I cannot see, if `rsyslog` works with multiple threads, so, if one of them hangs [pipe reader hangs], if these other logging threads will continue.


Deciding on a font, and determining the proper notation

I have an X11 program that allows you to set a font. It apparently accepts the 'standard' X Logical Font Description. This notation is fairly obscure, and while the document I linked to mentions it, it doesn't actually describe the syntax. Is there some kind of font picking tool that will provide a list of valid fonts, and allow me to picket a font from the list, and specify the sizes and such, then print out this notation? > X Logical Font Description X11 core font instances are usually specified > using a notation known as the X Logical Font Description (XLFD). An XLFD > starts with a dash `-', and consists of fourteen fields separated by dashes, > for example: > > -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1


Run script as root under Busybox?

I have written a shell script that has to be run as root under Busybox. My first thought was to add the script to /etc/busybox.conf like this:               /sbin/my_script.sh = ssx root.root      But this only works with the Busybox apps. How can I allow the script to be run with root permissions when executed by a normal user?


Can't start vsftpd on Fedora

I have installed vsftpd on my new Eee pc with Fedora 18:               sudo yum install vsftpd      How is it? :               systemctl is-active vsftpd.service      and got               failed      Then               systemctl status vsftpd.service      got               Failed to start Vsftpd demon     Unit vsftpd.service entered failed state      What is the best way to start repairing vsftpd?


Creating partition from a start point till the end of the disk using parted

This is my partition table :               Model: ATA Hitachi HTS54757 (scsi)     Disk /dev/sda: 750GB     Sector size (logical/physical): 512B/4096B     Partition Table: gpt     Disk Flags:           Number  Start   End     Size    File system  Name                  Flags      1      17.4kB  134MB   134MB                Mi                    msftres      2      135MB   86.2GB  86.1GB  ntfs         Ba      3      86.2GB  86.5GB  315MB   ntfs         Ba                    hidden      4      86.5GB  86.6GB  105MB   fat16        EFI System Partition  boot      5      86.6GB  86.8GB  210MB   fat16      9      86.8GB  129GB   42.6GB                                     lvm      6      129GB   236GB   107GB   ntfs      7      236GB   343GB   107GB   ntfs      I want to create a last partition till the end of the disk to be like this :               8      343GB   750GB   407GB   ntfs      How to achieve this in case if i didn't know where to stop, i want to till parted that i want to make a partition from `343GB` till the end of the disk, how to do so ? I'm using parted 3.1


Apache throws 403 Forbidden after moving DocumentRoot (CentOS 6.4)

I installed Apache via yum on CentOS 6.4. I changed the `DocumentRoot` in `/etc/httpd/conf/httpd.conf` to point to `/home/djc/www`:               DocumentRoot "/home/djc/www"     <Directory "/home/djc/www">         Options Indexes FollowSymLinks         AllowOverride None         Order allow,deny         Allow from all     </Directory>      FS permissions:               djc@vm ~ $ ls -l     drwxrwxr-x.  3 djc djc   4096 Jan 14 11:17 www      No SELinux:               djc@vm ~ $ sestatus     SELinux status:                 disabled      What am I missing?


What is the easiest way to clone an embedded linux SD Card?

I have a 8 GB SD Card (card 1) installed with embedded linux for Power PC, libraries and some applications. I want to prepare another 8GB SD Card (card 2) exactly like card 1. What is the easiest way to do this? I tried copying all the files from card 1 to a linux laptop and then from the laptop to card 2 but I am getting some permission denied errors in spite to doing this in root. Is my approach correct? Please suggest any other techniques.


Using a laptop as a bridge between Internet and LAN for SSH connections.

We have a lan and a server running HPUX that isn't connected to the Internet. I have a server and a laptop on the same network. When I plug in the laptop via ethernet cable, its Internet connection drops, despite already being connected via wifi to a network with Internet access. From the laptop, I can only SSH to the server using its internal IP address.( 192.168...) What I wonder is, can I connect to the server from somewhere else in the world via the laptop? How can I make the laptop act as a bridge between the Internet and the LAN? How would I then access the server?


Difference between .tar.gz.asc, git.tar.bz2 and .tar.bz2

I have a Mac running OSX 10.9.1 and I want to install Gerris and its dependencies. In the last lines of the page I have to install ffmpeg. But there are lots of releases of ffmpeg. Which one I should choose?


not able to access raspberry pi webcam server from chrome and ie9

I am trying to use my raspberry pi as a webcam server(using motion library). After tweaking I found this tutorial and implemented the same. I am able to access the webcam data using firefox. from Chrome and IE I am not getting. Can anyone tell me how to do this?


Solaris 11: How to use ILB to create HA loadbalancer across two backend servers?

I'm attempting to use Solaris 11's ILB to create a loadbalancer across two backend DNS servers. Here's my requirements: Two external IPs: .XXX.YYY, .XXX.ZZZ - these are the DNS IP's that our clients hit Two ILB boxes in a HA configuration over those two external IPs Two backend DNS servers I'd like to have the two ILB boxes (ilb1 and ilb2) each load balance across the two DNS servers (ns1 and ns2) on two different incoming IPs. I'd like ilb1 to be primary on .XXX.YYY and secondary on .XXX.ZZZ, and ilb to be the inverse of this. This way, if either of the DNS servers or the ILB servers goes down, DNS requests should continue unimpacted. However, we can't go Full NAT on this due to our requirements that the backend servers have to be able to see the actual SRC_IP of the DNS request - going full NAT makes it look to the DNS servers that all requests are coming from the ILB boxes, not the clients themselves. Going HALF-NAT will correctly maintain the SRC_IP of the DNS request, however that means that the packet now has to be routed through the ILB box that it was requested from, so that the correct IP is on the packet when it gets to the client, otherwise the client will throw it out ("response from unexpected source" and the like). Here's the sticky issue - since there are two IPs, how do I reliably route the request back through the correct ILB box? /etc/defaultrouter on the DNS boxes only lets you use 1 IP, so roughly half of our responses would be trashed. Is this setup possible? Is my description clear as mud?


LXC migrate between hosts

I had setup a testsystem with LXC and installed a webserver etc. that all was not the problem. But now I want to swich to another host system also I compressed /var/lib/lxc/webserver and copied it to the other host. But there i got serval errors:               lxc-start: failed to attach 'vethO5HJ2b' to the bridge 'lxcbr0' : No such device     lxc-start: failed to create netdev     lxc-start: failed to create the network     lxc-start: failed to spawn 'webserver'      In the config i did found settings for network. Any Ideas to fix the network issue or exits a better way to migrate between hosts ? ifconfig -a Host1 (VM is working here)               eth0      Link encap:Ethernet  Hardware Adresse 00:25:90:d2:c2:d6                 inet Adresse:85.xxx.xxx.43  Bcast:85.xxx.xxx.43  Maske:255.255.255.255               inet6-Adresse: fe80::225:90ff:fed2:c2d6/64 Gültigkeitsbereich:Verbindung               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1               RX packets:186831047 errors:0 dropped:0 overruns:0 frame:0               TX packets:170397357 errors:0 dropped:0 overruns:0 carrier:0               Kollisionen:0 Sendewarteschlangenlänge:1000                RX-Bytes:14641876568 (14.6 GB)  TX-Bytes:32363758586 (32.3 GB)               Speicher:f7100000-f7180000           eth0:1    Link encap:Ethernet  Hardware Adresse 00:25:90:d2:c2:d6                 inet Adresse:81.xxx.xxx.247  Bcast:81.xxx.xxx.255  Maske:255.255.255.255               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1               Speicher:f7100000-f7180000           eth1      Link encap:Ethernet  Hardware Adresse 00:25:90:d2:c2:d7                 BROADCAST MULTICAST  MTU:1500  Metrik:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               Kollisionen:0 Sendewarteschlangenlänge:1000                RX-Bytes:0 (0.0 B)  TX-Bytes:0 (0.0 B)               Interrupt:20 Speicher:f7200000-f7220000           lo        Link encap:Lokale Schleife                 inet Adresse:127.0.0.1  Maske:255.0.0.0               inet6-Adresse: ::1/128 Gültigkeitsbereich:Maschine               UP LOOPBACK RUNNING  MTU:65536  Metrik:1               RX packets:22574 errors:0 dropped:0 overruns:0 frame:0               TX packets:22574 errors:0 dropped:0 overruns:0 carrier:0               Kollisionen:0 Sendewarteschlangenlänge:0                RX-Bytes:4393152 (4.3 MB)  TX-Bytes:4393152 (4.3 MB)          lxcbr0    Link encap:Ethernet  Hardware Adresse ee:2c:00:bf:f0:a9                 inet Adresse:10.0.3.1  Bcast:10.0.3.255  Maske:255.255.255.0               inet6-Adresse: fe80::ec2c:ff:febf:f0a9/64 Gültigkeitsbereich:Verbindung               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:6 errors:0 dropped:0 overruns:0 carrier:0               Kollisionen:0 Sendewarteschlangenlänge:0                RX-Bytes:0 (0.0 B)  TX-Bytes:468 (468.0 B)          bridge name bridge id       STP enabled interfaces     lxcbr0      8000.000000000000   no            ls: Zugriff auf /var/log/upstart/lxc* nicht möglich: Datei oder Verzeichnis nicht gefunden (in English, not found)            $ brctl show     bridge name bridge id       STP enabled interfaces     lxcbr0      8000.000000000000   no           minecraft@h2210663:~$ ls -l /var/log/upstart/lxc*     ls: Zugriff auf /var/log/upstart/lxc* nicht möglich: Datei oder Verzeichnis nicht gefunden     minecraft@h2210663:~$ cat /etc/default/lxc     # MIRROR to be used by ubuntu template at container creation:     # Leaving it undefined is fine     #MIRROR="http://archive.ubuntu.com/ubuntu"     # or      #MIRROR="http://<host-ip-addr>:3142/archive.ubuntu.com/ubuntu"          # LXC_AUTO - whether or not to start containers symlinked under     # /etc/lxc/auto     LXC_AUTO="true"          # Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your     # containers.  Set to "false" if you'll use virbr0 or another existing     # bridge, or mavlan to your host's NIC.     USE_LXC_BRIDGE="true"          # If you change the LXC_BRIDGE to something other than lxcbr0, then     # you will also need to update your /etc/lxc/default.conf as well as the     # configuration (/var/lib/lxc/<container>/config) for any containers     # already created using the default config to reflect the new bridge     # name.     # If you have the dnsmasq daemon installed, you'll also have to update     # /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon.     LXC_BRIDGE="lxcbr0"     LXC_ADDR="10.0.3.1"     LXC_NETMASK="255.255.255.0"     LXC_NETWORK="10.0.3.0/24"     LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"     LXC_DHCP_MAX="253"          LXC_SHUTDOWN_TIMEOUT=120          $ cat /etc/init/lxc-net.conf     description "lxc network"     author "Serge Hallyn <serge.hallyn@canonical.com>"          start on starting lxc     stop on stopped lxc          env USE_LXC_BRIDGE="false"     env LXC_BRIDGE="lxcbr0"     env LXC_ADDR="10.0.3.1"     env LXC_NETMASK="255.255.255.0"     env LXC_NETWORK="10.0.3.0/24"     env LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"     env LXC_DHCP_MAX="253"     env varrun="/var/run/lxc"          pre-start script         [ -f /etc/default/lxc ] && . /etc/default/lxc              [ "x$USE_LXC_BRIDGE" = "xtrue" ] || { stop; exit 0; }              cleanup() {             # dnsmasq failed to start, clean up the bridge             iptables -t nat -D POSTROUTING -s ${LXC_NETWORK} ! -d ${LXC_NETWORK} -j MASQUERADE || true             ifconfig ${LXC_BRIDGE} down || true             brctl delbr ${LXC_BRIDGE} || true         }              if [ -d /sys/class/net/${LXC_BRIDGE} ]; then             if [ ! -f ${varrun}/network_up ]; then                 # bridge exists, but we didn't start it                 stop;             fi             exit 0;         fi              # set up the lxc network         echo 1 > /proc/sys/net/ipv4/ip_forward         mkdir -p ${varrun}         brctl addbr ${LXC_BRIDGE}         ifconfig ${LXC_BRIDGE} ${LXC_ADDR} netmask ${LXC_NETMASK} up         iptables -t nat -A POSTROUTING -s ${LXC_NETWORK} ! -d ${LXC_NETWORK} -j MASQUERADE         dnsmasq -u lxc-dnsmasq --strict-order --bind-interfaces --pid-file=${varrun}/dnsmasq.pid --conf-file= --listen-address ${LXC_ADDR} --dhcp-range ${LXC_DHCP_RANGE} --dhcp-lease-max=${LXC_DHCP_MAX} --dhcp-no-override --except-interface=lo --interface=${LXC_BRIDGE} --dhcp-leasefile=/var/lib/misc/dnsmasq.${LXC_BRIDGE}.leases --dhcp-authoritative || cleanup         touch ${varrun}/network_up     end script          post-stop script         [ -f /etc/default/lxc ] && . /etc/default/lxc         [ -f "${varrun}/network_up" ] || exit 0;         # if $LXC_BRIDGE has attached interfaces, don't shut it down         ls /sys/class/net/${LXC_BRIDGE}/brif/* > /dev/null 2>&1 && exit 0;              if [ -d /sys/class/net/${LXC_BRIDGE} ]; then             ifconfig ${LXC_BRIDGE} down             iptables -t nat -D POSTROUTING -s ${LXC_NETWORK} ! -d ${LXC_NETWORK} -j MASQUERADE || true             pid=`cat ${varrun}/dnsmasq.pid 2>/dev/null` && kill -9 $pid || true             rm -f ${varrun}/dnsmasq.pid             brctl delbr ${LXC_BRIDGE}         fi         rm -f ${varrun}/network_up     end script      Host2 (destination)               eth0      Link encap:Ethernet  Hardware Adresse 00:25:90:ae:09:6a                 inet Adresse:2xx.xx4.xxx.217  Bcast:2xx.xx4.xxx.255  Maske:255.255.255.192               inet6-Adresse: fe80::225:90ff:feae:96a/64 Gültigkeitsbereich:Verbindung               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1               RX packets:2876153658 errors:0 dropped:48779 overruns:0 frame:0               TX packets:2680725017 errors:0 dropped:0 overruns:0 carrier:0               Kollisionen:0 Sendewarteschlangenlänge:1000                RX bytes:234344379020 (218.2 GiB)  TX bytes:710758489234 (661.9 GiB)               Interrupt:16 Speicher:df900000-df920000           eth0:1    Link encap:Ethernet  Hardware Adresse 00:25:90:ae:09:6a                 inet Adresse:2xx.xx4.xxx.252  Bcast:2xx.xx4.xxx.255  Maske:255.255.255.192               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1               Interrupt:16 Speicher:df900000-df920000           eth1      Link encap:Ethernet  Hardware Adresse 00:25:90:ae:09:6b                 BROADCAST MULTICAST  MTU:1500  Metrik:1               RX packets:0 errors:0 dropped:0 overruns:0 frame:0               TX packets:0 errors:0 dropped:0 overruns:0 carrier:0               Kollisionen:0 Sendewarteschlangenlänge:1000                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)               Interrupt:20 Speicher:dfa00000-dfa20000           lo        Link encap:Lokale Schleife                 inet Adresse:127.0.0.1  Maske:255.0.0.0               inet6-Adresse: ::1/128 Gültigkeitsbereich:Maschine               UP LOOPBACK RUNNING  MTU:16436  Metrik:1               RX packets:738956166 errors:0 dropped:0 overruns:0 frame:0               TX packets:738956166 errors:0 dropped:0 overruns:0 carrier:0               Kollisionen:0 Sendewarteschlangenlänge:0                RX bytes:65605834297 (61.1 GiB)  TX bytes:65605834297 (61.1 GiB)     $ brctl show     bridge name bridge id       STP enabled interfaces             $ ls: Zugriff auf /var/log/upstart/lxc* nicht möglich: Datei oder Verzeichnis nicht gefunden (in English, not found)           $ cat /etc/default/lxc     # /etc/default/lxc          LXC_AUTO="true"     LXC_DIRECTORY="/ssd/lib/lxc"          $ cat /etc/init/lxc-net.conf     cat: /etc/init/lxc-net.conf: Datei oder Verzeichnis nicht gefunden (in English, not found)


Can the "du" program be made less aggressive?

We have a regular job that does `du` summaries of a number of subdirectories, picking out worst offenders, and use the output to find if there are things that are rapidly rising to spot potential problems. We use `diff` against snapshots to compare them. There is a top level directory, with a number (few hundred) of subdirectories, each of which may contain 10's of thousands of files each (or more). A "`du -s`" in this context can be very IO aggressive, causing our server to bail its cache and then massive IO spikes which are a very unwelcome side affect. What strategy can be used to get the same data, without the unwanted side effects?