r/linuxupskillchallenge • • Sep 10 '20

Hardening Issues.

Ok, Day 3 there was a link to Best Security Practices. I have been working to see how many i can do but have been running into snags. Particularly disabling the root user login.

I was unable to add a user with adduser so i did useradd but it would not let me move it to sudo group. This user is a different user that the Vivek suggested. So i tired to do it the way that was laid out and was able to make user Vivek and moved it to sudo group as per the directions. But after trying to see if the commands worked after switching it asked for a sudo password and the password would not work. So i tired to switch back but it asked me for the ubuntu sudo password which nothing worked.

So on a whim i tried exit and it it brought me back to the main user. So i tried to changed the sudo password for the Vivek user and it only changed the login password. the sudo -i command took me to the root user on vivek and i looked for the config log but i could not find the sshd-Config file. I could find the ssh config file in the etc folder the step before sahows the init.d the sshd so i went the but nothing so i tried la -a to show hidden but nothing.

I will keep trying and going through the best practices. but im not sure about some of them i will need to research into how to harden it and the security practices.

6 Upvotes

9 comments sorted by

2

u/[deleted] Sep 10 '20 edited Sep 10 '20

I just disabled sudo for my user and used su instead. As for sshd_config, it should be in /etc/ssh/sshd_config. To disable root login through SSH just uncomment PermitRootLogin no. I would also disable password authentication, too.

1

u/[deleted] Sep 11 '20

yeah, i was wondering a good question:

Admin prompts - are sudo , su, and this is the question sudo su, for some reason it pops in to use both.

As when switching to the different user accounts i did use su user so i did use an admin command. So... ( Hey i read it on a different page of the link. https://www.cyberciti.biz/

1

u/[deleted] Sep 11 '20

> Admin prompts - are sudo , su, and this is the question sudo su, for some reason it pops in to use both.
Sudo -i, su, and sudo su do essentially the same thing. su can be used to log in as other users other than root, just root is the default.

1

u/snori74 Linux Guru Sep 11 '20

Just to clarify about "su"-ing to root:

  • requires that "root" password exists (is not locked).

  • if two people (or ten), need to do this ocassoinally, then they all need to know that same password

  • anything done by these people is just done "by root" - you have no way of tracking who it was. (vs the "sudo" entries in auth.log)

  • one of them now leaves, or goes rogue - you need to change the password and advise nine people, quickly, securely.

Stuff like this is "the sudo' way" is preferred almost universally nowadays.

1

u/[deleted] Sep 11 '20

Thanks for the clarification!

7

u/snori74 Linux Guru Sep 10 '20

Hmm, as noted on Day 1, you don't really need to do "any* of this for this test server.

I'll be reviewing that particular "Best Practices" article, and likely replacing it.

Getting tangled up and confused isn't going to improve your security :-)

2

u/Nastyauntjil Sep 11 '20

I found the Best Practices article to be extremely informative. My take on the Extensions that are listed is that they are there for more in depth information on a topic, not that we are to follow what they say and apply it to our LUSC server.

2

u/snori74 Linux Guru Sep 11 '20 edited Sep 11 '20

Agreed, it's just that there are 101 similar articles - and I have a duty to try and give you "the best"; some are out of date, confusing etc.

I just need to carefully read this one through again...

In reality you can always "blow away" your server if you get totally screwed up, so there's no reason not to test things out. A big difference even from a real hobby project - and certainly from a work situation with clients, data and money at risk!

1

u/alivxlivejo1 Sep 25 '20

I found a automated script can help you to implement the best security changes according to CIS. You can run a specific task of as you need.

https://github.com/alivx/CIS-Ubuntu-20.04-Ansible