Friday, September 27, 2013

Samba Centos root share error - You do not have permission to access in windows


You have a Centos PC and trying to access the root user's Desktop from a Windows PC. You can see the shared folder in the \Network\Centos_PC_IP, but can't access the folder when you double click.

The pop window arise with a error -

You do not have permission to access in windows \\CENTOS_IP\\root. Contact your network administrator to request access.


First you need to check you samba settings in your centos pc by command -
After that you need to do a little change o your /etc/samba/smb.conf file.

Find the folder you shared from root in this file.

It will be like --

        path = /root/Desktop
        read only = No 

Change it to -

        force user = root
        force group = root 
        path = /root/Desktop
        read only = No 

 And restart the samba by --

        /sbin/service smb restart
And you are done!

[Solved by Abdullah Al Mamun @ Eyeball Networks Inc]

Thursday, September 26, 2013

How to share (read/write) any folder with root permissions in centos 6 or linux


Now a days many people like software developers uses 2 or more OS. So the people who have multiple PC's with different OS need to share the files or folder between them. So how?



i.  Samba
ii. LAN connection

Step 1. Install samba by giving command in centos console -
                           yum install samba

Step 2. Configure samba by opening smb.conf 

                           vi /etc/samba/smb.conf

i. Create a workgroup in which you are going to share the files/folders.

by default it is like -

                  workgroup = MYGROUP
change it to -

netbios name = your_host_name 
workgroup = workgroup

because windows system has default group named as WORKGROUP.

ii. Now create a shared resource , where you will indicate the path of the folder you want to share.

        path = /root/Desktop/share
        writeable = yes 
Where [myshare] is the folder name what you want people to see in their PC.
"path" is the path of your shared folder.

Step 3. Make sure your firewall allows SAMBA.

Step 4. Now test the settings of SAMBA by --

# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
Processing section "[myshare]"
Loaded services file OK.
Press enter to see a dump of your service definitions
Step 5. Disable SELinux by-      
setenforce 0

        To permanently set it modify the /etc/selinux/config file and set the value of -

SELINUX = permissive

Step 6. Restart SAMBA by -

/sbin/service smb restart

Now you are done!


Tuesday, September 3, 2013

How to start or open new activity or window from one window on button click

Requirement: You want to make an "app", which displays a login screen, and users can log in. If the login is correct,  open a new window, where users can do other staff. Then how can you do this?


Step 1. Create a layout xml for the new window. In my case I have created one
named newwindow.xml . The entry are as follows --

<?xml version="1.0" encoding="utf-8"?>
<Gallery xmlns:android=""
    android:background="#9999FF" >

Step 2. Create a class with extending Activity .

Step 3. On that new class add --

public void onCreate(Bundle savedInstanceState) {

Here newwindow is the layout xml.

Start Up window is given bellow --

Step 4. Add the new class on AndroidManifest.xml

Note that, if you don't add the class on AndroidManifest.xml app will crash ("the app stopped unexpectedly").

Step 5. Now add the following where you want to initiate this new activity or window ---

Intent intent = new Intent(getApplicationContext(), NewWindow.class);
 That's all!

Now If you add it on button click then the output will be --

You can see that the new windows background colour is "#9999FF" .

The constructor Intent(new View.OnClickListener()) is undefined

The constructor Intent(new View.OnClickListener(){}, Class<NewWindow>) is undefined.

Solution: Find out --

Intent intent = new Intent(this, NewWindow.class);

Change the this to getApplicationContext() or StartClass.this .


How to add button action for multiple button in android

In android it is extreme necessary to use button and do many thing on click or touch of this button.

So how you can do this ?

Ans:   It's pretty simple!

Just find out the -- findViewById(;

It is generated by default in new android sdk. The bold portion is the touch listener for button which is implemented on bellow of your main activity class.
You can do your thing on overriden function OnTouch.

If you want to do it for click and many button here is the way --


View.OnClickListener ButtonListener = new View.OnClickListener(){

        public void onClick(View view) {
            switch (view.getId()) {




are the layouts .