[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How do I change the default home path in linux using command line?

Posted on 2007-11-14
9
Medium Priority
?
3,108 Views
Last Modified: 2013-12-16
Hello Experts,
I recently installed kubuntu. Wanted to change the path to home and used some graphical utility to do that. Everything went fine untill restart.
X wouldn't go up, because permissions issues with the new home.
How can I restore the default home path?

Thanks
0
Comment
Question by:vvvlad42
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 4

Expert Comment

by:jcoombes
ID: 20282235
You could try modifying the home directory in the /etc/passwd file for your user.  In order to do this log on as this user (if you can) or root and then edit /etc/passwd within vi or a similar command line editor.

Cheers

JC
0
 
LVL 4

Expert Comment

by:jcoombes
ID: 20282241
You should probably restart to be on the safe side after modifying the entry...
0
 
LVL 3

Accepted Solution

by:
bayesianmind earned 1500 total points
ID: 20282319
A little more detail on this:

The default home directory is stored in /etc/passwd as has been said.
The file is a big list of users, and each line looks like this:
username:x:UID:GID:comment:homedir:shell

So you want to modify the second to last entry, probably to set it back to /home/username. Be careful in /etc/passwd not mess up the file. An easy editor that will edit nicely is nano -w (make sure you use the -w). Vim also works but its complicated if you don't know how to use it already.
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:vvvlad42
ID: 20282507
bayesianmind:
Thanks.
Already found this, but it appears that I deleted the dir (accidently)
How can I create dir with appropriate ownership?
0
 
LVL 3

Expert Comment

by:bayesianmind
ID: 20282545
mkdir /path/to/new/dir
chown -R user:usersgroup /path/to/new/dir
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 20282575
oh it is simple just copy over the skleton user directory to the new home and change owner such as this:

cp -R /etc/skel /newhome/user
chown -R user.group /newhome/user

That is it. In the first step you've created default user files and in the second step your user and group is the owner of the new directory recursively. the "-R" switchdoes this.

Cheers,
K.
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 20282734
But the correct way is to create it from the skeleton directory. This is what adduser does.
0
 
LVL 3

Expert Comment

by:bayesianmind
ID: 20282769
KeremE, you are right, but usually this directory is empty anyway.
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 20285645
it should not be :)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question