Archive for category Linux

etc/sudoers permission problem in ubuntu? $HOME/.dmrc ignored?

I use ubuntu at home, few days ago found a weird problem with permission, i was getting popup during login and was frustrated with this. I was going to reinstall my favourite OS(fedora). But later decided against it and found few ways to recover Ubuntu :)

Permission problem /etc/sudoers ?

start your computer in recovery mode.
(at boot press Esc for the grub menu and select: Ubuntu, kernel …….-c (recovery mode))

sudo chmod 0440 /etc/sudoers
sudo reboot

su must be setuid root to operate
you must issue the following command as root:
chmod 4755 /bin/su

######################################

Re: $HOME/.dmrc file is being ignored

Change permission of user directory and .dmrc file as well as chown those.

sudo chmod 644 /home/shabuz/.dmrc
sudo chown shabuz /home/shabuz/.dmrc
sudo chmod -R 700 /home/shabuz
sudo chown -R shabuz /home/shabuz

you can set 755, 766 and 777 as well.

######################################

Problem with GUI ? Stuck at the login screen??

If you don’t have access to your graphical (GUI) desktop to delete these folders in Nautilus or you’re stuck at the login screen, drop to a terminal by hitting CTRL + ALT + F1, login to your account, and run this command:

rm -rf .gnome .gnome2 .gconf .gconfd .metacity

UPDATE (2008.01.30): Keep in mind that this will only reset your Gnome-specific settings. If you are having problems with your video card, display, x-server, etc., this WILL NOT fix your problems.

Hope this will help :)

References:
http://ubuntuforums.org/
http://linuxfud.wordpress.com/2007/02/14/how-to-reset-ubuntugnome-settings-to-defaults-without-re-installing/

, , , ,

1 Comment

Configure Citycell Zoom ZTE CDMA USB Modem in Ubuntu & Fedora

Few months ago, I configured citycell zoom in my friend’s pc. That was Huawei modem and was much easy to configure. First tried to detect modem using wvdialconf in the terminal. Then just edited wvdial.conf file (/etc/wvdial.conf) with the detected path and after dialing wvdial cdma in the terminal it was successfully connected.

But recently in the eid vacation when i was in chittagong, i’ve bought citycell zoom with ZTE usb modem for using internet there. It was very much easy to setup and connect to internet in windows XP but failed to do so in ubuntu. First i tried to detect modem using wvdialconf. But It was showing a msg like failed to detect modem. then tried to grep tty using dmesg | grep tty but failed again, then tried to view modem using cat /proc/bus/usb/devices. But i haven’t found anything like devices in cat /proc/bus/usb/devices directory.

Anyway, Here is what you have to do to detect ZTE usb modem.

In ubuntu, you have to uncomment few lines to explore devices directory. So edit mountdevsubfs.sh file. ( ** No need to do this in fedora core, it will automatically detect devices in /proc/bus/usb/ directory)

sudo gedit /etc/init.d/mountdevsubfs.sh

and uncomment following lines from this file.

# Magic to make /proc/bus/usb work
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

Now start the service

/etc/init.d/mountdevsubfs.sh start and reboot your pc.

Then check if the USB device is detected properly
cat /proc/bus/usb/devices

Try to find some output like this

T:  Bus=07 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs=  1
P:  Vendor=19d2 ProdID=fffd Rev= 0.00
S:  Manufacturer=ZTE, Incorporated
S:  Product=ZTE CDMA Tech
C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=128ms
E:  Ad=8a(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=0b(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

Now probe for this USB device
modprobe usbserial vendor=0×19d2 product=0×fffd

You are done!!

Now run wvdialconf in the terminal Or you can edit /etc/wvdial.conf file and paste these following lines.

[Modem0]
Modem = /dev/ttyUSB0
Baud = 230400
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
FlowControl = Hardware (CRTSCTS)
[Dialer cdma]
Username = waps
Password = waps
Phone = #777
Stupid Mode = 1
Inherits = Modem0

Now you can connect to internet by applying the following command in terminal.

wvdial cdma

Using the same procedure, i’ve configured this modem in my office (fedora) also.

Thats it! Enjoy. :)

Note: For Ubuntu intrepid 8.10 and Ubuntu 9.04 jaunty jackalope, Please see my comments, i hope that will help you to connect to Internet

, , ,

25 Comments

Problem with mysql connect to remote database?

Yesterday i found a peculiar problem. We have just transferred our application from our local server to another server. But after that this application wasn’t working properly :o .

Anyway, we have tried to locate the problem and found that it wasn’t connecting to the replica database (another mysql database) properly. But most interesting thing was i was successful to connect from command prompt using ssh using same connection parameter.

Then i wrote an script to test the connection and found that i can’t connect to remote database using mysql_connect X(

Anyway, after surfing a lot i’ve found a solution to solve the problem.

Open your my.cnf which is placed in /etc/ directory and find the following line.

bind-address=127.0.0.1

It allow only localhost to connect. So delete or comment out this line. It will solve the problem
But my porblem wasn’t that. infact that line wasn’t exist in my my.cnf file. Problem was with the extra security that apache provide now a days. apache doesn’t allow connetion to other network by default. So follow the instruction to activate network connection.

At first, verify that SELinux is enabled or not.

in order to varify type in your command prompt getenforce
You should see something like Enforcing
If you see a different result, type setenforce 1 in the command prompt

If you get an error, then you do not have Selinux turned on. Go to /etc/selinux/config and edit the config file to enable Selinux.

Now reboot the linux server
Once SELinux is enabled, do the following

Set SELinux to allow remote connections for HTTP

setsebool -P httpd_can_network_connect=1

Tha’ll do the trick.

, , ,

2 Comments

Install and run a simple application in ruby on rails (feodra & ubuntu)

Here is the Instruction that you have to follow to install ruby on rails. Instead of yum, use apt-get if you are using ubuntu.

Step 1: install ruby yum install ruby

Step 2: Install rubygems yum install rubygems

note: It will ask for installing dependencies, Press Y each time

Step 3: Now install rails gem install rails

You are done. :)
Now try to run a simple application using ruby on rails.

Create a folder in any directory (suppose its “myproject”) and our project name is simpleapp so from command prompt go to that folder (myproject).

now type

rails simpleapp -d mysql

i.e: -d mysql is for using mysql database. if u r using sqlite3 then just omit these text.

Anyway, after running this rails it will automatically create all the necessary files with a configuration file for mysql. Go to myproject/simpleapp/config/ directory. You will find database.yml file. Open the file you’ll the configuration for 3 database for 3 different mood. By default it always use development mood. So edit the configuration of development mood.

You will see that, it has configured the database name as simpleapp_development.

Edit this name or create new database in the mysql with this name or the edited db name.

Now we will try to build an AMD(add-modify-delete) tool using ruby on rails. For this initially we will use scaffold feature of ruby on rails.

In the command prompt go to your application directory and type

script/generate scaffold post title:string body:text

Once scaffolding is successful then migrate database. To migrate database type

rake db:migrate

Now just run the server and view your application. In order to run the server type

script/server

After running the server you will see that its listening to the port localhost:3000 or 127.0.0.1:3000 . That means you can view your application in that port of your web browser.

Open firefox and type localhost:3000/posts (posts is the controller name) to see your application.

yup. that’s all done. Isn’t it too simple ? :)

1 Comment

How to setup awstats in centOS

Installing awstats is little complex in centOS whereas i’ve installed awstats easily in my FC9 following this instruction

But failed to do the same in centOS. So here is the whole process to follow and setup awstats in centOS .

Step 1: Download the awstats rpm (awstats-6.6-1.el5.rf.noarch.rpm) from here and place it in your server

Step 2: Login to the server with SSH and run awstats from command prompt. To run awstats, go to that directory where you have placed the awstats rpm and type

rpm -ivh awstats-6.6-1.el5.rf.noarch.rpm

