Q:

gksudo is different from sudo

Background:
I'm running linux mint on a VM env where i have a mounted folder that only root can access and i want my Deluge client to download my torrents to that folder. 
If i go on terminal and execute: sudo deluge
it asks my password and runs as my_user with privileged rights.  Ok untill far. 
Now i want to make a bash script to ask for password on screen, in a prompt manner. 
Problem:
If i write my bash file as:
/usr/bin/gksudo deluge

or
/usr/bin/gksudo -u root deluge

i get the exact same result, i run deluge as root with all my env as root, my home folder is on root folder, so it doesn't import my_user preferences/configs nor my queued torrents. 
If i write my bash file as:
/usr/bin/gksudo -u my_user deluge

it runs as my_user and without elevated privileges, it doesn't have access to write on the shared folder. 
The real question:
How can i write a bash script that allow me to run deluge as my_user (the same env) with elevated rights and prompting for password ? 
PS:
I tried -k arg in many ways without success. 

A:

Sudo seems to preserve $HOME and $PATH to "user" home and path instead of root environmental settings.  This action has lead to problems for "user" and most experts claim that you should not run graphical X apps with sudo but gksudo should be used instead. 
Graphical apps tends to store .config files at $HOME.  If you run a graphical app with sudo, config files on "user" home directory will be created (or if  exist might be overwritten) by root account . 
When you come back from sudo you might found your apps broken since normal users can not access config files made by root.  
The correct way for your case should be to keep using your app as "user" and store your files in a place that "user" has access.  
By the way the gksudo -k seems to preserve the user settings in my tests at Debian:
gv@debian:~/Desktop/PythonTests$ echo $USER-$HOME-$PATH
gv-/home/gv-/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

gv@debian:~/Desktop/PythonTests$ ./oneshot.sh
You run this script as USER=gv
Your HOME dir is /home/gv
Your PATH is /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

gv@debian:~/Desktop/PythonTests$ gksudo ./oneshot.sh
You run this script as USER=root
Your HOME dir is /root
Your PATH is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

gv@debian:~/Desktop/PythonTests$ gksudo -k ./oneshot.sh
You run this script as USER=root
Your HOME dir is /home/gv
Your PATH is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

gv@debian:~/Desktop/PythonTests$ cat oneshot.sh
#! /bin/bash
echo "You run this script as USER=$USER"
echo "Your HOME dir is $HOME"
echo "Your PATH is $PATH"
exit 0

