Skip to content

Instantly share code, notes, and snippets.

@jhaemin
Last active December 9, 2020 02:37
Show Gist options
  • Select an option

  • Save jhaemin/988fc7c7f66c75b492bb1c591d7f5f44 to your computer and use it in GitHub Desktop.

Select an option

Save jhaemin/988fc7c7f66c75b492bb1c591d7f5f44 to your computer and use it in GitHub Desktop.
# 711
# chroot
compgen -u # list all users
compgen -g # list all groups
cut -d: -f1 /etc/passwd # list local users
cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1 # human users
cat /etc/group # list all groups on system
sudo adduser username groupname
sudo deluser --remove-home username
sudo deluser --remove-all-files username
sudo addgroup groupname
sudo delgroup groupname
su - username # login to user (password required)
ssh-keygen -t rsa -m pem -C "[email protected]" # generate a new SSH key
echo [public_key_string] >> ~/.ssh/authorized_keys # copy public key to `authorized_keys` file
~/.ssh # 0700
~/.ssh/authorized_keys # 0600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment