Yes that’s the right way to block root login. An added filter you can use the ‘match’ config expression to filter logins even further.
If you’re on the open network, your connection will be heavily hit with login attempts. That is normal. But using another service like Fail2Ban will stop repeated hits to your host.
Ssh listens on port 22, as soon as a connection is made the host moves the connection to another port to free up 22 for other new connections.Btw: I wasn’t thinking clearly here. Out going connections won’t be using port 22, but the listening incoming port is always 22.
Yes that’s the right way to block root login. An added filter you can use the ‘match’ config expression to filter logins even further.
Not sure what you meant about the ‘match’ config expressions here. Could you elaborate a bit further?
If you’re on the open network, your connection will be heavily hit with login attempts. That is normal. But using another service like Fail2Ban will stop repeated hits to your host.
Hehe, yeah, I’ve noticed… The reason I get a little anxious whether I did this correctly, is that 95% of the login attempts are to root, so I want to make sure it is disabled. I have set up Fail2Ban, but I am using default settings, which may be a bit laxer than they need?
I’ve also been advised and considered moving to ssh keys, but I have not gotten to that yet.
Ssh listens on port 22, as soon as a connection is made the host moves the connection to another port to free up 22 for other new connections.
Makes sense. One question that comes from this is: is it possible to disable that? I would never need two ssh-logins at the same time on my server. And the second question is what I asked above regarding whether I should change the port ssh listens to in order to reduce unwanted malicious login attempts?
Match blocks allow you to restrict who/what is allowed or not allowed to connect to the server. There is a large number of options to utilize. Put this near the bottom of sshd_config. There should be an example there.
Ssh listens on port 22, as soon as a connection is made the host moves the connection to another port to free up 22 for other new connections.
There’s no limit on the number of concurrent connections on a single port, and SSH runs completely on the one port it is configured to use. Otherwise allowing just the port 22 in firewall wouldn’t be enough to have a functional SSH connection with default settings.
You can verify that quite easily for example by spinning up three barebone Debian VMs connected to a single virtual network, configuring the firewall on the “server” VM to drop everything other than port 22 and then connecting from both client VMs - it will work just fine.
Maybe you’re confusing it with the fact that only one process can listen on a given port at a time? But that’s only for establishing new connections. Existing connections can be passed off to another running process or a child process just fine, and that’s how SSH handles separation between connections.
Edit: oh, you’re talking about the high port OP is wondering about. That’s just the source port, which is chosen randomly by the client OS when making a connection. Using port 22 (or any other port below 1025) as a source port would require root privileges on the client and would also conflict with the SSH server that could be running there. Still, it has nothing to do with SSH “moving connections over”
Edit: oh, you’re talking about the high port OP is wondering about. That’s just the source port, which is chosen randomly by the client OS when making a connection. Using port 22 (or any other port below 1025) as a source port would require root privileges on the client and would also conflict with the SSH server that could be running there. Still, it has nothing to do with SSH “moving connections over”
Ah, I see, so the port numbers shown in auth.log are all client side ports. I guess I thought that the listening port would be in the log and assumed that the port listed there would be it, but when I read the lines again, it clearly says “from ip.ad.dr.ess port 12345”
What @StarkZarn said is correct. Just one more thing: Did you reload/restart the sshd service after changing the configuration? If so you should be good.
I used to use WindowMaker on seriously underpowered laptops 10-15 years ago. Seems like it’s still just as efficient. For something more standard interface-wise you could try IceWM.
Another thing to do is build your own kernel without any features you don’t use. Not sure how much of a difference that makes exactly.
That all sounds correct to me. The random port you’re seeing in the logs is a high port, often referred to as an ephemeral port, and it is common for source ports. All good there.
Ok, thanks - so if I understand correctly then, it is listening on port 22 as a default, and not accepting traffic on any port.
That brings of the question: wouldn’t I be better off changing the SSH-port? And is that so easy as to uncomment the #Port 22 line in the config file and changing the port number to something random, and saving that somewhere? Would I then be able to connect by running ssh myuser@mydomain.com:, or would I need to do anything else to successfully connect?
You would need to specify the new port when using ssh (using the -p$PORT option). Just keep in mind that security through obscurity is not considered secure in itself. You could instead consider a service like fail2ban that automatically blocks connections from certain sources depending on your set parameters.
Just keep in mind that security through obscurity is not considered secure in itself.
Do you consider it to not be a helpful measure to take at all?
I have fail2ban configured - since it is reading from the auth.log, I guess I would not have to make any changes to the configuration there to have it work with a new port?
It’s a mixed bag. Personally I wouldn’t use a non-standard port.
Consider that port numbers under 1024 are Privileged Ports. You would either have to make sure that no other privileged service is running on the port you want to use for SSH when using another privileged port or you need to make sure that no unprivileged program tries to use the same port as your SSH service when using a non-privileged. Overall it adds a bit of overhead and possible headaches for barely any gain.
Fail2ban should work with a different port without any further configuration but it might not.
Android is already free software, and see how far that gets you. The kicker is that you’re tied into their services (with all the data harvesting, targeted advertising and monetisation that that involves).
Yes, because it is permissively open source, not only are these companies free to build what they want - we are entitled to that same right. We therefore created LineageOS and GrapheneOS, and its really great.
There’s also a lot of motivated people getting regular Linux distributions running on mobile devices too, so we have that as well
Apple would sell for 10 but would deny until death that it sold, and still convince you to believe that it didn’t sell.In addition to giving it a “cool” name like DNA Titanium Protection XDR or something like that,
There is already something in the works (that you can technically buy right now if you wanted), and it actively respects your freedom. Granted, as with everything in this ecosystem, its a very slow burn, so it’ll be a while before the software is actually good, but it’s already made massive strides from where it started.
I would say wait a bit and take a look at this later, but i do have one friend daily driving one now to some success (this wasn’t possible a year ago).
That would be great, but you can buy a $20 burner from a gas station that’s more powerful than those phones.
The regular version uses the Allwinner A64 chip which retailed for $5 when it was released… Back in 2015.
The Pro version uses the RK3399S, which is a custom lower binned version of the RK3399. Neither chip was made available retail, but the SK3399 was released in 2016 and only otherwise used in low-end Chromebooks and SBCs.
Sure, but calling them out for not being a $20 burner phone doesnt make sense when you’re comparing that to a developer/development device. This phone specifically isnt meant for everyday consumers. What it is, however, is a signal that there is now a third competitor in the works, and it’s real and tangible.
If you want serious optimizations - then Gentoo is your choice. But seriously, there won’t be any serious difference between distributions. What really matters here are DEs and browsers. I would recommend some kind of lightweight window manager like i3 or dwm. If you do not want to configure everything yourself, then your choice is lxde/lxqt. Also, you can use distros without systemd (void, artix, devuan, gentoo etc), but that does not matter that much.
A person in this thread already recommended having different colors for different conditions like ssh and running as root, I havent seen anyone mention this specifically but you can determine if the current working directory is writable with something like [ -w “$(pwd)” ] and set the color to red or print a symbol if it doesnt return true.
Also I recommend putting all the code and logic for your shell prompt in a shell function, and using a substitution shell to put it into the PS1 variable like this:
<span style="color:#323232;">__shellprompt ()
</span><span style="color:#323232;">{
</span><span style="color:#323232;"> if [ "$(id -u)" = 0 ]; then
</span><span style="color:#323232;"> local PROMPT_EMBLEM='#'
</span><span style="color:#323232;"> else
</span><span style="color:#323232;"> local PROMPT_EMBLEM='$'
</span><span style="color:#323232;"> fi
</span><span style="color:#323232;"> printf "%s" "$(whoami)@$(uname -n):$(pwd)"
</span><span style="color:#323232;"> printf "n%c " "$PROMPT_EMBLEM"
</span><span style="color:#323232;">}
</span><span style="color:#323232;">PS1='$(__shellprompt)'
</span>
Now this is just a really barebones example, there is a whole lot more you can do like passing in the last exit code through the argv of your shellprompt function like this PS1=‘$(__shellprompt $?)’ and like print it out if its non-zero so you wont have to like echo $? to see if the last command failed, but you should be able to still do this. In my testing, running the shell prompt function in the subsitiution shell didnt effect the $? variable.
In my first comment on another thread about shell prompts, I posted my full shellprompt, it is slightly outdated (I just changed hostname to uname -n), if you cant find it feel free to send a message or just ask, and I will send you the code.
This example is very enlightening. I was kind of aware that one could run shell functions and even use a GIT function in my prompt, but I never thought it through and your example brings the point home.
I’ll waste most probably a few hours to find my perfect prompt function!
Something that should be noted when adding colors to your shell prompt function is adding the non printable characters that keep the terminal from buggin out, this caused me a massive headache until I figured it out. When putting it in the PS1 variable directly you will put [ to begin a color sequence and ] to end one, but printf will print a literal [ and ] so instead you will have to use `
I use SpiralLinux on my old Inspiron but it’s basically just Debian with some user-friendly tweaks. I guess you could try Tiny Core or Porteus or something really small like that.
A custom Iosevka build for terminal and code and B612 font for everything else on the desktop. I moved recently from Monoid and Atkinson Hyperledgible.
I’ve already tried MX Linux on an old Thinkpad SL400, and didn’t see any difference from plain Debian.
Because it’s the stock Debian + custom themes/skins + some crappy useless minitools. The 99% of packages come from the official Debian repository, the rest are only the rice.
linux
Hot
This magazine is from a federated server and may be incomplete. Browse more on the original instance.