Mostrando postagens com marcador linux. Mostrar todas as postagens
Mostrando postagens com marcador linux. Mostrar todas as postagens

quarta-feira, 16 de outubro de 2019

List total hits of iptable drops

I have been busy making and studying defense strategies to better implement and monitor my firewall system.

So after you have decided to insert DROP rules in your iptables, it is a good practice to check the statistics of how efficient the additional "load" has been to your overall performance, that is, is it effective or should you leave it for fail2ban to control the hits ?

I made a bash script to summaries the hits on iptables rules to avoid all the stdout that obfuscates the  important information.

As usually sad, use at your own risk.  Make a backup plan before proceeding.

#!/bin/bash
#
# check how many hits on iptables drop rule
# by braselectron.com  OCT 16, 2019
#
# iptables formated output example needed:

# '0 0 DROP all -- any any 47.203.94.77 anywhere'
#

# so now clear and fix the spaces on the output
#
readarray iptls <<< "$(sudo iptables -vnL | grep DROP |\

 sed 's/  / /g' | sed 's/  / /g' | sed 's/  / /g' |\
 sed 's/^ //g')"
#
# debug point
# echo "iptls lenght is ${#iptls[@]}"
#
echo -e "Hits\tTarget Denied"
for element in "${iptls[@]}"
do

  #
  # debug point
  # echo "> $element"

  #
  verify=( $(echo "$element" | cut -d " " -f 1) )

  #
  # debug point
  # echo "verify = $verify"

  #
  if [ "$verify" -ne "0" ]; then
     hits="$verify"
     target=( $(echo "$element" | cut -d " " -f 8) )
     echo -e "$hits\t$target"
  fi
done

If all goes well you will get a output similar to this:

Hits    Target Denied
1       198.108.66.0/23
4       92.118.161.0/24
3       92.118.160.0/24
1       74.82.47.0/24
1       185.173.35.0/24
1       71.6.128.0/17
2       122.228.0.0/16
4       95.154.101.209
1131    139.59.13.150

But this is based on my active iptables rules.

Shields up captain!
Cheers!

How to fix id3tag of mp3 files

Preliminary notes:

This post is the sum of many hours of researching the web for solutions, reading for many hours: man, info and community pages. And a lot of testing.

This is a solution for Linux users (probably also good for MacOS too).  MS Windows user, sorry, you need to contact MS support for help.

Part of the following is cut/past form other sources I found on the web.  Thank you for the active community of Linux users like me.

As usually noted, the following is for sharing knowledge only, do it at your own risk!  Make a backup plan before proceeding.

Basic knowledge:

Libavformat (lavf) is a library for dealing with various media container formats.  Its main two purposes are demuxing - i.e. splitting a media file into component streams, and the reverse process of muxing - writing supplied data in a specified container format.

The MP3 muxer writes a raw MP3 stream with the following optional features:

An ID3v2 metadata header at the beginning (enabled by default). Versions 2.3 and 2.4 are supported, the id3v2_version private option controls which one is used (3 or 4).

Setting id3v2_version to "0" disables the ID3v2 header completely.

The muxer usually support writing attached pictures (APIC frames) to the ID3v2 header. The pictures are supplied to the muxer in form of a video stream with a single packet. There can be any number of those streams, each will correspond to a single APIC frame. The stream metadata tags title and comment map to APIC description and picture type respectively.

See http://id3.org/id3v2.4.0-frames for allowed picture types.

Note that the APIC frames must be written at the beginning, so the muxer will buffer the audio frames until it gets all the pictures. It is therefore advised to provide the pictures as soon as possible to avoid excessive buffering.  Also keep picture small (ie. less than 1% of total mp3 size is a good rule/target to follow).

A Xing/LAME frame right after the ID3v2 header (if present). It is enabled by default, but will be written only if the output is seekable. The write_xing private option can be used to disable it. The frame contains various information that may be useful to the decoder, like the audio duration or encoder delay.

