Jack Wallen offers some crucial advice every Linux administrator should make habitual.
When you've been doing something for decades, certain things become so ingrained into your habit that you take them for granted. Such is the case with Linux. I've been using it since the late '90s, so habits have been deeply ingrained. I know to do certain things, and I do them without thinking.
SEE: 5 Linux server distributions you should be using (TechRepublic Premium)
Such is the case when working with systems like SSH or bash.
But not everyone knows about these habits, these fundamental things we do without thinking. And there's a parallel to be drawn, one that I'll share with you now.
I have to read through a lot of documentation. A. Lot. Of. Documentation. Very often I find that most documentation is either poorly written, broken or takes numerous shortcuts such as:
Do X (read how to do X here).
I get that. I've done it. But when someone is in a flow, trying to get something up and running quickly, they don't want to have to keep clicking links to open even more documentation to make whatever it is they are trying to deploy work. At a bare minimum, you (and your users) would be better served with something like:
- Do X - here's the breakdown of those steps:
- Do A.
- Do B.
- Do C.
When we take shortcuts, problems can occur. This is especially so when you start monkeying around with SSH and bash. Configure either one of those improperly and you could wind up locking yourself out of SSH connections or incapable of logging into your account. Both of those situations can throw a serious wrench into the works of your day.
SEE: Rust: What developers need to know about this programming language (free PDF) (TechRepublic)
So you rely on good habits to keep them from happening.
Problem is, if you've not been using Linux for long, those good habits have yet to settle in. With that in mind, I'm going to give you a piece of advice that you'll need to remember every time you go to work with SSH or bash. Consider this advice as fundamental as it gets for Linux admins.
Are you ready for that advice, because here it comes?
When you're configuring either SSH or bash it is crucial that you test those changes before you close the terminal you're working in. Let me explain.
- You've logged into a remote machine and are configuring its SSH daemon.
- After you've made the changes and restarted the SSH service, stay logged in with the current terminal.
- Attempt to remote into that server, via SSH, using a different terminal.
- If the SSH connection works, you should be OK to close out the original window.
- If the SSH connection fails, get back to work and reconfigure via the original terminal window.
- Wash, rinse, repeat until the connection works.
The same thing holds true when working with bash:
- Log into the machine in question.
- Make your changes to .bashrc (or whatever bash file you're working with).
- Save the changes.
- Open another terminal on the same machine.
- If the new terminal works as expected (and whatever configuration changes you made are satisfactory), close both terminals and move on to the next task.
- If the terminal doesn't work, go back to the original terminal and troubleshoot the problem.
- Wash, rinse, repeat until you can open a second terminal without issue.
The key here is to remember you could seriously FUBAR your day by an improperly configured bash or SSH. Imagine you've tanked the .bashrc configuration file to the point where it will no longer allow you to log in with that user. Trust me, I've done this a time or two in my early days. It's not fun...especially when you know you could have avoided the disaster by erring on the side of caution.
And that's the key here ... caution. You're working on your data center (not a desktop), so you must always err on that particular side of the fence. And until you have those particular types of habits ingrained into your muscle memory, never fail to remind yourself that a bit of extra testing will go a long way to prevent your day from being ruined by a simple mistake. This is especially true when making changes to systems like bash and SSH on a production machine, where one misplaced character could make the difference between you being able to log in or not.
In the end, always test before you close out that terminal.
And for those who write documentation for the programs and services you create, don't skip steps, and always keep those documents up to date.
- Linux 101: How to execute commands from within the nano text editor (TechRepublic)
- Linux 5.14 kernel: New and exciting features coming to the release (TechRepublic)
- How to become a developer: A cheat sheet (TechRepublic)
- Kubernetes: A cheat sheet (free PDF) (TechRepublic)
- Microsoft Linux is not what you thought (or hoped) it would be (TechRepublic)
- A guide to The Open Source Index and GitHub projects checklist (TechRepublic Premium)
- Linux, Android, and more open source tech coverage (TechRepublic on Flipboard)