On CentOS, how do you make the exception for x-debug permanent - netbeans

I'm not sure if this is more of a sysadmin question but in order to use x-debug, I have to run the following from my terminal everytime I boot up the machine.
setsebool httpd_can_network_connect=1
Does anyone know how I can make this permanent so that I don't have to run this command everytime I start my machine?
Thank you.
----EDIT----
setsebool -P httpd_can_network_connect=1
Now I can debug as soon as the machine boots thanks to Ulrich Schmidt-Goertz

Try running the command with the -P flag. That should make the setting permanent.

Related

VS Code Remote SSH Connection not working

Im trying to setup vscode with the remote developement extensions on a second pc. While it works on my main one it doesnt on the second one. Tried reinstalling vscode, extensions and using older versions but nothing works.
When trying to connect it cancels after chosing the os. So I cant even type in the password.
I set it up in the exact same way as with the other pc.
Any ideas?
[20:32:53.595] remote-ssh#0.55.0
[20:32:53.595] win32 x64
[20:32:53.596] SSH Resolver called for "ssh-remote+ssh.blabla", attempt 1
[20:32:53.597] SSH Resolver called for host: ssh.blabla
[20:32:53.597] Setting up SSH remote "ssh.blabla"
[20:32:53.610] Using commit id "58bb7b2331731bf72587010e943852e13e6fd3cf" and quality "stable" for server
[20:32:53.612] Install and start server if needed
[20:32:54.639] Checking ssh with "ssh -V"
[20:32:54.686] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[20:32:54.691] Running script with connection command: ssh -T -D 52819 ssh.blabla bash
[20:32:54.694] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[20:32:54.758] >
]0;C:\WINDOWS\System32\cmd.exe
[20:32:54.758] Got some output, clearing connection timeout
[20:32:54.785] >
[20:32:55.045] > root#blabla's password:
[20:32:55.045] Showing password prompt
[20:32:57.596] "install" terminal command done
[20:32:57.597] Install terminal quit with output: root#blabla's password:
[20:32:57.597] Received install output: root#blabla's password:
[20:32:57.598] Stopped parsing output early. Remaining text: root#blabla's password:
[20:32:57.598] Failed to parse remote port from server output
[20:32:57.603] Resolver error: Error:
at Function.Create (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:1:130564)
at Object.t.handleInstallOutput (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:1:127671)
at I (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:106775)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:104774
at async Object.t.withShowDetailsEvent (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:109845)
at async Object.t.resolve (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:107960)
at async c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:141955
[20:32:57.606] ------
[20:32:59.376] Password dialog canceled
[20:32:59.376] "install" terminal command canceled```
Depending on the system you are in, when you first try to connect, a vscode-server will be set up and configured on your server.
In linux that can be in /Home/<user>/.vscode-server
If you are on windows, check what that is.
The first solution is to try the extension command: Remote-SSH: kill VS Code Server on Host
Open the command pallet (CTRL + SHIFT + P or COMMAND + SHIFT + P (mac) ).
And type Remote kill :
Then try to connect again! (That will kill the server on the host! Which will make it start again on the next try)
If that doesn't work, and things are still failing:
Delete, rm
Then a good solution that can work is: to connect to your server through terminal (vscode terminal, gnome-terminal, whatever). Then go and remove /Home/<user>/.vscode-server
Try to connect after that. At the attempt the server will be re-installed completely anew, chances are it will work. (I did that and it worked for me, so whatever that was going wrong on the vscode-server: just start all over)
But again: you will lose things, config, meta data, etc. (because you start anew).
Update:
As stated by #natevw in the comments:
I found that removing only the .vscode-server/bin subfolder helped straighten things out and afaict kept my data/settings.
Removing only vscode-server/bin seems to work well, and the config, metadata, etc. remains untouched.
I downgrade Remote-SSH plugin to 0.51.0, rm -rf $HOME/.vscode-server on the remote machine. Connect again, VSCode will download and install a new .vscode-server. Then upgrade Remote-SSH plugin, everything works.
One way worked for me is, by adding this line in the vscode settings (JSON) file.
"remote.SSH.useLocalServer": false
I met the same problem. After I did these steps, it works:
on the remote server:
rm -rf ~/.vscode-server
rm -rf ~/.vscode
On the local VS code:
reinstall remote-ssh
In case all the above fails, here's how I fixed my issue.
First, I was able to SSH into my remote server (Ubuntu 22.04, Raspberry Pi 4, arm64) using a simple bash terminal. So I logged in using my terminal (macOS), and I went to
cd $HOME/.vscode-server/bin/WHATEVER-HASH-YOU-HAVE/
In this directory, there is a file named server.sh. I tried running this script, and I got the following error:
./node: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory
The issue was clear: there was a missing shared library on my system. Either Node.js now requires that or the new version of the SSH-Remote extension; I don't know. I did not spent the time to dig into those specifics.
But to fix that, I simply did:
sudo apt-get install libatomic1
That installed the missing shared library.
After that, I delete $HOME/.vscode-server:
rm -rf $HOME/.vscode-server
and tried again connecting using VSCode. It worked!
Hope this can help someone like me, for whom all other options failed.
Issue: while trying to ssh connect to Linux(remote machine) using vscode.
Solution: remove/delete the bin folder inside .vscode-server and then reconnect to the remote machine
In remote server:
remote_name:~$ rm -rf ~/.vscode-server/bin
*reconnect to remote machine*
It turns out that my fish was a obstacle for vscode server.
Then I tried
chsh -s /bin/bash
And works fine.
I worked adding \\ in the path of the .config
I share the steps
Go to .config settings
select configuration
add double \\
Just deleted old host information from ssh settings file and problem solved.
I had faced this issue when I tried to connect to a Linux server from a windows laptop.
It was using the wrong fingerprint.
It worked for me after removing the line related to that server from $HOME/.ssh/known_hosts
I ran into the same issue, it got fixed when I updated the path of the IdentityFile from 'ssh_key' to '~/.ssh/ssh_key' (the entire path I mean) so that the VS code could recognize it.
Restart remote machine worked for me (after trying all the previous answers with no luck).
Giving you the oldest trick of the book:
restart
It worked for me and I laughed hysterically for exactly 57 seconds. Happy reconnecting to the server my dear Coder!
I could not connect to the server, my issue was the remote server was full
check with the command df -h if the disk is full !
Here is an alternative for Remote SSH, pls check my answer at: https://stackoverflow.com/a/68046111/13089935
TLDR:
We can use a web-based VS Code that is installed on the server directly.

What is nis_enabled in SELINUX?

What exactly does command sudo setsebool -P nis_enabled 1 ? It seems to fixed strange access denied errors when running rabbitmq on Centos 7. All I know is that it i somehow related to SELINUX (what is for me black magic and often the reason why various programs mysteriously does not run).
I Guess NIS=Network Information Service

Postgres 9.0 File System level backup on Debian Jessie

I'm on Debian 8.2.0 and trying to run a postgres server from a folder I received. Version is 9.0.18. Here is the command I issue:
./postgres -D /home/swapps/project/PostgreSQL/9.0/data/
but the cursor keeps blinking in the terminal. I'm not sure what is happening?
Thanks
Sounds like it's started, and log_min_messages is set to a high enough value that you don't see any output.
Using another terminal session connect to the server on the port it's running on. If you don't know that check the port value in the postgresql.conf inside the data directory.
Generally you should use pg_ctl -D blah -w start rather than postgres directly. See the manual.
Or, for long term use, set it up to run on startup via an init script.

how to check the daemon running status

I am trying to figure out what daemons are running on the Opennms (version 1.12.8) for the purpose of debugging. Is there any good way to do it?
Figured out the way to check it. Just goto the /opennms/bin directory and run
sudo ./opennms -v status

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

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.