A legacy ID3v1 tag at the end of the file (disabled by default). It may be enabled with the write_id3v1 private option, but as its capabilities are very limited, its usage is not recommended.  This is important for old mp3 players that only understand ID3v1 tags.


Examples:

On the next part you must change the input, out.mp3 and cover.png to your own fit.

1) Write an mp3 with an ID3v2.3 header and an ID3v1 footer:

ffmpeg -i input.mp3 -id3v2_version 3 -write_id3v1 1 out.mp3

2) To attach a picture to an mp3 file select both the audio and the picture stream with map:

ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1 \
-metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3

3) Write a "clean" MP3 without any extra features:

ffmpeg -i input.wav -write_xing 0 -id3v2_version 0 out.mp3


Let's get work done:
So this is what I did to add a cover image to a mp3 that already had id3tags:

ffmpeg -i orignal.mp3 -i cover.jpg -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v comment="Cover (Front)" final.mp3


Other thoughts:

I did use a jpeg image for the cover and ffmpeg accepted it as well as vlc, mpv and other players I tested did work fine.

So if you need to include the same cover on many files (ie an album) in a folder, you can do this:

1) "cd" to the target folder
2) "mkdir new" in the target folder
3) rename the cover image file to cover.<ext> where <ext> could be png or jpg depends on your choice and particular case, or convert it to jpg.
3) then copy and past the following script (and hit the [ENTER] key):

for file in *.mp3; do ffmpeg -i "${file}" -i cover.jpg \
 -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v \
 comment='Cover (Front)' ./new/"${file}"; done

After it runs you will have a sub-folder with the new mp3 files all with the embedded cover image you inserted with the script.

Have fun!  Cheers!

quarta-feira, 25 de setembro de 2019

Check your servers are UP - Linux BASH

Recently I was trying to check if one of my servers had a glitch, so after some research and coding I came up with this solution for Linux (ie. in my case for Raspbian Jessie):

1) Get the following code and save it to your target server.

#!/bin/bash
#
# Test connectivity with ping

# filename: test_alive.sh
#
# braselectron.com - September 25, 2019
#
# get IP from command line argument
#
ip=$1
#
# check IP address format code
# Mitch Frazier - Linux Journal - June 26, 2008
#
valid_ip () {
    local  ip=$1
    local  stat=1
    if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
        OIFS=$IFS
        IFS='.'
        ip=($ip)
        IFS=$OIFS
        [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
        stat=$?
    fi
    return $stat
}
#
# check syntax
#
if [ $# -eq 0 ]
   then echo "syntax: test_live.sh <ip address>"
   exit 1
fi
#
if ! valid_ip $ip
   then echo "IP is invalid"
   exit 1
fi
#
# ping but don't wait
# log if ping fails
#
while true
   do ping -w 1 -c 1 $ip |\
      grep received |\
      cut -d" " -f 4 |\
      if [ "$(cat -)" != "1" ]
         then echo "Ping failed $(date)"
      fi
   done
 

 2) Choose another host on your network to ping that is up (for sure) and is trusted by you.  For example: 192.168.0.1 (usually the router on your network - default factory value).

3) Now using "nohup" to setup your test on the target host, at the command terminal, do this:

nohup  /bin/bash test_alive.sh 192.168.0.1 &
# remember to rename the 192.168.0.1 with your host IP (step 2)

4) Now you can logoff and from time to time check the nohup.out file to see if the ping failed.

5) When you are satisfied with your tests just kill the process on the target host, doing this:

5.1) first find your process with:  ps -ef | grep test_alive

This will give you a output similar to this:

pi        1257  4688  1 17:59 pts/1    00:00:00 grep --color=auto test_alive
pi       22213     1  9 15:08 ?        00:16:24 /bin/bash test_alive.sh 192.168.0.1


5.2) get the process id and kill it with:  kill 22213  # caution! use your id number

5.3) and remove the  nohup.out file with: rm nohup.out

NOTE:  if the nohup.out file is empty, means no erros, your server is working and connectivity is working.  But if the target host is freezing or other problems that make the script stop, this may mislead your conclusion.

Cheers!

quarta-feira, 20 de fevereiro de 2019

LTS lifecycle for Ubuntu

Although security is a very important subject (one of the most important), I’d take the opportunity focus on the "LTS lifecycle".

What got my attention when I moved my private and "work" desktops, netbooks and laptops to Ubuntu back in 2006 was the fact that main goal of Ubuntu with the "Long Term Support" was the "support", meaning: planning, work goals, security updates, patches and documentations available online, and having people talk/blog about how they fix bugs and explaining there solutions, this is the real meaning of the word "ubuntu". But sadly now I have to move soon from 14.04.5 (ie I will be forced to upgrade) to 18.04.x, in the next few weeks because of the deadline.

From a business point perspective, the LTS lifecycle, considering the maturity and stability of a distribution, only is achieved after 3 or more years of using, troubleshooting, creating, cross-compiling, ... lots of hard work,  showing that you need to set at least 8 (eight) years as the goal for LTS!

I say this in respect to the great effort and cost to upgrade a version, which impacts considerably the working environment not only for the home, small, to medium and big companies, specially when the hardware takes longer to update, in realty, in most countries (ie. Africa, South America, middle East, etc) at least 8 to 10 years is quite common.

As an example, my main working desktop, here in Brazil, which I do most of my work, is a Gigabyte model: 965P-DS3, with a GeForce GT610, Intel Core2Duo 6300 with 8GB of RAM and 500GB HDD, which is an excellent work station for my needs, not only for work, but for Internet browsing, banking, YouTube, office, etc. But with limited BIOS features, makes it a real challenge and pain to upgrade (specially for a fresh install).

It is not only a question of buying a new hardware, which in my case, and in many countries, can be a very expensive step (can cost up to 3x the price compared to the USA market), but also because of ecological consciousness, carbon footprint, and who really thinks about "ubuntu".

sábado, 1 de julho de 2017

Ultimate Guide for Multiboot USB - All Your CD/DVD Live on a USB

For many years, all IT enthusiasts struggle with CD and DVD for system installations, upgrades, recovery or just to test a new release.

Also I was always having problems with GPL, shareware, freeware, IDEs, scripts, and other initiatives that  from time to time stop working, or don't support your target distro or go buggy.

I had a hard time dealing with BIOS/EFI/UEFI different standard, brands and approaches to bootstrap your system and startup a selected OS from a block or stream device (ie. HDD, ODD, SSD, etc.)

To make it even more difficult, old BIOS desktops usually make USB option very difficult task (since USB is relatively new in PC world of BIOS devices).  So many updated solutions just drop support for old systems, and people like me that like to use old (but as good as new) devices that are neglected by the Y/Z generation, but in some cases are the very best to help many who can not afford continuous updates of hardware (almost every six months), specially for poor countries and community schools.  And also to have a positive environmental attitude: reduce, reuse, recycle.

So after many years testing all options available I believe that now I have a stable (and understandable), straightforward solution.

Dependencies:

1. Have a working GNU distribuition (I use Ubuntu 14.04.5 i686)
2. Syslinux - isohybrid - Postprocess ISO images for hybrid mode
3. dd - convert, copy a file to devices
4. gparted (and also a win32 VM with a partition program if needed)
5. nano, vi or gedit (or any editor)

Procedure steps:

1. Start by downloading the Live ISO image you would usually burn a CD/DVD.

2. Prepare the ISO to be usable on a USB/HDD/SSD by the command:

  isohybrid --partok <name_of_iso_file>

Ref: http://www.syslinux.org/wiki/index.php?title=Isohybrid

3. Partition a new USB (or backup it first and clean all files from it) as the following:

