0

How to grep a string in a directory and all its subdirectories' files in LINUX?

If your grep supports -R, do:
grep -R 'string' dir/
If not, then use find:
find dir/ -type f -exec grep -H 'string' {} +

0

"Remote" tab missing in My Computer properties



When you right-click My Computer icon in the Desktop and choose Properties, the Remote tab may be missing. As a result, you may be unable to configure the Remote Assistance / Remote Desktop settings. To restore the tab, follow these steps:
Click Start, Run and type this command:
regsvr32 %systemroot%\system32\remotepg.dll
If you receive an error stating that the module could not be found, or stating no registration helper is registered for this file type (which indicates a corrupt DLL), extracting a new copy from XP CD should help. Make sure that you extract the updated copy of the DLL file if you have applied the XP Service Pack in your system. Register the DLL again.
(Extract the DLL from a Slipstreamed XP CD, or copy the remotepg.dll from ServicePackFiles\i386 folder to Windows\System32 folder)
To extract the DLL from Windows XP CD, type this in Command Prompt
EXPAND X:\I386\REMOTEPG.DL_ -R C:\WINDOWS\SYSTEM32
Where X:\ is your CD-ROM drive letter. The above command assumes Windows is installed in C:\ drive. If not, change the drive letter / Path accordingly.
Example
EXPAND H:\I386\REMOTEPG.DL_ -R G:\WINDOWS\SYSTEM32

0

VirtualBox Installation crashes with 'IOError: [Errno 30] Read-only file system'

Recently I tried to install Redhat Linux in Virtualbox, however I got the below error.




By default the hard drive I created was a SATA HD, the workaround is to create a IDE hard drive instead and make it as Primary Master ID. This could be a bug in Virtualbox

2

OpenWRT for TL-WA801ND V2

I bought a TL-WA801ND router with version 2.1, unfortunately DD-WRT doesn't support it and OpenWRT only support version 1. After a few hours googling and retrying, I finally had the OpenWRT installed onto the router.

Thanks to TasksOfOhm who provided an awesome tutorial and binaries for TL-WA801ND. Please refer to the below link for more information:

Go to the link below to download the binaries:
I downloaded below ROM and flashed it into the router using the original web admin interface.

Below are the errors I had and the ways to fix it. Please note that if you download a different ROM other than r41150 you may not experience the below errors

After the router is flashed and rebooted, I typed in 192.168.1.1 and got the below errors:

  • /usr/lib/lua/luci/dispatcher.lua:211: /etc/config/luci seems to be corrupt, unable to find section 'main'
    stack traceback:
    [C]: in function 'assert'
    /usr/lib/lua/luci/dispatcher.lua:211: in function 'dispatch'
    /usr/lib/lua/luci/dispatcher.lua:195: in function

The above error occurred because /etc/config/luci does not exist. You will need to create this file yourself. To do this:
  1. Telnet 192.168.1.1 to access your router. By default, telnet access is enabled and ssh is disabled so no pasword is needed. Please set the password here then access it via ssh
  2. create /etc/config/luci file and copy the below content in:
    • config core 'main'
              option lang 'auto'
              option mediaurlbase '/luci-static/openwrt.org'
              option resourcebase '/luci-static/resources'

      config extern 'flash_keep'
              option uci '/etc/config/'
              option dropbear '/etc/dropbear/'
              option openvpn '/etc/openvpn/'
              option passwd '/etc/passwd'
              option opkg '/etc/opkg.conf'
              option firewall '/etc/firewall.user'
              option uploads '/lib/uci/upload/'

      config internal 'languages'
              option en 'English'
              option 'zh_cn' 'SimpChinese'

      config internal 'sauth'
              option sessionpath '/tmp/luci-sessions'
              option sessiontime '3600'

      config internal 'ccache'
              option enable '1'

      config internal 'themes'
              option OpenWrt '/luci-static/openwrt.org'
              option Bootstrap '/luci-static/bootstrap'
  3. Save the file and retry visiting 192.168.1.1, now I am getting
    •  
      /usr/lib/lua/luci/dispatcher.lua:284: No valid theme found
      stack traceback:
       [C]: in function 'assert'
       /usr/lib/lua/luci/dispatcher.lua:284: in function 'dispatch'
       /usr/lib/lua/luci/dispatcher.lua:195: in function 

  • To resolve the problem we need to reinstall luci-theme-bootstrap.


  •  Download the above package and upload it into the router /tmp. You can use WinSCP to upload the file. Remember to set WinSCP to use SCP protocol, not FTP or SFTP. Also in the Advanced configuration pane, need to disable Environment => SCP/Shell => Other Options => Lookup user groups
  • SSH to your router /tmp, and run below command

    •  opkg install luci-theme-bootstrap_svn-r10375-1_ar71xx.ipk

  • Revisit 192.168.1.1 you should see the OpenWRT web interface





  • 0

    Build failure using gradlew: "Could not resolve all dependencies for configuration ':app:_debugCompile'

    I was trying to build my project with Gradle in Android Studio, then I had the above error.

    To resolve this I had to use the Android SDK Manager to install "Android Support Repository". After that the project was rebuilt successfully.

    0

    Outlook unable to search emails downloaded from Google Apps Sync

    If you have Google Apps Sync installed to download the emails from Google Mail and you are not able to search the emails, the method below may help you to resolve the problem:

    Environment: Windows 7 + Outlook 2010
    Problem: Try to use the search box within Outlook to search the emails, it keeps giving nothing and the index status is showing nothing to be indexed

  • Locate the following registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search
  • Double-click the PreventIndexingOutlook registry entry.
  • In the Value data box, type 0, and then click OK.

  • If the above registry subkey "Windows Search" is not there, please create it and create PreventIndexingOutlook entry in there and set it to 0.

    Exit the Registry and try to search now in Outlook.

    Reference: http://support.microsoft.com/kb/972814/en-au

    0

    can't open or create /var/run/crond.pid: No space left on device

    This error message told us that there is no disk space left on /var

    When we run "df -h" on the system we get:

    [root@A5AFETTASB pats]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/cciss/c0d0p3     3.0G  1.7G  1.2G  59% /
    /dev/cciss/c0d0p1      99M   15M   80M  16% /boot
    /dev/cciss/c0d0p6      24G  5.9G   17G  27% /opt
    none                  1.3G     0  1.3G   0% /dev/shm
    /dev/cciss/c0d0p5     2.0G  1.1G  790M  59% /var


    Seems like only 59% disk space is used but that is not true. As the difference here is MB of space versus the almighty inode. So if we try using "df -i", we get:

    [root@A5AFETTASB pats]# df -i
    Filesystem            Inodes   IUsed   IFree IUse% Mounted on
    /dev/cciss/c0d0p3     393600   95644  297956   25% /
    /dev/cciss/c0d0p1      26104      40   26064    1% /boot
    /dev/cciss/c0d0p6    3123232   12620 3110612    1% /opt
    none                  322278       1  322277    1% /dev/shm
    /dev/cciss/c0d0p5     262144  262144       0  100% /var


    Further investigation showed, there are huge number of files created under /var/spool/clientmqueue that caused the problem:

    [root@A5AFETTASB pats]# du -h /var/spool/*
    4.0K    /var/spool/at/spool
    8.0K    /var/spool/at
    1.1G    /var/spool/clientmqueue
    12K     /var/spool/cron
    4.0K    /var/spool/cups/tmp
    8.0K    /var/spool/cups
    4.0K    /var/spool/lpd
    8.0K    /var/spool/mail
    4.0K    /var/spool/mqueue
    4.0K    /var/spool/repackage
    4.0K    /var/spool/rwho
    4.0K    /var/spool/samba
    4.0K    /var/spool/up2date
    4.0K    /var/spool/vbox


    If you don't care about the content you can simply delete the files, but you should ask yourself why you have tons of messages in that directory.


    # rm -rf /var/spool/cilentmqueue
    # mkdir /var/spool/cilentmqueue
    # chown smmsp:smmsp /var/spool/cilentmqueue
     
    If the emails are the result of crontab, below will explain how to disable it:
    http://www.cyberciti.biz/faq/disable-the-mail-alert-by-crontab-command/


    In this case the problem caused by sendmail. If you don't use it we can just disable the service


    # svcs sendmail
    STATE          STIME    FMRI
    disabled       Sep_15   svc:/network/smtp:sendmail

    Or you should probably enable it just to make sure that at and cron job output is delivered.  You can configure sendmail such that it doesn't accept remote SMTP connections.

    0

    How to block/unblock an IP from Linux?


    In order to block an IP on your Linux server you need to use iptables tools (administration tool for IPv4 packet filtering and NAT) and netfilter firewall. First you need to log into shell as root user. To block an IP address you need to type the iptables command as follows:

    Syntax to block an IP address under Linux

    iptables -A INPUT -s IP-ADDRESS -j DROP
     
    Replace IP-ADDRESS with your actual IP address. For example, if you wish to block an ip address 65.55.44.100 for whatever reason then type the command as follows:

    # iptables -A INPUT -s 65.55.44.100 -j DROP

    If you have IP tables firewall script, add the above rule to your script.
    If you just want to block access to one port from an ip 65.55.44.100 to port 25 then type command:

    # iptables -A INPUT -s 65.55.44.100 -p tcp --destination-port 25 -j DROP

    The above rule will drop all packets coming from IP 65.55.44.100 to port mail server port 25.

    CentOS / RHEL / Fedora Block An IP And Save It To Config File

    Type the following two command:
    # iptables -A INPUT -s 65.55.44.100 -j DROP
    # service iptables save

    How Do I Unblock An IP Address?

    Use the following syntax (the -d options deletes the rule from table):
    # iptables -D INPUT -s xx.xxx.xx.xx -j DROP
    # iptables -D INPUT -s 65.55.44.100 -j DROP
    # service iptables save