Earlier quoted context omitted.
Moving ssh port is, IMNSHO, a stopgap measure; you should have exhausted all the other options (e.g. no passwords, no root login, denyhosts/fail2ban etc.) before this even crosses your mind. In other words, the inconvenience this brings is not adequate to the infinitesimal increase in security.
In other words, the inconvenience this brings is not adequate to the infinitesimal increase in security. You are wrong. Please refrain from giving security advice. Changing or filtering the SSH port prevents your host from being compromised by automated netrange sweeps in the event of a pre-auth ssh vulnerability. For this reason changing the SSH port is considered best practice.
SSH Kung Fu
81–90 of 133 posts
Re: SSH Kung Fu
#82A trick I learned recently: create .ssh/config File format: as many of the following blocks as you like Host $ALIAS You can now ssh to that server as that user by doing "ssh $ALIAS" on the command line, without needing to specify the port or user with the usual command line arguments, or necessarily spell out the entire host name.
Maybe it is just me, but I prefer to dump all my custom commands and aliases into .zshrc so they are easy to backup/track/find.
Re: SSH Kung Fu
#83While we are busy dispensing wisdom: Do use PermitRootLogin without-password instead of 'yes' in /etc/ssh/sshd_config if you absolutely must have ssh root access.
Re: SSH Kung Fu
#84Earlier quoted context omitted.
it still doesn't prevent your logs getting filled up with crap is my point.
Preventing logs from filling up is quite a cosmetic issue. Making the box hard to crack is certainly more relevant. Note that I'm not advocating against a port change; just saying that it's the very last of available options, as it's essentialy security-by-obscurity, and thus only gives you a feeling of higher security (due to less spam in the logs).
Re: SSH Kung Fu
#85A trick I learned recently: create .ssh/config File format: as many of the following blocks as you like Host $ALIAS You can now ssh to that server as that user by doing "ssh $ALIAS" on the command line, without needing to specify the port or user with the usual command line arguments, or necessarily spell out the entire host name.
I've been doing this for a while now, but my file is now huge and it's cumbersome to edit. Is there no utility to mange that file?
alias compile-ssh-config='echo -n > ~/.ssh/config && cat ~/.ssh/*.config > ~/.ssh/config'
alias ssh='compile-ssh-config && ssh'
Compiles all your ~/.ssh/*.config files into a single ssh config file. It's simple and stupid and seems to do the trick.Re: SSH Kung Fu
#86Disconnected from your host but not timed out yet? Press Enter, ~, . and the client will quit.
Re: SSH Kung Fu
#87Best trick I learned in the past few years is SSH control sequences. Disconnected from your host but not timed out yet? Press Enter, ~, . and the client will quit.
Re: SSH Kung Fu
#88While we are busy dispensing wisdom: Do use PermitRootLogin without-password instead of 'yes' in /etc/ssh/sshd_config if you absolutely must have ssh root access.
PermitRootLogin forced-commands-only
If it's necessary to run something as root — declare it beforehead. If you encounter a situation when you need to run something unusual on an automated basis — login as administrator (or edit your Puppet/Chef/Ansible/alike rules if you're on the smart system management side) and update ~root/authorized_keys.If one needs to SFTP as root, they could enlist `internal-sftp` target, too (although I haven't tested this, I don't SFTP as root and if I must update some files — I setfacl on them)
Re: SSH Kung Fu
#89Best trick I learned in the past few years is SSH control sequences. Disconnected from your host but not timed out yet? Press Enter, ~, . and the client will quit.
Ohh my, the day I learned this was one of the happiest in all my life. You can also configure this in your .ssh/config with EscapeChar, if you find yourself SSHing into other machines from a machine you're already SSHed into.
Re: SSH Kung Fu
#90Earlier quoted context omitted.
If you must allow SSH root access, in 2014, you are doing something horribly wrong, and this will come back to bite you.
Would you like to clarify how, from a security standpoint, the string "root" is worse than another user? Allowing root login can be a user-management headache in multi-user environments, but strong SSH security can exist for root just the same as for any other user.
If you need to conveniently update some files on regular basis — chown or setfacl on them to your usual user or group. If you need to update root-owned file once in a blue moon — scp && ssh sudo mv it, it's not that hard, but better for security.
Oh, and obviously there are exceptions to the rule - say, if you're configuring some freshly-installed system and doing heavy config editing by hand (say, Puppet is not your thing or you just don't care about re-deployment), temporary lifting security barriers is perfectly fine in most cases.