3.1. Now with a clean USB you can just start by resize it using gparted or a win32 partitioning application, so that is about 512MB and leave all the rest as free space.

Notice that you will not need to much space for the first partition because it should hold only the syslinux modules, configuration files and your customization image for background.

3.2. Now create as many new partitions as needed to accommodate each live ISO you will want to boot, but follow this rule: use a round value always larger than the ISO file size.  Exemple: for 1.1GB ISO use a 1.5/2GB partition.  For a 220MB ISO use a 512MB partiton.  For a 640MB use a 1GB partiton.  Usually 512MB increments is a good rule, but avoid very tight choices, exemple: for a 1.9GB choose 2.5GB not 2GB.  This is just to avoid last minute problems and have to start all over again.  Remember, this takes time.  But this is not a strict order, try it out if you need to save space

3.3.  Remember that DOS only understands 4 primary partitions and on USB only ONE, so you should a good strategy is to create a extended partition and many logical partitions (as many as you wish/need), limited to your USB available space/size, remember that sectors usually are in 512 bytes increments.

4. Format the first partition as FAT (FAT16 not FAT32).  Sometimes FAT32 will work, but FAT16 will make first bootloader sector be on the right spot (on sector number 63) or you will hack it with fdisk and more the first sector to position 63.

Tip:
The bootloader must start on setor 63, which is the physical sector number (or LBA) containing the first sector of the partition (unlike the sector count used in the sectors value of CHS tuples, which counts from one, the absolute or LBA sector value starts counting from zero).

Ref: https://en.wikipedia.org/wiki/Master_boot_record#Disk_identity


5. Install syslinux bootloader (I use example that my USB is /dev/sdb):

  syslinux --directory /boot/syslinux/ --install /dev/sdb1

Ref: http://www.syslinux.org/wiki/index.php?title=Install#Linux


6. Edit the /boot/syslinux/syslinux.cfg and insert the ISO partitions you will create, one by one, following this framework at the end of the file:

#start partition X  where X is 2,3...n
LABEL ubuntu-sdbX
MENU LABEL <Name the ISO>
COM32 chain.c32
APPEND boot X
#end


Example:

You could use the following syslinux.cfg:

# This file was created origionally by MultiBootUSB.
default vesamenu.c32
prompt 0
menu title John's MultiBoot USB
#MENU BACKGROUND image
MENU BACKGROUND MYU-bg.png
TIMEOUT 300
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW -1
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
MENU HELPMSGROW 22
MENU HELPMSGENDROW -1
MENU HIDDENROW -2
MENU HSHIFT 0
MENU VSHIFT 0
MENU COLOR border       30;44   #40ffffff #a0000000 std
MENU COLOR title        1;36;44 #9033ccff #a0000000 std
MENU COLOR sel          7;37;40 #e0ffffff #20ffffff all
MENU COLOR unsel        37;44   #50ffffff #a0000000 std
MENU COLOR help         37;40   #c0ffffff #a0000000 std
MENU COLOR timeout_msg  37;40   #80ffffff #00000000 std
MENU COLOR timeout      1;37;40 #c0ffffff #00000000 std
MENU COLOR msg07        37;40   #90ffffff #a0000000 std
MENU COLOR tabmsg       31;40   #30ffffff #00000000 std
label Boot from Hard Drive
MENU LABEL Boot from  Hard Disk
KERNEL chain.c32
APPEND hd1
MENU DEFAULT

#start extended partition 5
LABEL ubuntu-sdb5
MENU LABEL Ubuntu 14.04.5 i686(32bits)
COM32 chain.c32
APPEND boot 5
#end ubuntu extended

#start extended partition 6
LABEL ubuntu-sdb6
MENU LABEL Ubuntu 14.04.5 amd (64bits)
COM32 chain.c32
APPEND boot 6
#end ubuntu extended

#start extended partition 7
LABEL ubuntu-sdb7
MENU LABEL GParted Live 0.28
COM32 chain.c32
APPEND boot 7
#end ubuntu extended


REF:  http://multibootusb.org/


7. Now lets copy the prepared ISO files (see previous procedure 2)

  dd if=<prepared ISO file name> of=/dev/sdbX bs=2048

Please double check your device location (use df -h) and also check the correct partition to set the X variable of the command, since each partition was made with the size as a critical factor.

That is it, you now have a MULTIPLE BOOT USB for ISO live images.

To test the new multiboot usb use qemu with the command:

qemu-system-i386 -enable-kvm -localtime -m 1024M \
-vga std -drive file=/dev/sdb,cache=none,format=raw,if=virtio


Check this screenshot of a 4GB USB stick (32/64 bits ubuntu and gparted ISOs)




Please share your tests and help make it better.

Cheers!

quarta-feira, 15 de fevereiro de 2017

Ubuntu 14.04.5 with Epson L455

So this is log about my experience with Epson L455 multifunction printer that I bought in Brazil.

Does it work?

Short answer: YES!

Not only I did setup the printer using only a Linux station with a Mozilla/Firefox browser, but I believe the information on the WEB and also on the "quick start sheet" that comes with the printer (in the box) it not clear about this.  You do not need to use CD/DVD or the other paid OS.

Does EPSON support Linux ?

For my surprise and exactly what made me choose the EPSON printer was that it is really committed to support GNU/Linux users.

Check this (and choose Linux OS):

Does EPSON have good documentation to support Linux, see this:

And I notice support for not only Ubuntu 14.04 and 16.04 but for other flavors of Linux as well.

Does EPSON L455 scanner and printer work over wifi without the need of a USB network host computer ?

YES!  But you need to install all the packages as describe in the documentation you downloaded, and also configure properly the network, printer CUPS and SANE conf file (all detailed in the documentation).

In less then 30 minutes I figured out (ie. followed the instructions) and was not only printing with quality control but also: scanning documents and changing the network DHCP IP to a fixed IP address using just the a web browser connected to the printer WEB-GUI.  And also, don't forget to change the Admin password!

Does it work with Android, to print and scan direct to and from your phone ?

YES!  But you need to download and configure from Google Play the EPSON iPrint app.  Should work with iPhone too.


Final words:  

EPSON, THANK YOU!!!!!!  

GNU/Linux community loves you!


quinta-feira, 25 de agosto de 2016

How to prepare WD My Passport Ultra 1TB for Linux backup

I bought a WD My Passport Ultra 1TB for Windows because I was only able to find it or the MacOS version in the stores, because it had good reviews and good price < US$60

The cons is that it is not good for Linux backup out-of-the-box because NTFS does not preserve ExtFS ownership (user/group).

The second bad news is that gparted will not be able to resize the installed partition not even if you try to use Windows in virtualbox.  Actually with virtualbox it will not be able to mount the formated partition.

So you will need to use a system with Win 7 so you can use a Windows partitioning program (eg. Partition Programs) and than resize the factory installed NTFS "data" partition.

The new size should be, say, 24~340GB ( leave this space so you can exchange data with Windows (your friends or family) and to keep the special features of WD that are native stuff to Windows and avoid it from causing problems (or void your warranty).

You should now create the new Ext4 file system with the empty space, but also reformat the NTFS partition, because the native version is not correctly detected or mounted with ntfs-3g.

I choose the names for the partitions below to be easily identified.

At the end of the process you should have something like this:

1) WD_NTFS with about  32 GB
2) WD_EXT4 with about 968 GB




3) Also, does not show, but there is a hidden partition (like a CD-ROM) that WD stores the special crypto stuff and firmware copy (this is what my research found).

Considerations:

The lack of capability of gparted to handle this type of filesystem is really frustrating.  How can this be true with so many talented people in our GNU community ?

Also, I understand now that WD really ignores Linux users. This is a sad situation since most users I know and worked with, for several years, are all Linux users and we usually choose WD HDD, at home and at work.  But, from now on, I will start to choose new brands that support linux users (WD do you hear me now?!).  And you should too.

I bought a Seagate 2T similar size at < $70 and was able to use gparted to resize and create Ext4fs with no hassle.  Seagate "hear us Linux users" better.

Proud Linux User.

segunda-feira, 2 de novembro de 2015

FERRAMENTAS LINUX: Aptik Backup dos seus temas, PPA e pacotes

Ao reformatar uma máquina com o Ubuntu para instalar outra versão do zero, um dos seus maior desafios é o de ter que reinstalar todas as aplicações, utilitários e ferramentas novamente.  Existem vários programas e scripts que se propõem a fazer isso, veja o opção do APTIK Backup no link:
FERRAMENTAS LINUX: Aptik Backup dos seus temas, PPA e pacotes


quinta-feira, 12 de fevereiro de 2015

Can't remote access lubuntu server with Vino but connection with ssh works.

PROBLEM:

Can't remote access lubuntu server with Vino but can ssh it.

DESCRIPTION:

You open a ssh tunnel (map remote 5900 port to local 12345 port) of remote lubuntu station (ex: 192.1.1.180) at terminal client side to remote access lubuntu station.

Example to type at cmd prompt:
 ssh -L 12345:localhost:5900 user@192.1.1.180

         note: change "user" and address (192.1.1.180) with your own ID.

You open a second terminal window at client station to start vnc with cmd:
xvncviewer localhost:12345


Error msg client side:
xvncviewer: VNC server closed connection

Error msg server (the ssh terminal) side:
channel 3: open failed: connect failed: Connection refused

DIAGNOSE:

Vino-server not running

SOLUTION:

At cmd prompt type (remote server side):
export DISPLAY=:0.0
/usr/lib/vino/vino-server



Error msg:
Connected to RFB server, using protocol version 3.7
Server did not offer supported security type


DIAGNOSE:

server encryption scheme not understood client side

SOLUTION:

At the remote lubuntu server side set encryption variable to false


cmd prompt type:
gsettings set org.gnome.Vino require-encyption false

domingo, 7 de setembro de 2014

Reasons I Love Linux


I've have used in the past years AppleDOS, Windows 3.11, 98, XP, 7 (x32 and x64) and 8.1, Linux (many), SunOS Solaris, HP UX (Unix), OS2, IBM MVS, OS/360 - you name it, I've had my time on all of them at many moments of my working or private life.

I have also tested Linux distribuitions since the very beginning, Slackware, Debian, RedHAT, Suse, Lubuntu, Ubuntu, etc.  We used to buy magazines with a bundled CD/DVD-ROM that offered the Linux version for local install.  At that time Internet was only available in academic, companies or research centers.  Most of us used dial-up landlines to a local BBS.  The trend was to get your win-modem to work with Linux.

My very favorite operating systems for some time now, is Ubuntu Linux. Here's why:

1. Open Source and free to use. You can install it on as many computers as you like for the pretty price of absolute what you want to donate, or zero if you cannot spare some cash for now! This makes it wonderful for those on a budget, students and who get tired of constantly paying for expensive operating system upgrades.

2. It is the most stable OS that I have tested these last 30 years. I've put my kid on Windows boxes in the past only to have him mangle the operating system beyond recognition in a few short minutes. I've then put the same kid on an Ubuntu Linux box and left him playing happily for hours. 'Nuff said.

3. It's “wife” proof, that means, my wife, who is a lawyer, and does not like technology, does not call me so often like when she was using struggling with Windows, say goodbye to "my files are gone!", “updates bugs”, “virus alerts”, “BSOD”, “bad drivers”, etc.