Step 3: Now go to the /etc/awstats/ directory and copy the file named awstats.localhost.localdomain.conf and paste it in the same directory with different name. The file name should be awstats.your_domain_name.conf. (let’s consider mine one is awstats.abc.conf). In order to do this, go to that specific directory and type

cp awstats.localhost.localdomain.conf /etc/awstats/awstats.Your_domain_name.conf

Step 4: Now Open that file and find the word “SiteDomain=”Localhost.Localdomain” in that file and replace the domain name with your domain name. suppose it was abc

SiteDomain = "abc"

Save that file when you are done and go back to command prompt.

Step 5: Now go to /var/www/awstats/ directory and create 2 file named

awstats062008.abc.txt (I.e: modify with current date) &

awstats062008.abc.bak (I.e: modify with current date)

Step 6: After that, run the following command which will create a html file.

perl awstats.pl -config=Your_domain_name -output -staticlinks > awstats.Your_domain_name.html

and finally run the following command in the command prompt.

perl awstats.pl -config=your_domain_name -update

Step 7: Now open a browser and in the URL and type

http://your_server_ip/awstats/awstats.pl?config=your_domain_name

Step 8: If page is not populating with proper records which indicates that your access_log is not populating properly. So open vhosts.conf file which is located in the /etc/httpd/conf.d/ direcotry and comment out 2 lines about access_log and error_log of that specific domain. Save and close that file and follow step6 again. Hope, everything will work properly now.

That’s all.

,

1 Comment

How to setup vmware server 1.0.5 in fedora 9

Setting up vmware server is bit different in fedora. Here there is no need for vmware any any update. What you have to do is

step1: Download vmware server 1.0.5 from here and install vmware-server. you can see my earlier post for step by step installation instructions here
During installation, if it’s failed to find the proper location of c header file, that means you dont have kernel-devel installed in your OS. If so then follow step 2 otherwise skip step 2.

Step2: Download devel-kernel (must have to match with your running kernel). Right now i’m using fedora 9.
To view the kernel that is running type uname -r in the terminal. Mine one is 2.6.25-14.fc9.i686
you can download your desired kernel-devel from this link. click here to download kernel-devel

Step3: Download 2 patches (vmnet &vmmon) for the kernel 2.6.25 (or whatever your kernel is)
I’ve downloaded those patch from jon.limedaley.com. Click on those link to dl those patch.
vmnet here and vmmon here

Step4: Now apply those patches. What you have to do is…

Copy vmnet.tar and vmmon.tar from /usr/lib/vmware/modules/source directory to other directory.

Untar both these files by running tar xvf vmnet.tar and tar xvf vmmon.tar.

You will see two new directories named vmnet-only and vmmon-only in this directory

Now, copy both of the downloaded patch files into this directory as well.

Now go to your terminal and do..

cd vmnet-only

patch -p1 < ../vmnet-2.6.25.patch

cd ../vmmon-only

patch -p1 < ../vmmon-2.6.25.patch

Set read write execute permission to source, vmmon-only and vmnet-only folder.

Now in your terminal go to source directory and create the tar files again

tar cvf vmnet.tar vmnet-only/

tar cvf vmmon.tar vmmon-only/

Finally run vmware-config.pl file again.

Thats it.

, , ,

3 Comments

How to use windows application in linux.

There is several way to use windows application in linux. As i used to play games a lot in windows so after installing linux i was worried about all those stuff :(
Then after surfing internet, I’ve found several way to use windows application.

I was very much excited about the way of setting up virtual machine in linux and one can switch to any operating system using vmware server without rebooting. I’ve already installed it now I can boot windows from my linux (fedora and ubuntu) using vmware server and play my favorite games there. But one important thing is :) vmware works good for high configured pc. ( i mean at least 1 gb ram, around 8 gb space for vm, above 1.7 ghz processor bla bla )

OR
You can install wine in linux which creates windows environment to run windows application. But it doesn’t support all the application.

OR

Search www.osalt.com to find open source alternative solutions of your windows application.  You  may find several alternative software for linux operating system.

,

No Comments

How to configure for GPRS/EDGE modem in grameen phone and broadband connection (pppoe) in linux.

At first, Take a look at the wvdial.conf file. There you will see only 4 lines for username, password… Dont bother with it now.. that’s not the full specification. What you have to do is , type

wvdialconf in the terminal. It will locate your modem and do some necessary configuration in that file.

In the terminal window you may see permission problem with /etc/ppp folder or may be with some other folder. So give that folder permission to write OR use super user command to run wvdialconf in the terminal again.

And now look at the wvdial.conf folder again. You will notice few changes with some modem configuration. Now just add the following line if you are using grameen phone service.

Init3 = AT+CGDCONT=1,”IP”,”gpinternet”

and modify phone number

Phone = *99***1#

username and password can be anything. So don’t bother with it.

Now type wvdial in the terminal to connect now

OR

you may connect and configure your modem by launching KPPP or GNOME-PPP (kppp for kde and gnome-ppp for gnome environment) in your terminal window too

PPPOE Broadband connection

Last month i was bit worried about my broadband connection cause i wasn’t able to connect to internet as it was in linux. I was more confused because my Internet service provider has given me an username and password to dial though it was a broadband connection:o. (later i knew that mine one is pppoe connection that’s why username nad password is required for proper configuration. lol) Before that i was using gpinternet.

Anyway, then i called my isp. But what has surprised me is, even they dont know how to configure it in a linux machine and they told me that they will call me after 2 days after consulting with their engineers .But i dont have that much time you know ;) I started to surfing around in different forums. and found a way to configure it.

Just type pppoeconf in the terminal window. A window will appear and will prompt for your username and password (what your isp may have given you) and for all the other prompt action, just enter default options(yes) . now restart networking service.

./etc/init.d/networking restart

Ping any site. I guess, you are connected ;)
Both the way for connecting internet is pretty simple. Isn’t it?

Enjoy

, , , ,

2 Comments

USB support for vmware server 1.0.5

After installing vmware server 1.0.5 in my ubuntu hardy heron i was excited to test it. then i’ve created a VM of windows xp (I love to play games a lot) :-s

But problem occured when i was trying to connect my usb device. I found it in ubuntu but not in xp. Now, to recognise usb device in your virtual mechine what you have to do is

Step 1: Edit mountdevsubfs.sh file which is located in ‘ /etc/init.d/ ‘ directory.

sudo gedit /etc/init.d/mountdevsubfs.sh

and uncomment these four lines

#
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

Also add the following line

usbfs /proc/bus/usb usbfs auto 0 0

to /etc/fstab file.

sudo gedit /etc/fstab

[This is not preffered way. The preferred method is not to use /proc/bus/usb and should be used when supported by the VM software.]

After that, do

sudo /etc/init.d/mountdevsubfs.sh start

and

sudo mount -a

Now reboot your system, start vmware server then play the vm and select the usb from VM->Removable Devices->Usb->your device

Hope you will get your usb device working in vm.

Enjoy!!

, ,

2 Comments

How to share linux folder with others.

Step 1: First what you should do is install samba (if not yet installed).

sudo apt-get install samba

Then edit the ” smb.conf ” file which is located in /etc/samba/ directory.

Here i’m going to share a folder named “share” which is located in ‘/home/shabuz/’ directory. So path should be, directory of the folder that you are sharing. you can write anything in place of ‘myShare’ . This will be the shared folder name.

sudo gedit /etc/samba/smb.conf

[myShare]
comment = Public Stuff
path = /home/shabuz/share
public = yes
writable = yes
printable = no

That’s it. Now in the address bar type smb://YOUR_IP/ and you will find a folder named myShare.

You can set password to access your folder too. What you have to do is,

sudo smbpasswd -a username

it will ask you for setting a password

Yup. Now your folder will be visible to others.

, ,

No Comments