Hardening an Ubuntu Server

Hardening an Ubuntu Server

Create a new user called cardano

When I run this command: useradd -m -s /bin/bash cardano

: I get permission denied
: cannot lock /etc/passwd; try again later

What can be the problem?

You are trying it as a normal user without sudo?

yes, should I write sudo infront?

Yes, sudo is always in front of the command that needs root privileges.

I cant get this next chapter right, maybe you can help me? I am trying to ( Transfer the public key to your remote node. Update the keyname .)

with this command: sudo ssh-copy-id -i $HOME/.ssh/.pub cardano@server.public.ip.address

I did put my public Ip adress after @ . What more do i have to modify?

Did you generate a key pair (ssh-keygen) before that?

Also, that command should probably be without sudo, since you want to connect with the ssh key of your user, not with root’s ssh key.

Yes i did that, should i change the keyname in the command as well?

Command: ssh-copy-id -i $HOME/.ssh/.pub cardano@server.public.ip.address

Usually, it’s $HOME/.ssh/id_rsa.pub.

You do know tab completion? If you are somewhere on the command line, hitting the tabulator key once will complete as far as there already is a unique completion. Twice will give you a selection of possible completions. Ideal to not have to remember exact filenames.

I cant get it working, unfortunatley. dont understand whats wrong.

command: ssh-copy-id -i $HOME/.ssh/id_numbers.pub cardano@IP

Does it give you any error message?

/usr/bin/ssh-copy-id: ERROR: failed to open ID file ‘/home/betterloop/.ssh/id_number.pub’: No such file

It pretty clearly tells you that that is not the correct file name.

You can view what is inside that directory with ls $HOME/.ssh/ (or use the tab completion mentioned in one of the previous posts).

Also, if you want to operate a Linux server on the open internet, you probably should learn a bit of Linux. Those guides unfortunately don’t give a lot of context and just let you copy and paste through it.

Maybe, start with https://ubuntu.com/tutorials/command-line-for-beginners. Since we are at it at the moment https://schh.medium.com/ssh-for-dummies-ea168e6ff547. Later, to understand how the cardano-node service is contolled, https://medium.com/geekculture/the-rise-of-linux-systemd-a-beginners-guide-8ca1e226103a will surely help.

And many, many more things that are not really Cardano specific.

1 Like

thank you. i will study the links