Transcranial direct current stimulation (tDCS) is a non-invasive cortical stimulation technique that can facilitate task specific plasticity that can improve motor performance. Current tDCS interventions uniformly apply a chosen electrode montage to a subject population without personalizing electrode placement for optimal motor gains. We propose a novel perturbation tDCS (ptDCS) paradigm for determining a personalized electrode montage in which tDCS intervention yields maximal motor performance improvements during stimulation. PtDCS was applied to ten healthy adults and five stroke patients with upper hemiparesis as they performed an isometric wrist flexion task with their non-dominant arm. Simultaneous recordings of torque applied to a stationary handle, muscle activity by electromyography (EMG), and cortical activity by functional near-infrared spectroscopy (fNIRS) during ptDCS helped interpret how cortical activity perturbations by any given electrode montage related to changes in muscle activity and task performance quantified by a Reaction Time (RT) X Error product. PtDCS enabled quantifying the effect on task performance of 20 different electrode pair montages placed over the sensorimotor cortex. Interestingly, the electrode montage maximizing performance in all healthy adults did not match any of the ones being explored in current literature as a means of improving the motor performance of stroke patients. Furthermore, the optimal montage was found to be different in each stroke patient and the resulting motor gains were very significant during stimulation. This study supports the notion that task-specific ptDCS optimization can lend itself to personalizing the rehabilitation of patients with brain injury.