Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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 ; second_script.sh" 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 Warchol Feb 13 '13 at 0:29

Your Answer

 
discard

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.