Skip to content

User

  • Add user

    # do all the defaults: create home, select shell, prompt for password.
    adduser hawkey
    
    # do nothing
    useradd hawkey
    useradd -d /home/hawkey -s /bin/bash 
    
    passwd hawkey # change password
    
  • Delete user

    userdel hawkey
    userdel -r hawkey # delete home
    
  • switch user

    su hawkey
    su # root
    
  • add user to group

    usermod -aG g
    
  • add sudoer

    # recommend use this!
    usermod -aG sudo hawkey
    

    Or

    visudo # however, this is nano
    vim /etc/sudoers
    

    and append a line:

    hawkey ALL=(ALL) NOPASSWD:ALL
    
  • Change shell

    chsh -s /bin/bash # but never change shell for root !!!
    

    Or

    vi /etc/passwd
    

    and modify the corresponding line.