netbeans 6.91 and gdb - attaching to a process run by another user - netbeans

I am trying to debug a program run as another user, using Netbeans. I can do this manually at the command line, by running sudo gdm and then attaching to the pid.
However, I would like to make use of the Netbeans GUI for easier/quicker/visual debugging. When I select the pid from the list of running processes, I get the error:
GDB failed to attach to process
When I attempt to attach manually (i.e. by running gdb at the command line - without sudo), I get an 'Operation not permitted', so I know Netneans is failing to attach because of permissioning.
Does anyone know how I can attach to processes being run by another user?.
BTW I am running all this on my dev machine at home (Ubuntu), so security is not an issue.

Have you tried running netbeans as the target user?
You can do "sudo -u username netbeans"
With that, you shouldnt have a problem attaching to the process. If the target user is in another computer, I would suggest ssh with X forwarding (ssh -X user#machine).
Actually, if the target (local) user has no password set, you can try changing your gdb command to "sudo -u username gdb" to start the debugger as that user.

Related

How can I launch postgres server headless (without terminal) on Windows?

Using Postgres 9.5 and the libpqxx c++ bindings, I want to launch a copy of postgres that is not installed on the users machine, but is instead packaged up in my application directory.
Currently, I am using pg_ctl.exe to start and stop the server, however when we do this, pg_ctl.exe seems to launch postgres.exe in a new terminal window.
I want it to launch postgres.exe in a headless state, but can't work out how.
I have tried enabling/disabling the logging collector, setting the logging method to a csv file (instead of stdout/stderr), and a couple of other logging related things, but I don't think the issue is the logging.
I have also tried running postgres.exe manually (without pg_ctl) and can get that to run headless by spawning it as a background process and redirecting the logs, but I would prefer to use the "pg_ctl start" api for the "wait for startup" (-w), and "timeout" (-t) options that it provides.
I believe you won't be able to do that with pg_ctl.
It is perfectly fine to start PostgreSQL directly through the server executable postgres.exe. Alternatively, you can use pg_ctl register to create a service and start the service.
In my use case, I was able to resolve the issue by running pg_ctl.exe using
CreateProcess, and providing the dwCreationFlags CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW.
I was originally using CREATE_NEW_PROCESS_GROUP | DETACHED_PROCESS, but DETACHED_PROCESS still allowed a postgres terminal to appear. This is because DETACHED_PROCESS will spawn the pg_ctl without a console, but any process that inherits stdin/stdout from pg_ctl will try to use it's console, and since there isn't one, one will be spawned. CREATE_NO_WINDOW however will launch the process with a conhost.exe, however the console will have no window. When the executables spawned by pg_ctl try to write to the terminal, they will successfully write to the console created by the conhost.exe which has no window.
I am now able to run pg_ctl from code with no console appearing.

LoopBack Command Prompt is Disable After Running the Applications

I am mew to loopback . I am running the API in localhost . I created the model and I am able to access it to localhost . But the problem is I can not type anythings in command prompt windows after running the applications ..
Here is the screen shot of the command prompt .
When you start your server you can't type anything on that console.
If you want to use console you have to either stop your server or you have to use another console.
If you want to restart your server then you have to halt it using Ctrl + c command and after that npm start command.
If you want to use the same console for more commands, then open a new console and run your node server over there.
And if you want to clear your warning of "includeSubdomains" then follow these steps :
1)Go to server/middleware.json
2)search for "includeSubdomains" key and replace with "includeSubDomains".

No X11 Display variable was set, installing netbeans from command line using MobaXTerm

I am trying to install netbeans from the command line using mobaxterm on suse enterprise. I have set X11 Forwarding when creating the session. However, I still get the following error when I try to run the downloaded netbeans script:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
Exception: java.awt.HeadlessException thrown from the UncaughtExceptionHandler in thread "main"
I tried this solution, but it didn't cut it.
UPDATE
I was able to resolve this by manually changing sshd_config:
Under
/etc/ssh/sshd_config
Make sure you have the following set:
X11Forwarding yes
X11UseLocalhost no
PermitRootLogin yes
How do you connect?
Try echo $DISPLAY after ssh -X susehost. Depending from where you connect to susehost, X11 forwarding may not work.

Unable to run OTRS daemon, OTRS6 on Cent OS 7

