Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
OK, here's a problem. I've sorted it out but I'm not sure why it occurred.
I am using openSuSE.13,2 and I have a 600Gb. hard drive. !00Gb is given over to the 5 bootable drives; the remaining 500Gb is a collection of 5 home drives. Everything is formatted as Ext4. I needed to rename one of the bootable drives.
Make certain that you are not logged in as the user whose name you are about to change! Open a new tty (Ctrl+Alt+F1) and log in as root or as another user and su to root. usermod should prevent you from doing this by mistake.
============================================================================
and went thru' the works (one of the problems the 'ExistingUserName' was always used by process 1236. HTOP could'nt identify this, but, it turned out to be systemd. Couldn't get anywhere
I finally launched SuSE as a root gui & edited the entry in the file /etc/passwd from
OldName:x:i000:100:MyName:/home/OldName:/bin/bash
to
NewName:x:i000:100:MyName:/home/NewName:/bin/bash
I then changed the name of the directory in 'home' from OldName to NewName
and
re-entered the password:
Bash - 4.2.53 : passwd NewName
New password:
Retype new password:
passwd: password updated successfully
(I also had to update the root password) & now it runs OK but, surely, this is not entirely according to Hoyle? Am I missing something?
EG:
Change A User's $HOME
This will only change the home directory of username. You do not need to manually create the new directory. The move is fully automatic.
# usermod -d /my/new/home username
Change A User's $HOME and Move Contents
This will move the contents of username's home directory to /my/new/home and set the user's home directory to the new one. Again, this is an automatic move.
# usermod -m -d /my/new/home username
dmk
Last edited by TheBigMing; 07-03-2015 at 05:44 PM.
Reason: re-format
Thanks for replying. The confusion I have is that my $LOGNAME, invariably my initials followed by the name of the O/S (SuSE, Mint, Gentoo or whatever) is the same as the name I give the /home/dir - that way, every time I open a terminal, I can see who & where I am!
All I know about the O/S, is that it is housed on one of 5x20Gb partitions.
the wiki.archlinux.org (which I usually find an excellent & wholly reliable source) recommended usermod -d or usermod -md - neither of which worked. I tried <Ctrl>+<Alt>+<F1> - no; looked at other sites - same advice.
I eventually went down the route I described & all went well.
My question is, basically, "Why didn't usermod work?"
Usermod (some versions) can change folder names. The usual pattern of /home/<username> works nicely.
Usermod does not change partition labels or mount names.
Your situation is not quite what it was really intended for, but very interesting.
OK, let me try again.
The usual install pattern for most modern Linux and BSD varients is a file system / with possibly a few others /boot, /var /home for example. Actual home folders live under /home and something like usermod can change, rename, create somewhat at will. It does not change the /home partition or folder, only contents. You have a situation where your home folder is its own mount. Programs designed to handle a folder rename cannot handle changing the mount, that requires more than they were designed for and more than the designers expected the program to have to handle.
Frankly, I do change like this manually anyway. I have seen many of these tools grow up, and the errors they caused in the past. I love it when they work, but not betting the job on them always getting everything right.
Actual home folders live under /home and something like usermod can change, rename, create somewhat at will. It does not change the /home partition or folder, only contents. You have a situation where your home folder is its own mount.
Aha! I'm beginning to get the picture - and, actually, it's just as well that I am. I have just installed antiX and the home folder is not in the "/home/" mount but in the same partition as the OS. I think I'll try re-installing!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.