Horje
change username and home directory linux Code Example
linux change username
# login as root and make sure that there are no active processes for user
usermod -l NEW_USERNAME OLD_USERNAME
# if user is running kill user w the following command
userUID=$(id -u OLD_USERNAME) && pkill -U $userUID
change username and home directory linux
1) Log out from current session and log as root user.
2) If you cannot log as root user add another account temporary and log in with it.
3) Run "sudo usermod -l <newuser> <olduser>" from that account.
4) Make sure new account can run sudo. Run this to add new user with sudo privileges. "sudo adduser <username> sudo". This need in case of you cannot log as root.

If you need to change home directory too run this "sudo usermod -d /home/newHomeDir -m newUsername"
change user of a directory in linux
chown vivek:vivek demo.txt
ls -l demo.txt

#output
-rw-r--r-- 1 vivek vivek 0 Aug 31 05:48 demo.txt




Shell

Related
asyncstorage community Code Example asyncstorage community Code Example
Terminal commands to push a file to Github Code Example Terminal commands to push a file to Github Code Example
remove letter in string bash Code Example remove letter in string bash Code Example
tmux set color Code Example tmux set color Code Example
bash try catch Code Example bash try catch Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9