Is it possible to change the name of a home directory?[Solved]

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Tuxkid
Level 2
Level 2
Posts: 50
Joined: Sun Nov 01, 2015 9:53 pm

Is it possible to change the name of a home directory?[Solved]

Post by Tuxkid » Thu Jun 20, 2019 6:05 am

I know it's possible to use mv to rename the directory, but very complicated things are sure to happen with file ownership.

I've screwed up the settings in my usual home directory and I can't figure out what needs fixing using the console. There's no problem with logging on with another user name -- except that all the files I access will not have the correct ownership settings. Quite a number of them have -rwxr--r-- kind of permissions and if would be very tedious to change then all individually.

Is there a clever way to do it [semi]automatically?

Sort of solved, anyway....

I got round the problem by renaming a bunch of hidden directories in ~/ which gave me back my X. It lost all my customization but I could redo those.
Last edited by Tuxkid on Sat Jun 29, 2019 5:00 pm, edited 2 times in total.

User avatar
JerryF
Level 11
Level 11
Posts: 3841
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: Is it possible to change the name of a home directory?

Post by JerryF » Thu Jun 20, 2019 7:41 am

Any particular reason you want to change your home directory name? I think that it's not a good idea.

Let's say your home user directory is named tuxkid:

Using the terminal, use

Code: Select all

sudo chown -R tuxkid /home/tuxkid
The -R option is the key. That will set ownership of all your directories and files under your home user directory to you.

I'm not fluent with the command chmod which you'll need to use to change the read/write flags. It also has the -R option (R means recursive).

I'm sure someone else will step in to help with that.
IF your problem has been solved, please edit your original post and add [SOLVED] to the beginning of the Subject Line. It helps other members when browsing posts.

Tuxkid
Level 2
Level 2
Posts: 50
Joined: Sun Nov 01, 2015 9:53 pm

Re: Is it possible to change the name of a home directory?

Post by Tuxkid » Fri Jun 21, 2019 4:20 am

JerryF wrote:
Thu Jun 20, 2019 7:41 am
Any particular reason you want to change your home directory name?
I didn't want to, but I can't access my usual home directory. I've run out of ideas how to fix that problem. There's no problem working as a different user with a different home directory but I need my usual login name to be able to enter root commands. So the only thing I can think of is to get things working as a different user, then copy or move a few hundred Gb of files, then renaming the home directory.

I think that it's not a good idea.
I'm still open to ideas as to how to fix the screen resolution from outside of X. Unfotunately xrandr will work only from within X, and I can't work out which file stores the configuration.
Let's say your home user directory is named tuxkid:

Using the terminal, use

Code: Select all

sudo chown -R tuxkid /home/tuxkid
The -R option is the key. That will set ownership of all your directories and files under your home user directory to you.

I'm not fluent with the command chmod which you'll need to use to change the read/write flags. It also has the -R option (R means recursive).
Yes, it's tricky

gm10
Level 19
Level 19
Posts: 9263
Joined: Thu Jun 21, 2018 5:11 pm

Re: Is it possible to change the name of a home directory?

Post by gm10 » Fri Jun 21, 2019 4:47 am

JerryF wrote:
Thu Jun 20, 2019 7:41 am
I'm not fluent with the command chmod which you'll need to use to change the read/write flags. It also has the -R option (R means recursive).
Recursive chmod is usually a recipe for disaster, so best don't even go there.
Tuxkid wrote:
Fri Jun 21, 2019 4:20 am
there's no problem working as a different user with a different home directory but I need my usual login name to be able to enter root commands.
You didn't share what's wrong with your original user but if it was the only user with sudo access then you need to log on as that user (if graphical logon fails then log on to it via a virtual console - press Ctrl+Alt+F1 and log on there) and then add your new account to the sudo group:

Code: Select all

sudo adduser USERNAME sudo
(replace USERNAME with the name of your new user)

Alt+F7 to get back to the graphical login.

PS: Renaming your home directory is possible but that does not appear the solution to whatever your problem is.
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

Post Reply

Return to “Software & Applications”