β² 858 βΌ I didn't know you were supposed to disable root user... (linux.community) submitted 2 years ago by Tablaste@linux.community to c/linuxmemes@lemmy.world 170 comments fedilink hide all child comments Background: 15 years of experience in software and apparently spoiled because it was already set up correctly. Been practicing doing my own servers, published a test site and 24 hours later, root was compromised. Rolled back to the backup before I made it public and now I have a security checklist.
[β] sommerset 29 points 2 years ago (2 children) I'm confused. I never disable root user and never got hacked. Is the issue that the app is coded in a shitty way maybe ? permalink fedilink source hideshow 4 child comments replies: [β] Xanza@lemm.ee 25 points 2 years ago (2 children) You can't really disable the root user. You can make it so they can't login remotely, which is highly suggested. permalink fedilink source parent hideshow 4 child comments replies: [β] possiblylinux127@lemmy.zip 12 points 2 years ago (1 child) sudo passwd -l root This disables the root user permalink fedilink source parent hideshow 2 child comments replies: [β] Xanza@lemm.ee 13 points 2 years ago (1 child) There's no real advantage to disable the root user, and I really don't recommend it. You can disable SSH root login, and as long as you ensure root has a secure password that's different than your own account your system is just as safe with the added advantage of having the root account incase something happens. permalink fedilink source parent hideshow 2 child comments replies: [β] possiblylinux127@lemmy.zip -1 points 2 years ago (2 children) That wouldn't be defense in depth. You want to limit anything that's not necessary as it can become a source of attack. There is no reason root should be enabled. permalink fedilink source parent hideshow 4 child comments replies: [β] Faresh@lemmy.ml 7 points 2 years ago I don't understand. You will still need to do administrative tasks once in a while so it isn't really unnecessary, and if root can't be logged in, that will mean you will have to use sudo instead, which could be an attack vector just as su. permalink fedilink source parent [β] Xanza@lemm.ee 4 points 2 years ago Why do like, houses have doors man. You gotta eliminate all points of egress for security, maaaan. /s There's no particular reason to disable root, and with a hardened system, it's not even a problem you need to worry about... permalink fedilink source parent [β] MehBlah@lemmy.world 1 point 2 years ago Another thing you can do under certain circumstances which I'm sure someone on here will point out is depreciated is use TCP Wrappers. If you are only connecting to ssh from known IP addresses or IP address ranges then you can effectively block the rest of the world from accessing you. I used a combination of ipset list, fail2ban and tcp wrappers along with my firewall which like is also something old called iptables-persistent. I've also moved my ssh port up high and created several other fake ports that keep anyone port scanning my IP guessing. These days I have all ports closed except for my wireguard port and access all of my hosted services through it. permalink fedilink source parent [β] cley_faye@lemmy.world 4 points 2 years ago You can't really disable it anyway. Hardening is mostly prevent root login from outside in case every other layer of authentication and access control broke, do not allow regular user to su/sudo into it for free, and have a tight grip on anything that's executable and have a setuid bit set. I did not install a system from scratch in a long time but I believe this would be the default on most things that are not geared toward end-user devices, too. permalink fedilink source parent
[β] Xanza@lemm.ee 25 points 2 years ago (2 children) You can't really disable the root user. You can make it so they can't login remotely, which is highly suggested. permalink fedilink source parent hideshow 4 child comments replies: [β] possiblylinux127@lemmy.zip 12 points 2 years ago (1 child) sudo passwd -l root This disables the root user permalink fedilink source parent hideshow 2 child comments replies: [β] Xanza@lemm.ee 13 points 2 years ago (1 child) There's no real advantage to disable the root user, and I really don't recommend it. You can disable SSH root login, and as long as you ensure root has a secure password that's different than your own account your system is just as safe with the added advantage of having the root account incase something happens. permalink fedilink source parent hideshow 2 child comments replies: [β] possiblylinux127@lemmy.zip -1 points 2 years ago (2 children) That wouldn't be defense in depth. You want to limit anything that's not necessary as it can become a source of attack. There is no reason root should be enabled. permalink fedilink source parent hideshow 4 child comments replies: [β] Faresh@lemmy.ml 7 points 2 years ago I don't understand. You will still need to do administrative tasks once in a while so it isn't really unnecessary, and if root can't be logged in, that will mean you will have to use sudo instead, which could be an attack vector just as su. permalink fedilink source parent [β] Xanza@lemm.ee 4 points 2 years ago Why do like, houses have doors man. You gotta eliminate all points of egress for security, maaaan. /s There's no particular reason to disable root, and with a hardened system, it's not even a problem you need to worry about... permalink fedilink source parent [β] MehBlah@lemmy.world 1 point 2 years ago Another thing you can do under certain circumstances which I'm sure someone on here will point out is depreciated is use TCP Wrappers. If you are only connecting to ssh from known IP addresses or IP address ranges then you can effectively block the rest of the world from accessing you. I used a combination of ipset list, fail2ban and tcp wrappers along with my firewall which like is also something old called iptables-persistent. I've also moved my ssh port up high and created several other fake ports that keep anyone port scanning my IP guessing. These days I have all ports closed except for my wireguard port and access all of my hosted services through it. permalink fedilink source parent
[β] possiblylinux127@lemmy.zip 12 points 2 years ago (1 child) sudo passwd -l root This disables the root user permalink fedilink source parent hideshow 2 child comments replies: [β] Xanza@lemm.ee 13 points 2 years ago (1 child) There's no real advantage to disable the root user, and I really don't recommend it. You can disable SSH root login, and as long as you ensure root has a secure password that's different than your own account your system is just as safe with the added advantage of having the root account incase something happens. permalink fedilink source parent hideshow 2 child comments replies: [β] possiblylinux127@lemmy.zip -1 points 2 years ago (2 children) That wouldn't be defense in depth. You want to limit anything that's not necessary as it can become a source of attack. There is no reason root should be enabled. permalink fedilink source parent hideshow 4 child comments replies: [β] Faresh@lemmy.ml 7 points 2 years ago I don't understand. You will still need to do administrative tasks once in a while so it isn't really unnecessary, and if root can't be logged in, that will mean you will have to use sudo instead, which could be an attack vector just as su. permalink fedilink source parent [β] Xanza@lemm.ee 4 points 2 years ago Why do like, houses have doors man. You gotta eliminate all points of egress for security, maaaan. /s There's no particular reason to disable root, and with a hardened system, it's not even a problem you need to worry about... permalink fedilink source parent
[β] Xanza@lemm.ee 13 points 2 years ago (1 child) There's no real advantage to disable the root user, and I really don't recommend it. You can disable SSH root login, and as long as you ensure root has a secure password that's different than your own account your system is just as safe with the added advantage of having the root account incase something happens. permalink fedilink source parent hideshow 2 child comments replies: [β] possiblylinux127@lemmy.zip -1 points 2 years ago (2 children) That wouldn't be defense in depth. You want to limit anything that's not necessary as it can become a source of attack. There is no reason root should be enabled. permalink fedilink source parent hideshow 4 child comments replies: [β] Faresh@lemmy.ml 7 points 2 years ago I don't understand. You will still need to do administrative tasks once in a while so it isn't really unnecessary, and if root can't be logged in, that will mean you will have to use sudo instead, which could be an attack vector just as su. permalink fedilink source parent [β] Xanza@lemm.ee 4 points 2 years ago Why do like, houses have doors man. You gotta eliminate all points of egress for security, maaaan. /s There's no particular reason to disable root, and with a hardened system, it's not even a problem you need to worry about... permalink fedilink source parent
[β] possiblylinux127@lemmy.zip -1 points 2 years ago (2 children) That wouldn't be defense in depth. You want to limit anything that's not necessary as it can become a source of attack. There is no reason root should be enabled. permalink fedilink source parent hideshow 4 child comments replies: [β] Faresh@lemmy.ml 7 points 2 years ago I don't understand. You will still need to do administrative tasks once in a while so it isn't really unnecessary, and if root can't be logged in, that will mean you will have to use sudo instead, which could be an attack vector just as su. permalink fedilink source parent [β] Xanza@lemm.ee 4 points 2 years ago Why do like, houses have doors man. You gotta eliminate all points of egress for security, maaaan. /s There's no particular reason to disable root, and with a hardened system, it's not even a problem you need to worry about... permalink fedilink source parent
[β] Faresh@lemmy.ml 7 points 2 years ago I don't understand. You will still need to do administrative tasks once in a while so it isn't really unnecessary, and if root can't be logged in, that will mean you will have to use sudo instead, which could be an attack vector just as su. permalink fedilink source parent
[β] Xanza@lemm.ee 4 points 2 years ago Why do like, houses have doors man. You gotta eliminate all points of egress for security, maaaan. /s There's no particular reason to disable root, and with a hardened system, it's not even a problem you need to worry about... permalink fedilink source parent
[β] MehBlah@lemmy.world 1 point 2 years ago Another thing you can do under certain circumstances which I'm sure someone on here will point out is depreciated is use TCP Wrappers. If you are only connecting to ssh from known IP addresses or IP address ranges then you can effectively block the rest of the world from accessing you. I used a combination of ipset list, fail2ban and tcp wrappers along with my firewall which like is also something old called iptables-persistent. I've also moved my ssh port up high and created several other fake ports that keep anyone port scanning my IP guessing. These days I have all ports closed except for my wireguard port and access all of my hosted services through it. permalink fedilink source parent
[β] cley_faye@lemmy.world 4 points 2 years ago You can't really disable it anyway. Hardening is mostly prevent root login from outside in case every other layer of authentication and access control broke, do not allow regular user to su/sudo into it for free, and have a tight grip on anything that's executable and have a setuid bit set. I did not install a system from scratch in a long time but I believe this would be the default on most things that are not geared toward end-user devices, too. permalink fedilink source parent