what I did
sudo apt install lightdm
sudo reboot
sudo apt install x11vnc
sudo vi /lib/systemd/system/x11vnc.service
..
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -forever -display :0 -auth guess -passwd password
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
..
systemctl status x11vnc.service
the x11vnc.service is active running status now.
through port forwarding I open internal 5900 -> external 15900
and in putty, tunneling configuration, I added 5900 and public_ip:15900
then when I try to use in realvnc-viewer url, I typed localhost:0
and the system requires password for localhost:0
I tried tigervnc-viewer, it doesn't feel client viewer problem.
So I filled password to 'password'.
I tried so many times all failed with no password configured for vnc error.
Is there solution for this?
[Solved]
I didn't open ufw for 5900
Related
I have installed GitHub self-hosted runner on my Ubuntu system. Getting below error when i try to configure it as service.
$ sudo ./svc.sh start
Failed to start actions.runner._services.Linux-Host01.service: Unit actions.runner._services.Linux-Host01.service is not loaded properly: Exec format error.
See system logs and 'systemctl status actions.runner._services.Linux-Host01.service' for details.
Failed: failed to start actions.runner._services.Linux-Host01.service
$ systemctl status actions.runner._services.Linux-Host01.service
● actions.runner._services.Linux-Host01.service - GitHub Actions Runner (_services.Linux-Host01)
Loaded: error (Reason: Exec format error)
Active: inactive (dead)
$ cat /etc/systemd/system/actions.runner._services.Linux-Host01.service
[Unit]
Description=GitHub Actions Runner (_services.Linux-Host01)
After=network.target
[Service]
ExecStart=/home/admin.user/actions-runner/runsvc.sh
User=admin.user
WorkingDirectory=/home/admin.user/actions-runner
KillMode=process
KillSignal=SIGTERM
TimeoutStopSec=5min
[Install]
WantedBy=multi-user.target
$ sudo journalctl -u actions.runner._services.Linux-Host01.service -f
Aug 04 08:40:47 Linux-Host01 systemd[1]: /etc/systemd/system/actions.runner._services.Linux-Host01.service:7: Invalid user/group name or numeric ID: admin.user
Additionally have provided executable permission to actions.runner._services.Linux-Host01.service but still it results same error.
What is wrong here?
I have changed User=admin.user to User=uid in the /etc/systemd/system/actions.runner._services.Linux-Host01.service file and then executed
systemctl daemon-reload
Now action service started and it is running fine.
Good morning,
First of all stop the service:
sudo ./svc.sh stop
Then make sure you have given permissions to the user:
sudo usermod -a -G <USER>
Now try to start the service:
sudo ./svc.sh start
And tell me if this works when check the status.
If not works please do the same but sudo permissions:
sudo su
And then try again all without sudo command because you are actually on root.
Have a great day!
This simply means you've not installed the runner
sudo ./svc.sh install // install the runner
sudo ./svc.sh start // then start it
Remember, this is the best way to go about it than using the ./run.sh script, as the runner will always be running in the background.
Use sudo ./svc.sh status to confirm that the runner is up and running.
I'm using Cockpit to monitor a server with Gitlab.
Since I installed Cockpit, Gitlab is using 100% of my CPU.
When I check with htop, I see this is a Gitlab component, prometheus.
Solution:
While I'm writing this question, I found a solution.
Prometheus and Cockpit use the same port by default (9090).
I just have to change the Cockpit port to another and everything goes to normal :)
On Ubuntu Server 18.04, edit /etc/systemd/system/sockets.target.wants/cockpit.socket like this:
[Unit]
Description=Cockpit Web Service Socket
Documentation=man:cockpit-ws(8)
[Socket]
ListenStream=XXXX <-- Change port here.
ExecStartPost=-/bin/ln -sf /usr/share/cockpit/issue/active.issue /run/cockpit/issue
ExecStopPost=-/bin/ln -sf /usr/share/cockpit/issue/inactive.issue /run/cockpit/issue
[Install]
WantedBy=sockets.target
Then reload systemd config and restart Cockpit:
sudo systemctl daemon-reload
sudo systemctl restart cockpit.socket
That's all!
Ubuntu 16.04.1 LTS
I have tried:
sudo update-rc.d -f postgresql remove
and
sudo vim /etc/postgresql/9.5/main/start.conf
then i change the word "auto" to "disabled"
Then i reboot the computer, and when it starts, i login and do:
sudo service --status-all | grep postgresql
Which returns:
[ + ] postgresql
So it is still starting when the server starts.
What is left for me to do? I don't want this service running when the computer starts, only when i manually start it with:
sudo service postgresql start
Use systemctl command to manage postgresql service:
stop service:
systemctl stop postgresql
start service:
systemctl start postgresql
show status of service:
systemctl status postgresql
disable service(not auto-start any more)
systemctl disable postgresql
enable service postgresql(auto-start)
systemctl enable postgresql
Ok. it's fixed thanks to Koen De Groote.
I did:
echo manual | sudo tee /etc/init/postgresql.override
and
sudo systemctl disable postgresql.service
and
sudo systemctl disable postgresql
....I don't know which one of them did it, but its not starting any more... Thank you...
How to configure vnc server in Linux (Cent OS7) server to access from windows and Linux machines.
I have tried with Tiger VNC but its not working every time after reboot the system. Please suggest other than Tiger VNC.
Given are the steps to install and configure VNC server in centOs:
~]# yum install tigervnc-server
~]# cp /usr/lib/systemd/system/vncserver#.service /etc/systemd/system/vncserver#:1.service
~]# vim /etc/systemd/system/vncserver#:1.service
replaced USER with riddhi in this file
ExecStart=/usr/sbin/runuser -l USER -c "/usr/bin/vncserver %i -geometry 1280x1024"
PIDFile=/home/USER/.vnc/%H%i.pid
~]# systemctl daemon-reload
~]# su - riddhi
~]$ vncpasswd //update password for user riddhi
~]# systemctl start vncserver#:1.service
~]# systemctl enable vncserver#:1.service
Now connect to centOs from Windows:
IP: ip address:5901
password : password of vncpasswd
Judging by your wording, it sounds like Tiger VNC is working just fine until you reboot. This is because the service is not set to start VNC automatically.
By following the guide found here (specifically step 3) you will have written your own .service file and all you need to do is run:
sudo systemctl enable whateveryoucalledyour.service
and it will start automatically every time the system is booted.
I have a service that I want to start with system startup. I have built a ap#.service definition for it as a template, because there could be many instances.
Defined in the root systemd, this works well, and starts and stops the service with the system. The service instance is installed with systemctl enable ap#inst1 as would be expected. Root is also able to start and stop the service without problems. The service runs in its own account (myuser), not root, controlled by User=myuser in the ap#.service template.
But I want user 'myuser' to be able to start and stop their own service, without compromising system security.
I switched to using a user systemd, and enabled lingering with loginctl enable-linger myuser. I then enable the service defined in the ~myuser/.config/systemd/user directory. The service now starts and stops cleanly with the system, as designed. If I log in to a terminal as 'myuser', systemctl --user start ap#inst1, and systemctl --user stop ap#inst1 both work perfectly.
However, if I log in as a different user (user2) and perform sudo su - myuser in a terminal, then systemctl --user commands now fail with error message "Failed to get D-Bus connection: no such file or directory".
How do I enable systemctl --user to work after a sudo su - myuser command to switch the user?
I found the answer on another site with further searches using different terms.
The solutions needed was to provide the shell with information to reach the correct DBUS for the user.
By adding the following environment variables to the shell before running systemctl --user, the DBUS problem is eliminated, and systemctl operates correctly.
export XDG_RUNTIME_DIR="/run/user/$UID"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
To ensure that the DBUS_SESSION_BUS_ADDRESS is available in the sudo shell, I added the environment variables to ~/.bash_profile of the target userid. This requires that a login shell ( sudo su - myuser or sudo -l myuser) is created in order to create the correct environment.
Alternatively, add the creation of the environment variables to ~/.bashrc (or equivalent for other shells). The environment will then be established anew for all shell creations.
systemd 248 (released March 2021) introduced support for the syntax -M myuser# for specifying another user.
$ sudo systemctl --user -M myuser# start ap#inst1
A side-note:
If you want to get an interactive login shell for the user myuser
$ sudo machinectl shell myuser#