4. Usually no Viruses or Malware. There aren't currently very many pieces of malware around for Linux boxes.  The way Linux is designed makes it very difficult for the bad guys to design malware or to crack it. As a result I don't have to bother wasting my precious computer resources on expensive antivirus programs, or having to recover my wife's or kid's system every week, hurray!!!

5. Your desktop graphics interface is a selection that can be: Unity, Gnome, LXDE, or other options of very easy to use GUI . In many ways the ease of use reminds me of the Mac computer concept when it hit the market back at the 80's but without the high price tag.

6. I can keep using my older computers as long as I want with Linux. Not only are upgrades free but the resource requirements are low enough that even older computers can use lighter versions like Lubuntu (i.e. just to mention on option), so I don't have to stop using a computer until I am ready to move on to a new one.

7. There are many open source packages that are GPL, GNU, free or pay as you need it, software available for most of all your needs.  You name it, Ubuntu has it, probably for free. They have Photoshop equivalents (Gimp), Office suite (Libreoffice), programs to see your images, hear your music, see all video types and decode streams with programs like VLC (ie. Players ) and more games (both educational and same really hot) than I have ever seen! There are programs available for Linux for literally ALL age groups and needs.

8. You can continue to use your many DOS, Windows 98 or XP, codes with WINE which runs windows codes right on you Linux screen. I use it to run LTSpice engineering circuit simulation and AXDecrypt for my confidential documents.

9. It is very powerful but at the same time very simple once you get basic “know how” of the system. While I can do almost everything I want to in the GUI, if I want to do something more complex I can always drop down to the command line and take care of business, because now I have "the power" with bash, python, C, and many other compilers and builtin tools.  For instance, I can navigate my mouse to the menu to shut down my Ubuntu computer or I can open a terminal and type "sudo shutdown -h now" or even "sudo poweroff"  at the command to turn the system off.  Ubuntu will ask me for my password and then shut the system off faster than the GUI menu ever though of doing!

10. No worries about NSA spying on you with backdoors. It is a known fact that the NSA is trying to spy on everyone. Chances are they have backdoors built into both Windows OS and applications and even on Apple computers that enable them to keep us all under surveillance. Since the source code on these operating systems is closed (some Apple Mac OSX source code is open, however), users have no way of knowing just how secure their computer really is. With Ubuntu, the source code is open so programmers all over the world look through the code to prevent these backdoors in Ubuntu.

11. It is usually easy to install hardware in Ubuntu (i.e. with exception of win-modens and some less known printers).  Plug in your printer and in moments Ubuntu has installed it. The same goes for wireless cards and many other devices commonly available. But hunting for drivers can be an issue some times, but installing bulky software or dealing with nag screens harassing you to register is gone. Most things just work, which makes life so much easier. Even my favorite old bed scanner that was dead because of lack of the right drivers for Windows 7 returned to life in Ubuntu! Yes!!!

12. A very big community of mostly friendly users, like me, with many thousands of web knowledge pages with “Howtos”, “instruct-ables”, “blogs”, “wikis”, shared experiences of almost any problem you can encounter in your life with Linux.

13. These are just same cool facts about my life before and after Linux. Let's face it, you need to be committed to get in to a better understand the Linux ways, but it is something rather FUN taking control again of your computing experience, like in the first years of home computers (ie. Sinclair, Apple II, TRS-80, Commodore, etc). Few things are as enjoyable as turning on your computer and hearing the gasps when you don't boot up Microsoft Windows.

Sure you may have to learns to answer new questions, learn a new GUI, but doing so not only spreads the word about this great operating system and also help someone to save a computer that they would otherwise throw away or loose the opportunity to “discover new worlds and boldly go where no user has gone before!”

Cheers!

segunda-feira, 20 de agosto de 2012

Ubuntu Linux: How to Mount an NFS Share using NFS Client

You need to install nfs-command package as follows (open terminal and type the following command):

$ sudo apt-get update
$ sudo apt-get install nfs-common

Task: See The List Of All Shared Directories

$ showmount -e NFS server-Ip-address
$ showmount -e <X.X.X.X> (your NFS share IP)

Task: Mount Shared Directory
Now mount your NFS directory as follows:

$ sudo mkdir /nfs
$ sudo mount -o soft,intr,rsize=8192,wsize=8192 <NFS_IP>:</folder_path> /nfs
$ df -h

How do I Access My Files Using NFS?
Just go to the mount point i.e. /nfs directory with the cd command:

$ cd /nfs
$ ls
$ gedit <file_name.ext>

How do I Remove Mounted NFS Directory (unmount NFS)?
Type the following command:

$ cd
$ sudo umount /nfs
$ df -H

sábado, 3 de dezembro de 2011

How to boot Linux with Windows XP bootloader

So you want to setup dual boot on your computer but do not want to install Grub or LILO, then read on….

Otherwise, if you are want to avoid Windows over writing Grub or LILO every time you setup Windows, then you can sacrifice the powers of Grub and keep Windows Boot Loader to boot you into Linux.

Here are the suggested steps: (Ideal case)

1) Install Linux Grub or LILO on the same partition and NOT ON THE MBR (CAUTION!)

2) Windows XP Loader (NT Loader) needs Linux Master Boot Record (MBR) to boot into Linux.
If you can boot into Linux (or already on Linux after install), grab the first 512 bytes of boot sector from the root partition of Linux where Grub is installed “/dev/sdaX” where “X” is the partition number you installed Linux root directory “/”. Then copy it to an external drive or mount the Windows partition and save it in the root directory, usually the: “C:\”.
To save the boot sector use this Linux command: 
 dd if=/dev/sdaN of=grub.bin bs=512 count=1
3) To setup Windows bootloader to load Linux, we need to add an entry corresponding to Linux.
Boot into Windows. Set appropriate attributes for boot.ini so that it is editable.
attrib -r -w -s c:\boot.ini
Add the following entry to the end of the file boot.ini:
c:\grub.bin="Ubuntu Linux ver. X.YZ"
where “X.YZ” is the version number of Linux you just installed.
Restart the machine and Windows XP boot loader shows Ubuntu Linux 7.10 as one of the options.
Select this option and viola! you should see Linux booting.

For more detailed instructions follow this : http://www.tprthai.net/bootmgr.htm
http://www.supergrubdisk.org/ provides a specialized rescue disk to restore Windows/Linux. I haven’t used it anytime though.

Here is a additional twist!

In my case, I had an existing Linux installation but I could not boot into Linux and I didn’t have a rescue disk. I installed Ext2 IFS For Windows and copied MBR which I had extracted previously before I wiped out Grub by accident. That saved my day.

You could also use “dd” for windows, but the partition numbering is “tricky”...see more about this here: http://www.chrysocome.net/dd

Some useful tips:

1) If you get a error like “hal.dll” is missing – usually is a file name problem, for exemple if you file is named “linux.bin.bin” and in the boot.ini you put “linux.bin”. Windows usually hides the extension by default and that may mislead you.

2) If you have a disk with partition say: “sda” and 3 partitions: win, linux, swap.
when you formated the windows it can destroyed the partition and then when create the part again with a new number. So before you formatted the partition Linux could be “sda3” and after it could became “sda2”. The solution is to swap the lines in “fstab”.

3) You can recover or access your new installation of Linux (that you did not put the bootloader in MBR) using the installation CD – recovery mode.
  • Insert your Ubuntu CD, reboot your computer and set it to boot from CD in the BIOS and boot into a live session. You can also use a LiveUSB if you have created one in the past.
  • Install and run Boot-Repair
  • After this, click "Recommended repair" and apply. If you are willing to use the advanced options, make sure you leave the "Reinstall GRUB" checkbox ticked.
  • Now reboot your system. The usual GRUB boot menu should appear. If it does not, hold Left Shift while booting. You will be able to choose between Ubuntu and Windows.
See more here: