Anda di halaman 1dari 5

Change Home Directory in Linux | Jesin's Blog

1 of 5

http://jesin.tk/change-home-directory-in-linux/

Jesin's Blog
Home

Categories

WordPress Plugins

Contact Me
Home

Linux

Home About Me Contact Me Privacy Policy Sitemap

Privacy Policy

Change Home Directory in Linux

Toolbox

About Me

Sitemap
Search

Change Home Directory in Linux

January 30, 2011 Linux No Comments

Get a wealth of information delivered

Change the home

miss a single article.

directory of a
Linux user with a
simple usermod
command. While
creating a user if
you didnt specify
any home
parameter Linux
assumes the
home directory of

to your inbox. Subscribe and never

Tutorials and howtos


Code, scripts and commands
Online Tools

Enter your email ID below an


hit Subscribe
Su

bs

cri
be

the user to be
/home/username
even if you did specify you can later change it to
something else according to your needs. Apart from
changing the home directory using the usermod
command youll have to assign proper ownership and
permissions to the new folder. You can also change
the home directory by editing the /etc/passwd file. Ill
outline both the steps here.

22-May-14 6:21 PM

Change Home Directory in Linux | Jesin's Blog

2 of 5

http://jesin.tk/change-home-directory-in-linux/

Change the home directory using usermod


This method is for command line warriors. Before you
use the usermod command the new home directory
should be created, ownership should be assigned to
the new user and the folder should be chmoded
correctly so that no one else can access it. Run the
following commands to do it.
mkdir /home/new_home_directory
chown username:username /home/new_home_directory
chmod 700 /home/new_home_directory
usermod --home /home/new_home_directory username

Change the home directory by editing /etc/passwd


Alternatively you can also edit the /etc/passwd to
change the home directory. But you should be careful

Find us on Facebook

not to edit anything else. Before editing this file it is

Jesin's Blog

always better to create the new home directory and

Like

assign proper permissions and ownership to it.


95 people like Jesin's Blog.

Execute the following commands.


mkdir /home/new_home_directory
chown username:username /home/new_home_directory
chmod 700 /home/new_home_directory

Open the /etc/passwd file using a text editor and

Facebook social plugin

locate the line containing the required username it


should look something like this

Tools

username:x:500:500::/home/username:/bin/bash

change it to

DNS Lookup Tool


htdigest Generator Tool

Online
username:x:500:500::/home/new_home_directory:/bin/bash
htpasswd Generator
Save the file.
Finally copy all the old content to the new home

Tool Online
HTTP Headers Lookup
Tool

22-May-14 6:21 PM

Change Home Directory in Linux | Jesin's Blog

3 of 5

http://jesin.tk/change-home-directory-in-linux/

directory
cp -f /home/username/* /home/new_home_dir/

MD5 Encryption Tool


Open Port Check Tool
SHA-1 Encryption Tool
URL Encoding/Decoding

Like

Command to Display
Directory Sizes in

How to change the


default runlevel in

Tweet

Tool

Related Posts:

Change the default


Directory Index in

Change Registered To
in Windows

Enjoyed reading this article, subscribe


to stay up-to-date with more such
articles

Tags: linux commands, usermod


Leave a Reply
Your email address will not be published. Required
fields are marked *

22-May-14 6:21 PM

Change Home Directory in Linux | Jesin's Blog

4 of 5

http://jesin.tk/change-home-directory-in-linux/

Name (Required)

Email (will not be published) (Required)

Website (Optional)

Comment

You may use these HTML tags and attributes: <a


href="" title=""> <abbr title=""> <acronym
title=""> <b> <blockquote cite=""> <cite>
<code> <del datetime=""> <em> <i> <q
cite=""> <strike> <strong>

22-May-14 6:21 PM

Change Home Directory in Linux | Jesin's Blog

5 of 5

The Man behind this blog

http://jesin.tk/change-home-directory-in-linux/

Nav

Lets Socialize

Home
About Me
Contact Me
Privacy Policy
Sitemap

Jesin's Blog by Jesin A is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0


International License.
Based on a work at jesin.tk.

22-May-14 6:21 PM

Anda mungkin juga menyukai