A New Ubuntu VM With Your Username

While many of the VMs I create are meant to be short-lived, some are created as working environments for me. For me, it is infinitely easier to have them all have the username ‘ed‘ so that my brain doesn’t have to do too much context-switching, and so I can use muscle memory.

When creating a new VM with an Ubuntu image, though, the default user is ‘ubuntu‘. It’s rather simple to change that to ‘ed’, but to do it correctly requires a series of steps. Note that these steps are for the current 18.04 LTS release; other releases may need some small changes, but the general steps should be the same. And as I found out those steps by searching the web and finding blogs of people who had done similar things, I thought I’d write down the steps so that in the future others can find this posting and find it useful. And it’ll also be easier for me to find all of it in one place!

So start by creating a VM, using whatever tool you prefer. I use OpenStack (surprise!), which gives me the ability to upload my public key and have it available in the VM so that passwords aren’t needed. The one I’m working on today is for deploying my IRCbot using kubernetes, so I named the instance ‘kubeirc‘. I add a line to my /etc/hosts file to point that name to the IP address of the instance. Once the VM is running I can connect using:

ssh ubuntu@kubeirc

Some people feel that using a password-less sudo reduces security, but if someone has access to your user in your VM, you are probably already pretty hosed. So I change sudo to not require passwords. To do this, run sudo visudo, and change the line beginning with ‘%sudo’ to read:

%sudo   ALL=NOPASSWD: ALL

One of the problems to overcome is that you cannot rename the user you used to SSH into the instance. So I create another user, and give them sudo powers:

sudo adduser temp
sudo usermod -a -G sudo temp

My cloud doesn’t allow SSH with passwords, so the next thing to do is copy the public key from the ubuntu user to the temp user:

sudo cp -R .ssh /home/temp/
sudo chown -R temp:temp /home/temp

Once that’s done, I disconnect the SSH session, and the re-connect as the temp user:

ssh temp@kubeirc

If that doesn’t connect you, go back in as the ubuntu user and re-check the permissions on the /home/temp/.ssh directory and its contents – that’s usually the problem. Once I’m connected as temp, I can then get to work on switching the ubuntu user.

# Change the ubuntu username to 'ed', and change the home directory
sudo usermod -l ed -d /home/ed -m ubuntu
# Rename the 'ubuntu' group
sudo groupmod -n ed ubuntu

That’s it! Now to verify, disconnect the current SSH session, and re-connect with the new name. Since my username on my home system is ‘ed’ (I told you I like muscle memory), I can just run:

ssh kubeirc

…and I’m in! The only thing left is to remove the ‘temp’ user. It’s not critical that you do so, but I like to clean up after myself. To do that, run the following:

sudo deluser temp

That will delete the user and group named ‘temp’, as well as the ‘/home/temp’ directory.

Now I can continue using that VM with the same username as my other development environments. And while this isn’t a large amount of work to do each time, I’d rather not do such repetitive work if I don’t have to. So I add my standard stuff, such as git and vim configuration files, and then take a snapshot of the instance at this point. In the future, whenever I need an Ubuntu 18.04 instance, I can create it from this snapshot, and I’m ready to go.

Post-op

As I mentioned earlier, on Monday I had surgery for a total replacement of my left knee. Long story short: it went better than I could have ever imagined.

The first thing I was to say is how wonderful the staff at the hospital was. Everyone there seemed to focus on making sure that a) I knew what was going on around me and b) that I was feeling OK. To illustrate this, I took a pano of my view from my bed:

Hospital wall charts
Hospital wall charts at the foot of my bed

The charts have most of the information I needed. The leftmost chart shows what I should expect for my progress after the surgery until I am discharged; the center chart has the name of my doctors and nurses, along with notes on what I had already done; and the chart of the right lists all the medications I was on, what they were for, and what other effects they might have. When a new shift came on, the first thing the nurses did was introduce themselves and write their names down. This was very helpful to my drug-addled brain!

Speaking of drug-addled, I don’t remember anything from when they wheeled me into the operating room until when I was back in my room. However, my wife spoke with me as soon as I came out of recovery, and said I told her about several things that happened as they were prepping me for surgery, as well as some comments about waking up in the recovery room. I don’t remember any of that! Apparently whatever sedative they gave me didn’t interfere with short-term memory, but prevented long-term memories from forming. It’s so odd to have someone talk about things that you told them, and you have no clue!

I got precious little sleep that night. First, there is the problem with being awakened every few hours for blood pressure / heart rate measurement. But the main problem was that I had to put my surgical leg into this foam block that elevated my heel an inch or so above the bed. That may not sound like much, but the effect is to force my leg to stretch, as there was nothing supporting my knee. That constant stretching is essential to getting the full range of motion back, but oh man was it painful, even after taking the opioid painkillers! However, after 3 nights of using the block, it feels fine. Making progress like that is always encouraging.

The day after surgery they got you out of bed early to do some physical therapy, and then later had classes for “The Joint Club”: all the people who had had joint replacements the previous day. The nurses and physical therapists went over all of the exercises we would need to do for the next 6 weeks, making sure that everyone was doing them correctly. They also answered all the questions people had about what they should expect. I left there feeling that I knew just how things would progress. Boy, was I wrong! But in a good sense – my progress has been even better!

I’ve gotten a good range of motion back, although I still have a ways to go. I can walk without using my walker, but always use it for safety reasons: one fall and I could undo everything. I do the physical therapy exercises 3 times a day, and they can be very painful! When I’m doing them I keep reminding myself that this short-term pain will result in a much healthier knee in the long run.

And no post-operative report would be complete without a shot of the scar! Well, it’s not a scar yet, but yesterday when the nurse came to inspect the wound and replace the dressing, I managed to get a shot of it: 32 meticulous staples that look like I have a zippered knee!

Post-surgery knee with staples

You can also see the compression marks on my skin. Apparently blood clots are a potential complication of this type of surgery, so besides exercises to keep the blood flowing, I have to wear compression stockings on both legs for 6 weeks. It ain’t pretty, but if it keeps me healthy, so be it.

I’ll try to post one more follow-up in a few weeks with my continued progress. Until then, back to the PT!

The Night Before

My knee replacement surgery is tomorrow. I have to be at the hospital at 5:30 AM, which will be difficult enough in itself!

On Friday I decided to give my knee one last fling, so that I have a clear memory of how much I was limited by the arthritis. I did 15 minutes on the elliptical machine at the gym, and then later in the afternoon I hit a bucket of balls at the driving range. Well, I made it about 2/3 of the way through the bucket when I started to feel a twinge in my knee, so I gave the rest to the guy next to me and headed home.

For the past decade or so, I’ve dealt with my knee, as well as my other painful joints, by taking Aleve (naproxen sodium). If I knew I would be doing something active, I would take it ahead of time prophylactically, and always took it afterwards. This would keep the inflammation to a minimum. However, when you are having surgery, they make you stop taking all drugs a week ahead of time, as they can increase your chances of blood clots during surgery. So after my exertion during the day, my knee was throbbing pretty badly at night. The pain continued through the weekend, and it’s still present as I’m typing this. Obviously I had relied on Aleve to mitigate the pain in my knee so much that I had forgotten just how bad it could be.

I probably won’t be able to add to this blog for a few days, but I’ll try to remember as much of the experience as I can so I can write about it later.

Out With the Old (knee), In With the New

This coming Monday I’m having total knee replacement surgery. Neither of my knees is very healthy, but my left knee has been particularly painful. It’s been over a decade since there has been any cartilage between the bones of the knee, and all that wear and tear has taken its toll.

I tried to get my actual x-ray to illustrate this post, but that proved to be difficult, so here’s one I got off of Google Images:

knee xray
X-ray of a Normal knee vs Arthritic knee

Normally the bones are separated by cartilage, which allows them to move without much friction. My left knee’s x-ray looks almost exactly like the image on the right. I have had to have all the cartilage in that joint removed over the years, and now it’s “bone on bone”.

I’ve written about my physical ailments before, and for the past two years I’ve been despondent over this decline. Then this past November came the email from the state soccer referee representative informing us of the upcoming registration and re-certification for the 2019 season. I thought about my complete lack of involvement in soccer over the past two years: I reffed a few games in early 2017, and didn’t ref a single game in 2018. I had decided that I should face the truth and retire. I told my wife and family, and felt at peace at finally accepting that this was something I simply could no longer do.

But a couple of weeks later it started gnawing at me. I didn’t want to give this up without a fight. I told my wife that I was thinking about getting a knee replacement, with the goal of being able to ref a few games by the end of 2019. She was 100% behind me, so after the holidays I started looking around for a surgeon. After many hours researching knee surgeons in San Antonio, I found Dr. David Fox, and set up an appointment. We discussed what would be involved, and he didn’t sugar-coat anything. He told me to “expect 6 weeks of hell” after the surgery, as the recovery process involves doing a lot of physical therapy exercises that can be painful. Normally, people undergoing this surgery have to take 3–4 weeks (and sometimes longer) off of work, but as I work from my home, I can be back at work as soon as I’m off my pain meds and mentally clear.

I’ll be sure to follow the course of the surgery and recovery process in future posts. Now I’m ready for my 6 weeks of hell!