LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 07-01-2015, 06:11 PM   #1
TheBigMing
Member
 
Registered: Dec 2008
Location: east anglia
Distribution: SuSE, antiX
Posts: 45

Rep: Reputation: 8
A solved usermod problem - but why?


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.

I tried to use:

#su
# usermod

============================================================================
https://wiki.archlinux.org/index.php/Change_username

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
 
Old 07-05-2015, 06:48 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
rename????

I find your post most confusing.
Was the really question about how to rename a drive (or partition), or about renaming a user?

Certainly the direct methods to rename a user will work, but there are tools for that work that are less risky as you found.

The real objective is not clear.
 
Old 07-06-2015, 08:56 AM   #3
TheBigMing
Member
 
Registered: Dec 2008
Location: east anglia
Distribution: SuSE, antiX
Posts: 45

Original Poster
Rep: Reputation: 8
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?"

Thanks for any help.

dmk
 
Old 07-06-2015, 11:00 PM   #4
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Fun

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.
 
1 members found this post helpful.
Old 07-07-2015, 07:22 AM   #5
TheBigMing
Member
 
Registered: Dec 2008
Location: east anglia
Distribution: SuSE, antiX
Posts: 45

Original Poster
Rep: Reputation: 8
Ah well! Not sure that I fully understand even now but, at least, I got done what I wanted

Thanks for the help.

dmk
 
Old 07-08-2015, 06:42 AM   #6
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
usermod

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.

Glad you ended where you wanted. Luck!
 
1 members found this post helpful.
Old 07-09-2015, 09:04 AM   #7
TheBigMing
Member
 
Registered: Dec 2008
Location: east anglia
Distribution: SuSE, antiX
Posts: 45

Original Poster
Rep: Reputation: 8
Quote:
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!

Thanks again for your help.

dmk
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Why can't I mark thread as solved? LAPIII LQ Suggestions & Feedback 2 03-18-2011 05:24 PM
[SOLVED] solved cancell this thread tkmsr Linux - Desktop 5 11-07-2010 10:22 PM
Thread Tools -> Mark this thread as solved Aquarius_Girl LQ Suggestions & Feedback 14 06-19-2010 02:13 PM
Mark thread as solved? leupi LQ Suggestions & Feedback 1 03-17-2007 08:14 AM
[thread control suggestion] add a "solved" button that the thread starter can click atom LQ Suggestions & Feedback 3 03-24-2005 11:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration