Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Before upgrading to 12.04 (from 10.04) I used this little launcher script:

 #!/bin/bash  
 gksudo nautilus /var/www/DFDII & sleep 5; gksudo gedit /var/www/DFDII/iindex.php

This script opened both nautilus and gedit with just one PW entry, now it asks for PW twice ?

Also, annoyingly, now gedit also open "untitled document 1" (close > save changes ? NOOOOO!...

share|improve this question

2 Answers

up vote 0 down vote accepted

Two main options:

  1. Demand that the whole script be run as root. Lots of scripts just exit out and suggest the user prepend the command with gksu.

  2. Run things like this:

    #!/bin/bash
    gksu -- bash -c 'whoami; whoami; whoami # all these return root'
    
share|improve this answer
Thank you Oli - this works: gksu -- bash -c 'nautilus & sleep 5; gedit' But only if I add the "sleep 5" - without it, gedit doesn't start until I close nautilus - why ? – Thomas Sep 3 '12 at 21:14
@Thomas because nautilus is running in the foreground. It's not running as that user so takes over the terminal. The & puts it in the background. nautilus & gedit should work. – Oli Sep 3 '12 at 21:35
Right you are :) Thanks again. Any idea why gedit (also) opens "untitled document 1" (or why it thinks it's been altered when I try to close it) ? – Thomas Sep 3 '12 at 21:58
Sorry - it's a known bug but that's all I can say to help. I tried playing around with its options but nothing seems to work around the tab issue. bugs.launchpad.net/ubuntu/+source/gedit/+bug/890041 – Oli Sep 3 '12 at 22:33

try this. it ask's for root permisions for the entire gnome-terminal.
and runs everything with root priveleges. About gedit opening an unwanted tab... i don't know how to fix that ;(

 #!/bin/bash    
sudo su&&nautilus /var/www/DFDII & sleep 5; gedit /var/www/DFDII/iindex.php
share|improve this answer
I'm not sure that would do what you think it does. Test it with sudo su&&whoami. You become root but whoami wont run until you stop being root, at which point you become a normal user again. – Oli Sep 3 '12 at 14:54
At first i tested it like so "sudo sh test.sh" and it worked i could save the iindex.php. but i made the file executable. and dubbelclicked it. Then no root nautilus end no root gedit??? – blade19899 Sep 3 '12 at 17:00

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.