I am facing issue while trying to start ORTS daemon on CentOS linux
FACILITY:
OTRS-otrs.Daemon.pl - Daemon
Kernel::System::Daemon::DaemonModules::SystemConfigurationSyncManager-07
MESSAGE:
Access denied for user 'otrs'#'localhost' (using password: YES)
When I am trying get the status using command:
./opt/otrs/bin/otrs.Daemon.pl status
getting this message:
Manage the OTRS daemon process.
Daemon running
But when I go to the web page it says that OTRS Daemon is not running.
Any help is appreciated!?
The error comes from the mysql daemon and has nothing to do with Perl. Try this on the command-line on the server running otrs:
mysql --user=otrs --host=localhost --password=XXXXXXX
That will probably fail with the same error. Once you have fixed your mysql configuration so that the command succeeds, otrs should also start.
Omit the option --password and let mysql prompt you for the password, if you are not alone on the machine.
Another reason for the failure could, of course, be that you have misconfigured otrs, and you have to change the mysql user, host, or password.
After searching for solution for two days i finally get it working.
I first change to /opt/otrs/bin/ directory.
To get the daemon working, you have to start the daemon as otrs user.
To do that just change user to otrs : you can use this command. (su otrs) from your terminal, you will be prompted for the password for otrs. Just enter the password and use the (whoami) command to check if you are otrs. If it shows that the current user is otrs issue this command (./otrs.Daemon.pl status) to see the current status of the daemon. if it shows that the daemon not running then issue this command (./otrs.Daemon.pl start).

CruiseControl.net connecting to BitBucket using SSH and running as a service

here's my situation.
I'm running Cruise Control as a Windows Service and trying to get it to connect to a Mercurial Repository on BitBucket over SSH.
I'm pretty sure that everything's configured OK (PuttyGen, Pagaent, etc). I'm remoting onto the server using the same account that I am using to run the service and if I issue hg pull -b ssh://#bitbucket.org// from a command line everything works. I added -v to the ssh configuration in mercurial.ini and I can see all of the steps that are taken.
If I run CC.NET from a command prompt then it builds fine. In the console window I can see the same logging from the SSH operation.
However, if I run CC.NET as a service (using the same user account that I'm logged in on) the call to BitBucket times out. I can find no way to work out why either. The build log doesn't help and neither do ccnet.log or ccnet.trace in the temp directory. I was expecting one of them to contain the logging from the SSH operation, but they don't.
Can anyone help? Is it that running as a service prevents it from connecting to Pagaent (I've started Pagaent by adding it to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run). When I did the pull from the command line I had to OK a dialog, but only once. Is it waiting on the same dialog now that it's running as a service?
Getting close to my wits end here.
Thanks
I did get it working in the end. The trick was to create the public key without a passphrase. When running as a service the solution has to be completely non-interactive and the passphrase option with pagaent.exe just isn't.
Here are the steps:
Use PutTTygen to generate a secure key WITHOUT a passphrase. If you really do need one then you can add it to the mercurial.ini file, but defeats the point for me as it's in plain sight anyway.
Copy a mercurial.ini to two locations: C:\Windows\System32\config\systemprofile and C:\Windows\SysWOW64\config\systemprofile. Probably only one of these was really necessary, but I didn't have the time to experiment. The first is the home directory for the system user when running 64 bit apps, the SysWOW64 location for 32 bit. Make sure that if you do the same as me then keep both files in sync - or go one further and work out which is the correct location.
Add something like this line under the [ui] key in both files:
ssh = "D:\Program Files\TortoiseHg\TortoisePlink.exe" -ssh -2 -C -batch -v -i "[Path to your ppk file]"
Add the passphrase to the end of the command if one was created in step 1.
Make sure that TortoisePlink.exe is specified, not Plink.exe. They should both be in the same directory.
Download psexec from http://technet.microsoft.com/en-gb/sysinternals/bb842062.aspx
Run d:\PSTools\PsExec.exe -s -i cmd.exe. This will open a command line as the system account in interactive mode.
Now do an hg pull, or hg clone or whatever.
A dialog should pop up with a confirmation message. This is a one time thing and the reason that you have to do the PsExec step. OK the dialog.
Now cc.net should be able to be run as a service under the local system account using SSH!