Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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
Comment

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"
Comment

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
Comment

PREVIOUS NEXT
Code Example
Shell :: until loop bash 
Shell :: generate crt and key openssl 
Shell :: command to change user default shell 
Shell :: git exclude file 
Shell :: linux show all group members 
Shell :: flutter Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this. 
Shell :: git checkout remote branch 
Shell :: git check if stash exists 
Shell :: Adding local user to Docker group 
Shell :: ubuntu wsl disable sudo password prompt 
Shell :: unable to resolve host myhost 
Shell :: git revert last commit 
Shell :: git deinit repo 
Shell :: root folders via gui ubuntu 
Shell :: nvm install version 
Shell :: vitejs tailwind 
Shell :: create .gitignore 
Shell :: see network trafic linux 
Shell :: install ruby on ubuntu 
Shell :: ubuntu not showing video thumbnails 
Shell :: …or push an existing repository from the command line 
Shell :: add more changes to same commit 
Shell :: install synergy ubuntu 
Shell :: push to github 
Shell :: refusing to exec crouton from noexec mount 
Shell :: tree command 
Shell :: print whole array in bash in new line 
Shell :: unattended-upgr 
Shell :: Problem binding to port 80: Could not bind to IPv4 or IPv6. 
Shell :: kde up maxfps 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =