Difference between revisions of "Usermod"

From wikieduonline
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
  
 
Change primary group for user:
 
Change primary group for user:
  usermod -g yournewprimarygroupname yourusername
+
  [[usermod -g]] yournewprimarygroupname yourusername
  
 
  usermod -s /usr/sbin/nologin myuser
 
  usermod -s /usr/sbin/nologin myuser
Line 27: Line 27:
  
 
== See also ==
 
== See also ==
 +
* {{usermod}}
 
* {{Linux Commands privileges}}
 
* {{Linux Commands privileges}}
  
 
[[Category:Linux]]
 
[[Category:Linux]]

Latest revision as of 13:41, 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[edit]

See also[edit]

Advertising: