Sunday, October 03, 2010

Run your DataCard on OpenSuse 11.3


Past many nights, I spend playing with scripts and USB configuration to connect my ZTE data-card on Linux and results were disappointing.... But the Good News is: I finally got it work and surprisingly without working on any script.
Well solution is very very simple and here it is........
run YaST
Authenticate as root

In Network Devices select Modem
In Modem Configuraion Overview click Add
In Modem Parameters choose your modem device e.g. /dev/ttyUSB0 (already detected). Click Next
In Select Internet Service Providers Choose New
In Provider Parameters fill The followings:
Provider Name e.g. Reliance
Phone No. e.g. #777
User Name 93XXXXXXXX and Password ********** and Click Next
In Connection Parameters select Automatic Dialing and Click Next
You will be back to Modem Configuraion Overview click OK.... its done
Run qinternet from Application Browser (it comes with SUSE. if you did not install it use YaST)
In side the lower panel a "plug" like icon will appear. Click it for connecting/disconnecting.

Friday, September 17, 2010

Protect GRUB with password

GRUB is very important since it is the first software program that runs when the computer starts
and we have to secure it as much as possible to avoid any possible problem. Below is a default GRUB configuration file and security I recommend you to apply. The text in bold are the parts of the configuration file that must be customized and adjusted to satisfy our needs.
Edit the grub.conf file (vi /boot/grub/grub.conf) and set your needs. Below is what we recommend you:
default=0
timeout=0

splashimage=(hd0,0)/grub/splash.xpm.gzpassword --md5 $1$oKr0ÝmFo$tPYwkkvQbtqo1erwHj5wb/
title Red Hat Linux (2.4.18-3)
root (hd0,0)
kernel /vmlinuz-2.4.18-3 ro root=/dev/sda5
initrd /initrd-2.4.18-3.img


password --md5 $1$bgGCL/$4yF3t0py.IjU0LU.q7YfB1

This option “password” is used to inform GRUB to ask for a password and disallows any
interactive control, until you press the key <p> and enter a correct password. The option --md5
tells GRUB that a password in MD5 format is required as a value. If it is omitted, GRUB assumes
the specified password is in clear text.
When we have installed the operating system, we have already configured GRUB with a
password protection. This password is what you see here. If you want to change it, you have to
use the “grub-md5-crypt” command to generate a new encrypt password it in MD5 format.
• This can be done with the following command:
[root@dev /]# grub-md5-crypt
Password:
$1$bgGCL/$4yF3t0py.IjU0LU.q7YfB184

Once the above command has been issued, you have to cut and paste the encrypted password
to your configuration file.

Monday, September 06, 2010

tar Magic

Tar is commonly used for packaging files on Linux. Tar uses many command-line options like following:

-f    To use a tarfile
-c   To create a new tarfile
-x   To extract files from a tarfile.

You also can compress the resulting tarfile via two methods. 
-j    To use bzip2
-z    To use gzip

You can tar up a directory and all of its subdirectories by using:
tar cf archive.tar dir

Then, extract it in another directory with:
tar xf archive.tar

When creating a tarfile, you can assign a volume name with the option -V . You can move an entire directory structure with tar by executing:
tar cf - dir1 | (cd dir2; tar xf -)

You can move an entire directory structure over the network by executing:
tar cf - dir1 | ssh remote_host "( cd /path/to/dir2; tar xf - )"

If you want to get a dump of your current filesystem to a secondary hard drive, use (as root):
tar -cvzf /dev/hdd /

If you are writing your tarfile to a device that is too small, you can tell tar to do a multivolume archive with the -M option.

You can back up your home directory to a series of floppy disks by executing:
tar -cvMf /dev/fd0 $HOME

If you are doing backups, you may want to preserve the file permissions. You can do this with the -p option. If you have symlinked files on your filesystem, you can dereference the symlinks with the -h option. This tells tar actually to dump the file that the symlink points to, not just the symlink.

Along the same lines, if you have several filesystems mounted, you can tell tar to stick to only one filesystem with the option -l.

Wednesday, September 01, 2010

Recover Your Fedora Core

In case of dual OS, if u install windows (with pre-installed fedora), the boot loader will be lost and fedora become inaccessible. You can recover your Fedora by the following method:
Enter ur first CD of fedora core, reboot it.
Type linux rescue
Then on shell type chroot /mnt/sysimage
grub-install /dev/XXX (choose XXX=sda or hda or hdb as per ur system )
Reboot your Syatem
To know what is XXX type
# /sbin/fdisk -l
u'll see some lines with /dev/XXX , get what is XXX

Tuesday, August 31, 2010

YUM : Proxy authentication cofiguration

You are connected through proxy server which asks for authentication (i.e. username & password). In this case you have to make some configuration to work with YUM. So simply follow these instructions:
open your terminal as root and type:

#gedit .bashrc hit Enter

you can use vim, emac instead of gedit.
Type the following at the end of file:

export http_proxy="http://username:pw@proxyserver:port" 
hit Enter, then save file. close gedit and restart your computer

username & pw is your proxy username & password respectively. proxyserver:port is address of your proxy server with port e.g. export http_proxy="http://mac:jack@10.1.1.18:80"

Increase SWAP memory whenever You need it...

You want to increase your allocated swap memory and you don't want to do it permanently by Re-Partition or Re-Installation. Don't Worry!!! Your solution is here:


Insure that you have sufficient free disk space. Now suppose you need to increase SWAP by, say, 500Mb. Open ur terminal switch to admin. (use su followed by admin password) and use the following commands


# dd if=/dev/zero if=/home/tempswap bs=1k count=500000
# cd /home
# chmod 600 tmpswap
# mkswap tempswap
# swapon tempswap



Approximately 500 mb of swap will be added. For checking use free as:
# free -m
To release swap goto your tmpswap folder(it will be in
/home) #cd /home
#swapoff tmpswap
now delete tempswap
#rm -f tmpswap
recheck your swap now
#free-m

Monday, August 30, 2010

Set up the VNC Server in Fedora Core Part:1


Prerequisites

A user account should exist on the remote machine.
The RPM packages vnc-server and vnc should be installed on the remote machine and your workstation respectively.
Setting up the server

I assume that we have setup a remote user account, named "leopard" and we want to start an X session through VNC for this user.

In Fedora Core or Red Hat based distros in general, all we have to do is define the VNC server instances in /etc/sysconfig/vncservers. These will be started by the vncserver initscript. This has to be done as root. Edit this file so that it contains the following:
VNCSERVERS="3:leopard" 
VNCSERVERARGS[3]="-geometry 1024x768 -depth 16"
With these we define that a vnc server instance should be started as user leopard on display 3 and we also set some options for this server such as resolution and color depth. Each VNC server instancelistens on port 5900 plus the display number on which the server runs. In our case, leopard’s vnc server would listen on port 5903.

For multiple vnc instances /etc/sysconfig/vncservers would look like this:
VNCSERVERS="1:tiger 2:albatros 3:leopard" 
VNCSERVERARGS[1]="-geometry 1024x768 -depth 16" 
VNCSERVERARGS[2]="-geometry 800x600 -depth 8" 
VNCSERVERARGS[3]="-geometry 1024x768 -depth 16"
These would listen on ports 5901, 5902, 5903 respectively.

Set up the VNC Server in Fedora Core Part:2

User Configuration
There is one more thing that needs to be done on the remote machine. User leopard’s vnc password needs to be set. So, as user leopard give the command
:
# vncpasswd
We are prompted for a password. This is the password that we will use when we connect to leopard’s vnc server instance. This password is in /home/leopard/.vnc/passwd.

Start the VNC server
After the initial configuration is done we restart the vnc service. As root:# service vncserver restart
To make VNC server to start on boot:
# chkconfig vncserver on

More User Configuration
After the VNC service is started, some new files are created in /home/leopard/.vnc/ directory. These include leopard’s vnc server log file, pid file and an X startup script. As user leopard we edit the script in order to customize some settings. The default /home/leopard/.vnc/xstartup script contains some commands that are executed when the VNC server is started. These include:
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

xsetroot in this case sets the background color.

vncconfig is a supplementary program that can be used to control the vnc server. Apart from this, when run without arguments it acts as a helper application and its main purpose is to provide support for clipboard transfers between the client (vncviewer) and the vnc server. xterm starts an xterm terminal. twm starts the X server’s default window manager. We probably want to change that to a more user friendly window manager, eg fluxbox.

Set up the VNC Server in Fedora Core Part:3

The VNC server, apart from letting us control a remote machine using a graphical interface, it serves as a way to start graphical applications on boot. For example, I want my favourite p2p program, amule, to start on boot. So, I add this to the /home/leopard/.vnc/xstartup script. This is how my xstartup file looks like:
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" -e ./menu &
amule &
fluxbox & 
menu is a script of mine that is executed when xterm is started.
Remember to put the "
&" symbol after each command, so that it goes to the background and the xstartup script continues on.
Restart the VNC service for the changes to take effect. As root:
# service vncserver restart

Connect to the VNC server

In our example, leopard’s vnc server listens for connections on port 5903. So, open this port in the remote machine’s firewall.
We connect to the remote machine using a vnc viewer. Having installed the vnc package, connect to to the server with the following command:
# vncviewer 192.168.0.1:5903:3
The general usage is :
vncviewer [Server's IP]:[Port]:[Display]
We are prompted for the password and eventually connect to the server. Closing the vncviewer’s window, does not affect the server or the programs we run on it. If we reconnect everything will be there.

Change default boot option in multy-OS systems

Assuming that you have Grub boot loader (common in most of the Linux Distros.)
To change ur default boot option, do as follows:
Open terminal, then type the following codes(don't type $ or #, it will appear by itself)
$ su
enter ur admin password..
# cd /boot/grub 
(you will enter in to grub directory, there is a file named grub.conf. You have to edit it in some editor like Vim or Gedit, im going to use gedit. so type the following).
# gedit grub.conf 
gedit window will show u details something like below.

default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora Core details......
........................
..........................
title Windows details......
........................
..........................
You can see the first line having default as 0 means the first OS (see title) is default. If default is 1, second title. If default is 2 third tiltle would be the default OS to get booted.
So just choose default as 1 in ur windows is in second position.
save the current changes and reboot.

Saturday, August 28, 2010

Share your files on LAN with Samba Server

Hello friends!
Here we are going to see how we share files on LAN with Samba.
1. Goto System > Administration > Server Settings > Samba
2. Enter your root password in a popped 'Query' window( to gain root privilege)
3. Preferences > Server settings > Basic
you have two things now. Work group & Description
fill Workgroup with your workgroup name and brief description about it in Description.
4.now goto Security fill Authentication Mode - 'Share'
Encrypted password - NO.
Gest Account - select a valid account. > OK
5. Now Add Share files.
but firewall will ask for a password now
ok to handel this go to System > Administration > Security Level and Firewall > Firewall Options
male sure that box is clicked active for Samba .
6. Now SElinux > Modify SElinux Policy > Samba
click the box for Allow samba to share users home directories.
> OK
well it was the simplest configuration.

Friday, August 27, 2010

NTFS File Access Inside FEDORA CORE

Well this is a basic topic on allowing NTFS file access inside Fedora Core. NTFS is a file system used on Windows 2000, and Windows XP mainly. If you wish to access the data on these drives whilst inside Linux, firstly you need to install a module that is the ntfs.ko. This allows the kernel to read the NTFS partitions. Then u will need to locate and download the right RPM (FC users) for your system from http://www.linux-ntfs.org/content/view/187/. Look through the list, and search for your kernel version. To know your kernel version type: uname -r
Newer NTFS RPMs have names like
kernel-module-ntfs-2.6.8-1.541-2.1.17-0.fc.1.2.i586.rpm
When downloading the RPM save it to disk, and do not run using the install package manager. Go to where you saved the RPM, and at the command line (in the directory where the RPM is stored) .To install the RPM: rpm -ihv *.rpm
You should see:
Preparing...      ############################### [100%]
1:kernel-ntfs  ############################### [100%]

/sbin/modprobe ntfs

There should be no output. If there is a lot of error messages see the Help Section on http://www.linux-ntfs.org/content/view/124/60/

Do the following for configuration:

1. Login as root by running from a terminal su followed by typing the root password.

2. Create a directory in your /mnt folder. This can be done by running mkdir /mnt/X where X is the name of the directory where the NTFS partition will be mounted.

3. /sbin/fdisk -l This will output your HPFS/NTFS partition identifier. Lets say the device file name is found to be /dev/Y.

4. gedit /etc/fstab . Gedit will open

5. On a new line at the bottom of the file, add the line

/dev/Y /mnt/X ntfs ro,defaults,umask=0222  0 0

where X is the name of the directory you created in step 2.

6. Save and quit the file /etc/fstab

7. Then run mount -a (or some say mount -t ntfs /dev/hdb1 /mnt) and the NTFS partition will be mounted. It will also be mounted automatically after reboot so that you do not have to do anything after you reboot.