Under Linux, the usermod
command changes user names. It modifies the system account files to reflect the changes that are specified on the command line.
To change just the username:
usermod --login new_username old_username
To change the username and home directory name:
usermod --login new_username --move-home --home path_to_the_new_home_dir old_username
You may also want to change the name of the group associated with the user:
groupmod --new-name new_username old_username
Related Posts:
- How do I grep recursively?
- How do I grep recursively?
- How do I grep recursively?
- 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
- How can I exclude directories from grep -R?
- How can I exclude directories from grep -R?
- Argument list too long error for rm, cp, mv commands
- Difference between using “chmod a+x” and “chmod 755”
- How to cat <
> a file containing code? - Extract file basename without path and extension in bash
- 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”
- How to download a file from server using SSH?
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- What does `set -x` do?
- Command to change the default home directory of a user
- Using ls to list directories and their total sizes
- What does “&” at the end of a linux command mean?
- Can’t remove a directory in Unix
- Syntax error near unexpected token ‘then’
- C fopen vs open
- 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
- 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?
- 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 does ‘set -e’ do, and why might it be considered dangerous?
- Meaning of directories on Unix and Unix like systems
- How to remove empty/blank lines from a file in Unix (including spaces)?
- How to forcibly close a socket in TIME_WAIT?
- How to get pid of just started process
- Can you have more than one ~/.ssh/config file?
- How to disable everything in crontab -l?
- create home directories after create users
- How to sort ps output by process start time?
- Bash: No such file or directory?
- What’s a .sh file?
- sudo: npm: command not found
- How can I symlink a file in Linux? [closed]
- Kill detached screen session [closed]
- How to get the url of the current svn repo?
- How to unmount a busy device
- How to unmount a busy device
- How to kill a process running on particular port in Linux?
- No space left on device
- How to perform grep operation on all files in a directory?
- Amazon Linux: apt-get: command not found
- How to change permissions for a folder and its subfolders/files in one step
- Docker can’t connect to docker daemon
- Need a good hex editor for Linux
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Directory Inode vs Regular File Inode
- can’t remove python pip
- How would I get a cron job to run every 30 minutes?
- How to automatically redirect HTTP to HTTPS on Apache servers?
- Is there a “goto” statement in bash?
- Post request with Wget?
- Telnet [Unable to connect to remote host: Connection refused]
- Terminal Multiplexer for Microsoft Windows – Installers for GNU Screen or tmux
- Is there an alternative sleep function in C to milliseconds?
- Gedit command not working in kali linux terminal
- Curl : connection refused
- How to install Android SDK on Ubuntu?
- How can I use grep to show just filenames on Linux?
- Bash script prints “Command Not Found” on empty lines
- Why does “docker attach” hang?
- Bash export command
- How to edit gitignore file
- Retrieve last 100 lines logs
- What are various options / arguments for “./configure” in Linux
- Adding a new entry to the PATH variable in ZSH
- Can’t upload media to my Raspberry Pi WordPress server
- What permissions should my website files/folders have on a Linux webserver?
- Why is my crontab not working, and how can I troubleshoot it?
- Can I automatically add a new host to known_hosts?
- Why is “chmod -R 777 /” destructive?
- How can I run Debian stable but install some packages from testing?
- How to check if a library is installed?
- Meaning of the buffers/cache line in the output of free
- Is it normal to get hundreds of break-in attempts per day?
- How to cd into a directory with this name “-2” (starting with the hyphen)?
- how to disable SSH login with password for some users?
- How do I prevent accidental rm -rf /*?
- How can I port forward with iptables?
- Why do we use a OS Base Image with Docker if containers have no Guest OS?
- REJECT vs DROP when using iptables
- Linux command line best practices and tips?
- How to run command as user who has /usr/sbin/nologin as Shell?
- df says disk is full, but it is not
- What is the maximum port number?
- Is there a proper way to clear logs?
- protocol version mismatch — is your shell clean?
- How do I join two named pipes into single input stream in linux
- How should an IT department choose a standard Linux distribution?