Question: I have problems with unreliable debugging with my S5 device on one USB port. I had no similar problem with my Nexus. I can work around the problem by switching USB port, but I really want to know what is going on. One day both USB ports starts to behave this way; and then I will have no clue if I don't fix it now.

Here is what I do to produce the problem.

1. I Connect phone to USB

This is what the ADB log says at that point 

> 
> PropertyFetcher: AdbCommandRejectedException getting properties for
>  device c9c2d39f: device offline PropertyFetcher:
>  AdbCommandRejectedException getting properties for device c9c2d39f: 
>  device unauthorized. Please check the confirmation dialog on your  
> 
>  device. DeviceMonitor: ExecutionException getting info for device  
> 
>  c9c2d39f
> 
> 
> 

Please not that the phone actually connects -and that I can see the logcat etc on my device after I connect. I have tried to revoke debugging rights from the developer menu, and re-authorized the computer. 

2. Start my app, that I want to debug
3. Press the "Attach debugger to process" icon (to the right of the regular "debug" icon)

At this point, the "Choose process" dialog appears with no running processes. The phone also disconnects the debugging session, and do not show up when running

> 
> Adb devices
> 
> 
> 

At this point a restart of adb has no effect. The only way to get debugging back is to reconnect the phone to the USB port. 

As I said, this only happens on one of my USB ports, it works on another. Does anyone have an Idea of what is going on here?

Answer: 
In your save path you need to set up a location folder. Use `'files'` as session driver preferred. As like below I have set up a cache to store sessions in BASE PATH which is setting folder. Make sure you have auto loaded sessions and `$config['encryption_key'] = ''` add key.

You can set up a database sessions but this works just as well. Make sure folder permissions 0700

<http://www.codeigniter.com/userguide3/search.html?q=session&check_keywords=yes&area=default>

```
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 1440;
$config['sess_save_path'] = BASEPATH . 'yourfoldername/cache/';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;

```

Once that is done then you should be able to do something like.

```
$this->load->library('session');
$data_session_set = array('logged' => 1, 'username' => $this->input->post('username'), 'user_id' => $this->user_auth->get_id()); 
$this->session->set_userdata($data_session_set);

```
I have used 2 different values and somehow they worked, it depends on the version of Centos:

For Centos 6.X I used:

In application/config/config.php set this value:

$config['sess\_save\_path'] = NULL;

For Centos 7.X I used:

$config['sess\_save\_path'] = sys\_get\_temp\_dir();

it will not work if you move your app from one server version to another without editing this value.