1

Is it a bad idea to do usermod -l login-name old-name to change my username while leaving my home directory name intact?

A few years ago my university changed my username, but since it didn't affect anything, I did not change my local username. Now in order to use our centralized printers, the local username must match the university username (or so they claim). The reason I don't want to change my home directory is twofold.

  1. I think there are a number of scripts that have my username hardcoded into them.
  2. I think a change in my home directory name might throw my backup and revision control systems into a state of chaos.
3
  • 2
    Apart from confusing scripts/programs that make pretty bad assumptions, I can't think of any problem that would cause.
    – Mat
    May 7, 2013 at 11:37
  • 1
    Is anything to be said against making a symlink for the new name? May 7, 2013 at 11:38
  • 1
    @Mat A program that tries to deduce the home directory from the user name would also fail in places where homes are organized in ways such as /home/faculty/joe or /net/darkstar/homes/joe, which are fairly common in large institutions with unix-based IT. So there's no real risk there. May 7, 2013 at 22:48

2 Answers 2

3

There are no technical reasons against leaving your home directory's name alone. As others have noted, however, it's bound to confuse you (or someone else) at some point, so if this is something you're going to have to live with for a long time then it might be worth sorting out the mess now rather than later.

2

There are no purely technical reasons. It might create some confusion in cases where the USER environment variable is consulted while either $HOME, getpwuid(getuid()) or something similar should have been used.

By the way you can even have multiple usernames assigned to the same UID - locally this is achieved by multiplicating the appropriate lines in /etc/passwd, /etc/shadow and updating /etc/group accordingly. The ownership of files doesn't change (usually the first one found in /etc/passwd for the corresponding UID is displayed) and you can use any of the usernames you decide.

1
  • I think it might be worth reiterating @Gilles point about scripts using $USER instead of $HOME is bound to cause problems on many "big" systems.
    – StrongBad
    May 9, 2013 at 9:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .