I want to rename my own username and directory without creating additional users with sudo privileges or switching to root. Is that possible from cli?
Asked
Active
Viewed 168 times
2
-
I suppose you (being root) can enough easily change the name of your $HOME, the username inside various password files and group files (if they are not using your usernameID number), the path of your home inside passwd files. Not so easy change it inside various databases in the system, credential for authentication (ssh) etc etc... – Hastur Jun 25 '23 at 11:52
2 Answers
3
No, it isn't.
Usernames on a Linux system (as in most other general-purpose operating systems) are chosen exclusively by the system's administrator, unless they deliberately set up some kind of self-service system for that.
u1686_grawity
- 426,297
- 64
- 894
- 966
-
-
1@zakadmin Such systems don't make the changes under the users own account. They simply generate a batch-job with the requested changes which then gets send to another process that runs under a privileged account that has the rights to actually make the changes. The company I work for has such a system (for Active Directory and Linux/Unix (yellow pages) accounts), but it is in-house developed, so not available as a product. – Tonny Jun 25 '23 at 12:05
-
@zakadmin: None that would be generic (i.e. if you're expecting one to simply be installed on your system, you won't find it). In the rare cases when self-service account creation or renaming is done, it's usually built custom by the admin. (And even then, I've only seen account _creation_ automated; every single "public" Linux/Unix/VMS system that I've used which had self-service signup nevertheless did not have automatic account renaming at all.) – u1686_grawity Jun 25 '23 at 12:41
-2
If you have physical access, anything is possible.
Boot from installation media into some form of recovery or single-user mode, edit /etc/passwd etc. as required.
However with anything like this there's a real risk of messing up e.g. PAM-based authentication, SAMBA and so on if bypassing the programs set up to "do the job properly".
Mark Morgan Lloyd
- 219
- 1
- 5