Hacker News new | ask | show | jobs
by 0cf8612b2e1e 674 days ago
It took me a shockingly long amount of time before I realized it was silly to have a username on my machines. I am the only person using this, why am I typing unnecessary cruft? Username switched to “a”, which ends up saving space in my home path and terminals.
2 comments

It took me a shockingly long amount of time before I realized it was silly to have a username on my machines. I am the only person using this, why am I typing unnecessary cruft? Username switched to “root” on all my machines and I remove the username from PS1. /root is shorter than /home/a (:
That requires faith in software not making hard coded assumptions about filesystem structure. Something which I am not prepared to do. How much software still cannot respect XDG?
Not a problem in practice. I've seen a lot of systems having user homes in places other than /home for various (usually historical) reasons. Never broke anything afaik.
It probably is fine. Still makes my spider sense tingle about some unforeseen failure that will crop up one day.
I've seen scripts with hardcoded "/home/$username" so your worries aren't entirely unfounded.

It's understandable too, because Linux doesn't provide a nice way to retrieve that information. You'll have to parse /etc/passwd (which might not contain all users) or hope that whatever language you're using supports path extrapolations so that you can do realpath(~username) or call a third party tool that does, like a shell.

Of course there is a nice way. 'getent passwd' if you have a shell script, or the getpwent() libc function if you are in some real programming language somewhere. That is ages-old POSIX stuff from almost the last century even (POSIX.1-2001, actually older than the standard even, since it has been in SystemV and BSD...), and Linux has always supported that.
$HOME.
ln -s /root /home/root
Just change your home directory to /me. Who cares about /home?

As for permissions: on a single human machine, sudo is useful principally to introduce friction to random install scripts doing random things to my system. In day to day use, there's no reason for me to input my password just to install some Firefox snap or something.

Once I had this thought and renamed the root user to my own name. Hilarity ensued.
lightdm brings up my username automatically, ~ is home. Are you saving much? That said, unix originals used three char usernames.
Login from a terminal requires exact username, so I am saving literal seconds per day. <a> <enter> just rolls off the keyboard.