Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a script that checks for usb devices. If the device is valid, (it's in my database, a text file) my script mounts it, and if the device is not in my database, i get a messgae "invalid device detected", and the device doesn't mount. When an invalid device is detected, i want to open a terminal, showing "invalid device "usb_name" detected. Please intoduce your root password to mount it." . And if the password is correct, and want the _invalid_usb_name to be written in my database , and so, it will be a valid device now. How exactly do i open that terminal in my script asking for my root password ? It's a bash script.

share|improve this question
up vote 2 down vote accepted

gnome-terminal -e "sudo bash" will open a new terminal window asking for root password.

share|improve this answer
Thank you. I used xterm - e "su root". But how can i make it to run a new script in it? i tryed xterm -e "su root ;" but it doesn's work. – hermydana Feb 12 '13 at 7:22
I'm sorry, but i don't know :( I've searched for a while, but all my attempts to execute more commands failed. All i know is that you need to pass these commands to the shell that's running there, not to the terminal application itself. – Janek Warchoł Feb 13 '13 at 0:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.