Skip to main content
deleted 147 characters in body
Source Link
Uthman
  • 977
  • 3
  • 16
  • 24

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

dd if=/dev/sda2 of=/dev/sda5

When does the script run finely?

Script runs smoothly when I run it from the terminal by

sudo ./my_copying_script

This command asks me for the password of currently logged in user. I enter the password and the script starts working.

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:

dd: opening '/dev/sda2': Permission denied 

On edk's suggestion I set the owner of my_copying_script as root and set the SUID. Now the permissions of my_copying_script are (-rwsr-sr-x). edk's point of view was that once I set the suid, the startup program will run with the permissions of its owner. I did that but the same /dev/sda2 permission denied error came up.

I then prefixed the dd with sudo as mentioned below

 sudo dd if=/dev/sda2 of=/dev/sda5

but this returned following error:

sudo: no tty present and no askpass program specified

In other words the mounting failed. If I run the script using sudo ./myProgram i don't face this problem and the drive gets mounted successfully.

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

dd if=/dev/sda2 of=/dev/sda5

When does the script run finely?

Script runs smoothly when I run it from the terminal by

sudo ./my_copying_script

This command asks me for the password of currently logged in user. I enter the password and the script starts working.

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:

dd: opening '/dev/sda2': Permission denied 

On edk's suggestion I set the owner of my_copying_script as root and set the SUID. Now the permissions of my_copying_script are (-rwsr-sr-x). edk's point of view was that once I set the suid, the startup program will run with the permissions of its owner. I did that but the same /dev/sda2 permission denied error came up.

I then prefixed the dd with sudo as mentioned below

 sudo dd if=/dev/sda2 of=/dev/sda5

but this returned following error:

sudo: no tty present and no askpass program specified

In other words the mounting failed. If I run the script using sudo ./myProgram i don't face this problem and the drive gets mounted successfully.

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

dd if=/dev/sda2 of=/dev/sda5

When does the script run finely?

Script runs smoothly when I run it from the terminal by

sudo ./my_copying_script

This command asks me for the password of currently logged in user. I enter the password and the script starts working.

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:

dd: opening '/dev/sda2': Permission denied 

On edk's suggestion I set the owner of my_copying_script as root and set the SUID. Now the permissions of my_copying_script are (-rwsr-sr-x). edk's point of view was that once I set the suid, the startup program will run with the permissions of its owner. I did that but the same /dev/sda2 permission denied error came up.

I then prefixed the dd with sudo as mentioned below

 sudo dd if=/dev/sda2 of=/dev/sda5

but this returned following error:

sudo: no tty present and no askpass program specified
edited tags
Link
quack quixote
  • 42.9k
  • 14
  • 108
  • 130
added 18 characters in body
Source Link
Uthman
  • 977
  • 3
  • 16
  • 24

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

dd if=/dev/sda2 of=/dev/sda5

When does the script run finely?

Script runs smoothly when I run it from the terminal by

sudo ./my_copying_script

This command asks me for the password of currently logged in user. I enter the password and the script starts working.

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:

dd: opening '/dev/sda2': Permission denied 

On edk's suggestion I set the owner of my_copying_script as root and set the SUID. Now the permissions of my_copying_script are (-rwsr-sr-x). edk's point of view was that once I set the suid, the startup program will run with the permissions of its owner. I did that but the same /dev/sda2 permission denied error came up.

I then prefixed the dd with sudo as mentioned below

 sudo dd if=/dev/sda2 of=/dev/sda5

but this returned following error:

sudo: no tty present and no askpass program specified

In other words the mounting failed. If I run the script using sudo ./myProgram i don't face this problem and the drive gets mounted successfully.

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 and finally on the basis of that file a decision of copying a partition to another partition is made. That copying is done via

dd if=/dev/sda2 of=/dev/sda5

When does the script run finely?

Script runs smoothly when I run it from the terminal by

sudo ./my_copying_script

This command asks me for the password of currently logged in user. I enter the password and the script starts working.

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:

dd: opening '/dev/sda2': Permission denied 

On edk's suggestion I set the owner of my_copying_script as root and set the SUID. Now the permissions of my_copying_script are (-rwsr-sr-x). edk's point of view was that once I set the suid, the startup program will run with the permissions of its owner. I did that but the same /dev/sda2 permission denied error came up.

I then prefixed the dd with sudo as mentioned below

 sudo dd if=/dev/sda2 of=/dev/sda5

but this returned following error:

sudo: no tty present and no askpass program specified

In other words the mounting failed. If I run the script using sudo ./myProgram i don't face this problem and the drive gets mounted successfully.

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

dd if=/dev/sda2 of=/dev/sda5

When does the script run finely?

Script runs smoothly when I run it from the terminal by

sudo ./my_copying_script

This command asks me for the password of currently logged in user. I enter the password and the script starts working.

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:

dd: opening '/dev/sda2': Permission denied 

On edk's suggestion I set the owner of my_copying_script as root and set the SUID. Now the permissions of my_copying_script are (-rwsr-sr-x). edk's point of view was that once I set the suid, the startup program will run with the permissions of its owner. I did that but the same /dev/sda2 permission denied error came up.

I then prefixed the dd with sudo as mentioned below

 sudo dd if=/dev/sda2 of=/dev/sda5

but this returned following error:

sudo: no tty present and no askpass program specified

In other words the mounting failed. If I run the script using sudo ./myProgram i don't face this problem and the drive gets mounted successfully.

no need to state the "updated question", updates are visible at the bottom, and the only fact you edited it poked it to the front page.
Link
Gnoupi
  • 8.1k
  • 9
  • 45
  • 59
Loading
Modified the question
Source Link
Uthman
  • 977
  • 3
  • 16
  • 24
Loading
deleted 4 characters in body
Source Link
Uthman
  • 977
  • 3
  • 16
  • 24
Loading
edited body
Source Link
Uthman
  • 977
  • 3
  • 16
  • 24
Loading
added 224 characters in body
Source Link
Uthman
  • 977
  • 3
  • 16
  • 24
Loading
Source Link
Uthman
  • 977
  • 3
  • 16
  • 24
Loading