Ibrahim’s comment on the other answer is the correct way to alter an existing user’s home directory.
Change the user’s home directory:
usermod -d /newhome/username username
usermod
is the command to edit an existing user.-d
(abbreviation for --home
) will change the user’s home directory.
Change the user’s home directory + Move the contents of the user’s current directory:
usermod -m -d /newhome/username username
-m
(abbreviation for --move-home
) will move the content from the user’s current directory to the new directory.
Related Posts:
- Given two directory trees, how can I find out which files differ by content?
- Diff command along with Grep gives “Binary file (standard input) matches”
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- What does “&” at the end of a linux command mean?
- Syntax error near unexpected token ‘then’
- What does ‘set -e’ do, and why might it be considered dangerous?
- How do I grep recursively?
- How do I grep recursively?
- How do I grep recursively?
- How can I recursively find all files in current and subfolders based on wildcard matching?
- How to perform grep operation on all files in a directory?
- subprocess.Popen(): OSError: [Errno 8] Exec format error in python?
- How to substitute shell variables in complex text files
- How can I recursively find all files in current and subfolders based on wildcard matching?
- How do I use grep to search the current directory for all files having the a string “hello” yet display only .h and .cc files?
- SSH using python script
- Curl command for https ( SSL )
- How can I exclude directories from grep -R?
- How to exclude a directory in find . command
- “sed” command in bash
- How can I exclude directories from grep -R?
- How to exclude a directory in find . command
- Shell command to tar directory excluding certain files/folders
- Argument list too long error for rm, cp, mv commands
- Difference between using “chmod a+x” and “chmod 755”
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Who can access a file with octal permissions “000” on Linux/UNIX?
- How to cat <
> a file containing code? - Extract file basename without path and extension in bash
- Pseudo-terminal will not be allocated because stdin is not a terminal
- screen Cannot open your terminal ‘/dev/pts/0’ – please check
- ./configure : /bin/sh^M : bad interpreter
- How to download a file from server using SSH?
- Is there a “goto” statement in bash?
- Implementing shell in C and need help handling input/output redirection
- What does `set -x` do?
- Writing a simple shell in C using fork/execvp
- Implementation of multiple pipes in C
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- Using ls to list directories and their total sizes
- Can’t remove a directory in Unix
- What does set -e mean in a bash script?
- What does set -e mean in a bash script?
- C fopen vs open
- Using grep and ls -a commands
- How to use sed to extract substring
- Restarting cron after changing crontab file?
- How do I write stderr to a file while using “tee” with a pipe?
- cd into directory without having permission
- How do I know the script file name in a Bash script?
- Copying a large directory tree locally? cp or rsync?
- Can I nohup/screen an already-started process?
- Environment variables of a running process on Unix?
- In my /etc/hosts/ file on Linux/OSX, how do I do a wildcard subdomain?
- Shell command to monitor changes in a file
- When does /tmp get cleared?
- SSL Certificate Location on UNIX/Linux
- Is it possible to detach a process from its terminal? (Or, “I should have used screen!”) [duplicate]
- What is “-bash: !”: event not found”
- Meaning of directories on Unix and Unix like systems
- How to add a timestamp to bash script log?
- How to remove empty/blank lines from a file in Unix (including spaces)?
- How to forcibly close a socket in TIME_WAIT?
- Colors in bash after piping through less?
- How can I kill all stopped jobs?
- How can I rename a Unix user?
- How to run command as user who has /usr/sbin/nologin as Shell?
- How to get pid of just started process
- Can you have more than one ~/.ssh/config file?
- How to disable everything in crontab -l?
- How to sort ps output by process start time?
- Is there a way to do a remote “ls” much like “scp” does a remote copy?
- How do I join two named pipes into single input stream in linux
- Amazon Linux: apt-get: command not found
- Where can I find php.ini?
- gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- Explaining the ‘find -mtime’ command
- mv: cannot stat error : No such file or directory error
- Shell script “for” loop syntax
- Linux error while loading shared libraries: cannot open shared object file: No such file or directory
- TCP congestion control version: HTCP module vs highspeed module in linux kernel
- How to use regex with find command?
- Yum fails with – There are no enabled repos.
- Unable to establish SSL connection upon wget on Ubuntu 14.04 LTS
- configure: error: cannot run C compiled programs
- Difference between exec, execvp, execl, execv?
- How to run a server on port 80 as a normal user on Linux?
- Moving an already-running process to Screen
- Permission denied (publickey). SSH from local Ubuntu to Amazon EC2 server
- LVM dangers and caveats
- How to know from which yum repository a package has been installed?
- tar – Remove leading directory components on extraction
- How to list Apache enabled modules?
- How can I monitor hard disk load on Linux?
- What’s the reverse DNS command line utility?
- How to add a security group to a running EC2 Instance?
- How bad is it really to install Linux on one big partition?
- How do I extract login history?
- SSH from A through B to C, using private key on B [closed]
- Is it possible to reboot a Linux OS without rebooting the hardware?