Difference between revisions of "Usermod"

From wikieduonline
Jump to navigation Jump to search
Line 17: Line 17:
 
You may need to start a new login shell after adding user: <code>su - USERNAME</code>
 
You may need to start a new login shell after adding user: <code>su - USERNAME</code>
  
<code>sudo usermod -l newusername oldusername</code> change user name
+
<code>sudo [[usermod -l]] newusername oldusername</code> change user name
  
 
== Related commands ==
 
== Related commands ==

Revision as of 13:37, 28 December 2023

usermod command included in passwd package: https://linux.die.net/man/8/usermod

Add an additional secondary group:

  • sudo usermod -aG sudo YOUR_USERNAME
  • usermod -a -G YOUR_GROUP YOUR_USERNAME

Change primary group for user:

usermod -g yournewprimarygroupname yourusername
usermod -s /usr/sbin/nologin myuser
ssh and scp will fail

You may need to start a new login shell after adding user: su - USERNAME

sudo usermod -l newusername oldusername change user name

Related commands

See also

Advertising: