NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Horst Rogalla Posted via mailing list.
|
Posted: Thu Apr 02, 2009 10:53 am Post subject: run program as different user (or root) and/or privilege |
|
|
Hi,
I am currently developing a hardware interface program under Linux
(Ubuntu 8.04). The program is written in C++. I switched recently to
Netbeans for C++ development, because I had very good experience with
Netbeans for Java programming. As expected Netbeans works very well with
C/C++. But then I ran into a bad difficulty: the C++ program needs to
run (at least in the testing phase) as root to get access to the
hardware. How can I do this from within Netbeans? I found no
possibility, apart from starting Netbeans as superuser and that's not
really a welcome solution. Did I miss anything or isn't it really
possible to run a program as a different user and/or different
privileges?
Best regards,
Horst |
|
| Back to top |
|
 |
Andrew Krasny Posted via mailing list.
|
Posted: Thu Apr 02, 2009 12:05 pm Post subject: run program as different user (or root) and/or privilege |
|
|
Horst,
Right, currently there is no direct way to do this...
You are welcome to file an RFE for this...
there could be some rather tricky workaround - to emulate remote
development environment... But for this you need to do things even worse
than starting ide as root - to allow root login using ssh...
So for now the possible solution for you is, as you mentioned, to run
Netbeans as root. (Or, give required privileges to netbeans process so
that every new process started from netbeans will inherit them)
Thanks,
=Andrew
Horst Rogalla wrote:
| Quote: | Hi,
I am currently developing a hardware interface program under Linux
(Ubuntu 8.04). The program is written in C++. I switched recently to
Netbeans for C++ development, because I had very good experience with
Netbeans for Java programming. As expected Netbeans works very well with
C/C++. But then I ran into a bad difficulty: the C++ program needs to
run (at least in the testing phase) as root to get access to the
hardware. How can I do this from within Netbeans? I found no
possibility, apart from starting Netbeans as superuser and that's not
really a welcome solution. Did I miss anything or isn't it really
possible to run a program as a different user and/or different
privileges?
Best regards,
Horst
|
|
|
| Back to top |
|
 |
Leonid Lenyashin Posted via mailing list.
|
Posted: Thu Apr 02, 2009 12:09 pm Post subject: run program as different user (or root) and/or privilege |
|
|
how about using a virtual environment (VirtualBox) and then using remote
development to run it. It sounds a bit tricky, but in reality it is the
most secure way to do things like this.
Andrew Krasny wrote:
| Quote: | Horst,
Right, currently there is no direct way to do this...
You are welcome to file an RFE for this...
there could be some rather tricky workaround - to emulate remote
development environment... But for this you need to do things even
worse than starting ide as root - to allow root login using ssh...
So for now the possible solution for you is, as you mentioned, to run
Netbeans as root. (Or, give required privileges to netbeans process so
that every new process started from netbeans will inherit them)
Thanks,
=Andrew
Horst Rogalla wrote:
| Quote: | Hi,
I am currently developing a hardware interface program under Linux
(Ubuntu 8.04). The program is written in C++. I switched recently to
Netbeans for C++ development, because I had very good experience with
Netbeans for Java programming. As expected Netbeans works very well with
C/C++. But then I ran into a bad difficulty: the C++ program needs to
run (at least in the testing phase) as root to get access to the
hardware. How can I do this from within Netbeans? I found no
possibility, apart from starting Netbeans as superuser and that's not
really a welcome solution. Did I miss anything or isn't it really
possible to run a program as a different user and/or different
privileges?
Best regards,
Horst
|
|
|
|
| Back to top |
|
 |
Ivan Soleimanipour Posted via mailing list.
|
Posted: Thu Apr 02, 2009 7:49 pm Post subject: run program as different user (or root) and/or privilege |
|
|
On 04/02/09 05:03, Andrew Krasny wrote:
| Quote: | Horst,
Right, currently there is no direct way to do this...
You are welcome to file an RFE for this...
there could be some rather tricky workaround - to emulate remote
development environment... But for this you need to do things even worse
than starting ide as root - to allow root login using ssh...
|
Specifically, to create a remote host root@yourmachine and develop
"remotely".
This may not be that evil. ssh is so configurable ... one should be
able to forbid root access from off host perhaps? |
|
| Back to top |
|
 |
dms489
Joined: 18 Aug 2011 Posts: 19 Location: Atlanta, GA
|
Posted: Fri Dec 30, 2011 5:47 pm Post subject: Executing NetBeans project as root |
|
|
I faced the same problem and cobbled together the following solution:
1. I compiled and the project in Release mode as usual.
2. With the Terminal tool, I navigated to the location of the executable code which was something like '/home/<me>/NetBeansProjects/<prj>/dist/Release/GNU-Linux-x86/
3. I captured the path with >> pwd > ~/run.sh
4. in my home directory, I edited run.sh to append the executable name <my_exec>'
5. I changed the properties to make this executable with >> chmod +x run.sh
6. I can now run this normally from the terminal at my home directory with >> ./run.sh
7. ... or as root with >> sudo ./run.sh
Hope this helps[/quote] |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|