# Cannot ssh into server after creating systemd link

**URL:** <https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664>\
**Category:** Operate a Stake Pool\
**Created:** [7 November 2021 17:05 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664 "2021-11-07T17:05:09Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Conchita](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/conchita/32/45877_2.png) [@Conchita](https://forum.cardano.org/u/Conchita)\
**Post date:** [7 November 2021 17:05 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/1 "2021-11-07T17:05:09Z")

</div>

Hi guys,

following the coincashew guide for mainnet, I use a vps that I ssh into. Node was happily running and all was fine.  
I then came to Chapter 7 and created the cardano-node.service according to the example. (i.e. copy paste)  
After copying it to /etc/systemd/system/cardano-node.service

I wanted to “test” it.

So I rebooted.

Now I cannot ssh into the server anymore.

Does anybody have an idea for me?  
1- to get in again, without going to the vps site and reset the whole thing?  
2 - how this could happen? And how to solve?

I have a dummy server at home for test purposes (not running my mainnet BPN - but just an alternative test node for trail) and I wrote a similar service file. After reboot, I had huge trouble getting in again, but as it is physically located next to me, I can have direct access. (in this case I replaced the ${user} by a real username and hardlinked the WorkingDirectory instead of leaving the $NODE\_HOME from the example that made the vps close me out).

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Alexd1985](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/alexd1985/32/23759_2.png) [@Alexd1985](https://forum.cardano.org/u/Alexd1985)\
**Post date:** [7 November 2021 17:09 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/2 "2021-11-07T17:09:05Z")

</div>

Did u changed the default ssh port 22? Perhaps in an previous step?

---

<div class="post-metadata">

**Author:** ![Conchita](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/conchita/32/45877_2.png) [@Conchita](https://forum.cardano.org/u/Conchita)\
**Post date:** [7 November 2021 17:49 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/3 "2021-11-07T17:49:07Z")

</div>

I use a different port yes, but that never was a problem. The problem came with the systemd file - unless the systemd file requires port 22. In that case, that would be the answer.

---

<div class="post-metadata">

**Author:** ![Alexd1985](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/alexd1985/32/23759_2.png) [@Alexd1985](https://forum.cardano.org/u/Alexd1985)\
**Post date:** [7 November 2021 17:49 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/4 "2021-11-07T17:49:55Z")

</div>

Nope, systemd is something else… should not affect the ssh process

on your local node… now the ssh is working or not?

I think the new ssh configurtion applied after u rebooted the server and u missed something

---

<div class="post-metadata">

**Author:** ![Conchita](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/conchita/32/45877_2.png) [@Conchita](https://forum.cardano.org/u/Conchita)\
**Post date:** [7 November 2021 17:52 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/5 "2021-11-07T17:52:56Z")

</div>

only for the local server. For the vps nothing.

ssh -p #### user@x.x.x.x  
ssh: connect to host x.x.x.x port ####: Connection refused

---

<div class="post-metadata">

**Author:** ![Alexd1985](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/alexd1985/32/23759_2.png) [@Alexd1985](https://forum.cardano.org/u/Alexd1985)\
**Post date:** [7 November 2021 17:55 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/6 "2021-11-07T17:55:21Z")

</div>

hmm can u try ssh user@x.x.x.x -p XXXX ?

Delete ur user from above comment

---

<div class="post-metadata">

**Author:** ![Conchita](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/conchita/32/45877_2.png) [@Conchita](https://forum.cardano.org/u/Conchita)\
**Post date:** [7 November 2021 18:04 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/7 "2021-11-07T18:04:27Z")

</div>

ok, for the local one, where I hardlinked these ${user} and workingdir, this works.

For the vps still no result:  
Can it be that the ${user} or $NODE\_HOME are at fault? OR:  
Can it be that the vps does not allow this kind of script?

Ideally I’d likethe vps to be the relay and the home server to be the BPN.

---

<div class="post-metadata">

**Author:** ![Alexd1985](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/alexd1985/32/23759_2.png) [@Alexd1985](https://forum.cardano.org/u/Alexd1985)\
**Post date:** [7 November 2021 18:05 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/8 "2021-11-07T18:05:55Z")

</div>

nope, it looks like the connection is refused… now do u have any other way to connect on server? Via VNC perhaps?

---

<div class="post-metadata">

**Author:** ![Conchita](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/conchita/32/45877_2.png) [@Conchita](https://forum.cardano.org/u/Conchita)\
**Post date:** [7 November 2021 18:07 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/9 "2021-11-07T18:07:02Z")

</div>

Will try - I’ll be back with news, positive or negative.

Ok, the answer is:  
IF the links ${USER} and $NODE\_HOME do not link correctly to the right destinations, the systemd link will not be able to start well:

this does not work:  
sudo systemctl reload-or-restart cardano-node

and if that does not work, the vps is caught in a neverending cycle and that’s it.

When this DOES work, the whole link works.

So, don’t reboot to early before checking.

In my case the $NODE\_HOME referred to another directory as I had tried to set up a node several times before succeeding.

error message:  
/etc/systemd/system/cardano-node.service:12: WorkingDirectory= path is not absolute: ${NODE\_HOME}

> > > And in this very case, I had to start all over again.

---

<div class="post-metadata">

**Author:** ![mcrio](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/mcrio/32/40017_2.png) [@mcrio](https://forum.cardano.org/u/mcrio)\
**Post date:** [7 November 2021 20:46 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/10 "2021-11-07T20:46:13Z")

</div>

Did you enable the firewall maybe and forgot to open the new SSH port?

---

<div class="post-metadata">

**Author:** ![Conchita](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/conchita/32/45877_2.png) [@Conchita](https://forum.cardano.org/u/Conchita)\
**Post date:** [7 November 2021 20:55 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/11 "2021-11-07T20:55:41Z")

</div>

no, that was all good and tested. IT started when I made the service file.

- cardano-node.service - Cardano node service  
Loaded: loaded (/etc/systemd/system/cardano-node.service; enabled; vendor preset: enabled)  
Active: activating (auto-restart) (Result: exit-code) since Sun 2021-11-07 20:50:10 UTC; 2s ago  
Process: 1978701 ExecStart=/bin/bash -c /home/user/cardano-my-node/startRelayNode1.sh (code=exited, status=1/FAILURE)  
Main PID: 1978701 (code=exited, status=1/FAILURE)

And there still is an error here

---

<div class="post-metadata">

**Author:** ![Alexd1985](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/alexd1985/32/23759_2.png) [@Alexd1985](https://forum.cardano.org/u/Alexd1985)\
**Post date:** [7 November 2021 20:58 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/12 "2021-11-07T20:58:16Z")

</div>

journalctl -e -f -u cardano-node

---

<div class="post-metadata">

**Author:** ![Conchita](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/conchita/32/45877_2.png) [@Conchita](https://forum.cardano.org/u/Conchita)\
**Post date:** [7 November 2021 21:17 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/13 "2021-11-07T21:17:42Z")

</div>

Hi Alex,

thanks - that helped! Because now I know for sure that this:

#!/bin/bash  
DIRECTORY=$NODE\_HOME  
PORT=6000  
HOSTADDR=0.0.0.0  
TOPOLOGY=${DIRECTORY}/${NODE\_CONFIG}-topology.json  
DB\_PATH=${DIRECTORY}/db  
SOCKET\_PATH=${DIRECTORY}/db/socket  
CONFIG=${DIRECTORY}/${NODE\_CONFIG}-config.json  
/usr/local/bin/cardano-node run +RTS -N -RTS --topology ${TOPOLOGY} --database-path ${DB\_PATH} --socket-path ${SOCKET\_PATH} --host-addr ${HOSTADDR} --port ${PORT} --config ${CONFIG}

needs to be:

#!/bin/bash  
DIRECTORY=~/cardano-my-node  
PORT=6000  
HOSTADDR=0.0.0.0  
TOPOLOGY=${DIRECTORY}/mainnet-topology.json  
DB\_PATH=${DIRECTORY}/db  
SOCKET\_PATH=${DIRECTORY}/db/socket  
CONFIG=${DIRECTORY}/mainnet-config.json  
/usr/local/bin/cardano-node run +RTS -N -RTS --topology ${TOPOLOGY} --database-path ${DB\_PATH} --socket-path ${SOCKET\_PATH} --host-addr ${HOSTADDR} --port ${PORT} --config ${CONFIG}

apparently the server “forgets” the set $-values when using the service file.

I could leave the $-values when I manually start with ./startRelayNode1.sh  
but when I use  
sudo systemctl start cardano-node

it cannot find the $-values.

Does that make sense?

Ha - this is because I made the file with nano instead of cat

---

<div class="post-metadata">

**Author:** ![Conchita](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/conchita/32/45877_2.png) [@Conchita](https://forum.cardano.org/u/Conchita)\
**Post date:** [7 November 2021 21:46 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/14 "2021-11-07T21:46:21Z")

</div>

is it normal that the node needs to start syncing all over again after reboot? Does it not have all the info in the /db folder?

---

<div class="post-metadata">

**Author:** ![Alexd1985](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/alexd1985/32/23759_2.png) [@Alexd1985](https://forum.cardano.org/u/Alexd1985)\
**Post date:** [7 November 2021 21:51 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/15 "2021-11-07T21:51:11Z")

</div>

It’s something normal… the processes were stoped during the reload. But will not start downloading all the db again

---

<div class="post-metadata">

**Author:** ![Conchita](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/conchita/32/45877_2.png) [@Conchita](https://forum.cardano.org/u/Conchita)\
**Post date:** [7 November 2021 22:01 UTC](https://forum.cardano.org/t/cannot-ssh-into-server-after-creating-systemd-link/83664/16 "2021-11-07T22:01:34Z")

</div>

hmm, they did - and the cpu usage is much higher now with the service link =\> syncing is much slower.
