Results 1 to 7 of 7
Hi
Is there a way I can run myProgram when desktop appears no matter if root , administrator, desktop user or an unprivileged user logs in?
I actually developed a ...
- 04-14-2010 #1Just Joined!
- Join Date
- Dec 2009
- Posts
- 12
Startup script unable to mount a partition...
Hi
Is there a way I can run myProgram when desktop appears no matter if root , administrator, desktop user or an unprivileged user logs in?
I actually developed a script which I set to run at startup i.e. when the Desktop appears. Script runs finely but can't mount a partition. In the script I mounted a partition using
Code:
sudo mount /dev/sda1 /mnt &> result.txt
After executing script a file named result.txt was created which contained
Code:
sudo: no tty present and no askpass program specified
In other words the mounting failed. If I run the script myself from the terminal using sudo ./myProgram i don't face this problem and the drive gets mounted successfully.
Any suggestions please....
- 04-14-2010 #2
you probably have a line in your sudoers file that says:
this keeps sudo code from being executed if no tty is present that it was called from. So you can comment it out, and it will work.Code:Defaults requiretty
linux user # 503963
- 04-15-2010 #3Just Joined!
- Join Date
- Dec 2009
- Posts
- 12
Sorry I did not have
but I do haveCode:Defaults requiretty
I commented it out but the problem prevails.Code:Defaults env_reset
In case my question is not clear, let me put it again:
I want a program to run (which copies a partition into another partition) at startup whenever a user gets to Desktop, no matter if he is root, admin, unprivileged or simple Desktop user. The Desktop or unprivileged user must not have permission to copy partitions themselves but my startup program should be able to copy partitions in background when these users log in. Is it possible?
- 04-15-2010 #4Just Joined!
- Join Date
- Dec 2009
- Posts
- 12
Problem with executing a startup script.... [Updated]
Hi
The main question:
Is there a way I can run 'completely' one of my script when ubuntu's desktop appears no matter if root , administrator, desktop user or an unprivileged user logged in?
What does the script do?
The script mounts a partition, looks for a file in that partition and finally on the basis of that file a decision of copying a partition to another partition is made. That copying is done via
Code:dd if=/dev/sda2 of=/dev/sda5
When does the script run finely?
Script runs smoothly when I run it from the terminal by
This command asks me for the password of currently logged in user. I enter the password and the script starts working.Code:sudo ./my_copying_script
When does the script NOT run finely?
I want to run the script at startup. I set it a startup program by using the Startup Applications utility of Ubuntu. Script ran at startup but exited at the dd command returing following error:
I then prefixed the dd with sudo as mentioned belowCode:dd: opening '/dev/sda2': Permission denied
but this returned following error:Code:sudo dd if=/dev/sda2 of=/dev/sda5
Any suggestions please?Code:sudo: no tty present and no askpass program specified
- 04-15-2010 #5
perhaps i'm missing something here but if these are fixed partitions why not just make a fstab entry to mount them? then just have a script that copies to and from the partitions in question whenever they logon.
linux user # 503963
- 04-16-2010 #6
I don't know much about scripting, but it seems to me root owns the script, hence it runs only when sudo is logged. Right click and "properties" , "permissions" the script, and enable "others", including group, to execute the script. (maybe?)
From the follow up posting, it seems sudo and you have privilege to access the disk, but not "others", that may limit the functionality of the script without a log-in.Last edited by previso; 04-16-2010 at 12:53 AM. Reason: Add content
- 04-16-2010 #7forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,096
Hello, usmanajmal
Duplicate threads are not allowed on the forums so I'm merging the two threads that you've created and you can carry on here regarding this topic.oz
→ new members/users: read this first | new member faq
→ no private messages requesting computer support - post them on the forums!
→ please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.


Reply With Quote